Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to run unit tests #349

Merged
merged 2 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Use pre-built docker containers to run our unit tests on different python versions.

name: Run Test Suite

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
py35:
name: Python 3.5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull Dependency Image
run: docker pull hpc4cmb/toast-deps-py35:latest
tskisner marked this conversation as resolved.
Show resolved Hide resolved
- name: Compile
run: docker run -v "$(pwd)":/home/toast --name="test_py35" hpc4cmb/toast-deps-py35:latest /home/toast/platforms/install_test_runner.sh && docker commit -m "test runner" test_py35 test_runner:py35
- name: Test Documentation Build
run: docker run -v "$(pwd)":/home/toast test_runner:py35 /home/toast/docs/build_docs.sh
- name: Run Serial Tests
run: docker run test_runner:py35 python -c 'import toast.tests; toast.tests.run()'
- name: Run MPI Tests
run: docker run test_runner:py35 mpirun -np 2 python -c 'import toast.tests; toast.tests.run()'
py36:
name: Python 3.6
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull Dependency Image
run: docker pull hpc4cmb/toast-deps-py36:latest
- name: Compile
run: docker run -v "$(pwd)":/home/toast --name="test_py36" hpc4cmb/toast-deps-py36:latest /home/toast/platforms/install_test_runner.sh && docker commit -m "test runner" test_py36 test_runner:py36
- name: Test Documentation Build
run: docker run -v "$(pwd)":/home/toast test_runner:py36 /home/toast/docs/build_docs.sh
- name: Run Serial Tests
run: docker run test_runner:py36 python -c 'import toast.tests; toast.tests.run()'
- name: Run MPI Tests
run: docker run test_runner:py36 mpirun -np 2 python -c 'import toast.tests; toast.tests.run()'
py37:
name: Python 3.7
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull Dependency Image
run: docker pull hpc4cmb/toast-deps-py37:latest
- name: Compile
run: docker run -v "$(pwd)":/home/toast --name="test_py37" hpc4cmb/toast-deps-py37:latest /home/toast/platforms/install_test_runner.sh && docker commit -m "test runner" test_py37 test_runner:py37
- name: Test Documentation Build
run: docker run -v "$(pwd)":/home/toast test_runner:py37 /home/toast/docs/build_docs.sh
- name: Run Serial Tests
run: docker run test_runner:py37 python -c 'import toast.tests; toast.tests.run()'
- name: Run MPI Tests
run: docker run test_runner:py37 mpirun -np 2 python -c 'import toast.tests; toast.tests.run()'
py38:
name: Python 3.8
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull Dependency Image
run: docker pull hpc4cmb/toast-deps-py38:latest
- name: Compile
run: docker run -v "$(pwd)":/home/toast --name="test_py38" hpc4cmb/toast-deps-py38:latest /home/toast/platforms/install_test_runner.sh && docker commit -m "test runner" test_py38 test_runner:py38
- name: Test Documentation Build
run: docker run -v "$(pwd)":/home/toast test_runner:py38 /home/toast/docs/build_docs.sh
- name: Run Serial Tests
run: docker run test_runner:py38 python -c 'import toast.tests; toast.tests.run()'
- name: Run MPI Tests
run: docker run test_runner:py38 mpirun -np 2 python -c 'import toast.tests; toast.tests.run()'
244 changes: 0 additions & 244 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions docs/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Copy the docs directory to the local working directory and build it with sphinx

set -e

# Get the absolute path to the docs folder
pushd $(dirname $0) > /dev/null
docdir=$(pwd -P)
popd > /dev/null

cp -a "${docdir}" ./docs
pushd ./docs > /dev/null
make html
popd > /dev/null
12 changes: 1 addition & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,8 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Parse the formal "RELEASE" file in the top-level directory. This should
# reflect the current tag or in-development version.
#
fvparts = None
with open("../RELEASE", "r") as rel:
line = rel.readline().rstrip()
fvparts = line.split(".")

# The short X.Y version.
# version = "{}.{}".format(fvparts[0], fvparts[1])
# The full version, including alpha/beta/rc tags.
release = ".".join(fvparts)
release = toast.__version__
# Use the full version
version = release

Expand Down
30 changes: 30 additions & 0 deletions platforms/install_test_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# This script is for a complete build and install to /usr/local inside a
# docker container. It is used when running CI unit tests.

set -e

# Get the absolute path to the source tree
pushd $(dirname $(dirname $0)) > /dev/null
toastdir=$(pwd -P)
popd > /dev/null

mkdir build
pushd build

cmake \
-DCMAKE_C_COMPILER="gcc" \
-DCMAKE_CXX_COMPILER="g++" \
-DMPI_C_COMPILER="mpicc" \
-DMPI_CXX_COMPILER="mpicxx" \
-DCMAKE_C_FLAGS="-O3 -g -fPIC -pthread" \
-DCMAKE_CXX_FLAGS="-O3 -g -fPIC -pthread -std=c++11" \
-DPYTHON_EXECUTABLE:FILEPATH=$(which python3) \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
"${toastdir}"

make -j 2 install

popd > /dev/null
Loading