Repository: adrn/schwimmbad (language: python)

Issue:
Move CI from travis -> actions
The current CI tests haven't been running because we were using Travis (RIP). We need to figure out how to install various MPI implementations on GitHub actions and run the tests there.

cc @dfm 


Discussion / hints:

Fix patch:
diff --git a/.coveragerc b/.coveragerc
index 983e21a..c5881e6 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -5,4 +5,5 @@ omit =
    */site-packages/*
 
 [run]
-parallel = True
\ No newline at end of file
+parallel = True
+relative_files = True
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b6c23ea..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-language: python
-
-python:
-  - 3.7
-  - 3.8
-
-os: linux
-dist: xenial
-sudo: required
-
-env:
-  global:
-    - TEST_CMD='py.test'
-    - MPI_TEST_CMD='python'
-  matrix:
-    - MPI=mpich
-    - MPI=openmpi
-
-matrix:
-  include:
-
-    - python: 3.7
-      env:
-        - MPI=openmpi
-        # - TEST_CMD='py.test --cov --cov-append'
-        - TEST_CMD='py.test --cov'
-        # - MPI_TEST_CMD='coverage run -a' # if we can get coverage working...
-        - MPI_TEST_CMD='python'
-        - RUN_COVERAGE=true
-
-before_install:
-  - sh ci/travis/install-mpi.sh $MPI
-
-install:
-  - pip install pytest
-  - pip install pytest-cov
-  - pip install cython
-  - pip install mpi4py>=3.0.0
-  - pip install joblib
-  - pip install dill
-  - pip install coveralls
-  - pip install alabaster
-  - pip install -vvv .
-
-before_script:
-  - if [[ "$MPI" == "mpich" ]]; then P=2; else P=5; fi
-
-script:
-  - mpiexec -n $P $MPI_TEST_CMD $PWD/schwimmbad/tests/test_mpi.py
-  - mpiexec -n $P $MPI_TEST_CMD $PWD/schwimmbad/tests/test_mpi_with_dill.py
-  - $TEST_CMD
-
-after_success:
-  - if [ "$RUN_COVERAGE" = true ] ; then
-        python -m coverage combine;
-        coveralls;
-    fi
diff --git a/ci/travis/install-mpi.sh b/ci/travis/install-mpi.sh
deleted file mode 100644
index bae2cf7..0000000
--- a/ci/travis/install-mpi.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-set -e
-case `uname` in
-Linux)
-  sudo apt-get update -q
-  case $1 in
-    mpich) set -x;
-      sudo apt-get install -y -q mpich libmpich-dev
-      ;;
-    openmpi) set -x;
-      sudo apt-get install -y -q openmpi-bin libopenmpi-dev
-      ;;
-    *)
-      echo "Unknown MPI implementation:" $1
-      exit 1
-      ;;
-  esac
-  ;;
-#Darwin)
-#  brew update
-#  case $1 in
-#    mpich|openmpi) set -x;
-#      brew install $1
-#      ;;
-#    *)
-#      echo "Unknown MPI implementation:" $1
-#      exit 1
-#      ;;
-#  esac
-#  ;;
-esac
diff --git a/setup.cfg b/setup.cfg
index 0d41504..d622c8c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,12 +22,12 @@ setup_requires = setuptools_scm
 [options.extras_require]
 test =
     pytest
+    pytest-cov
     pytest-astropy
-    cython
     mpi4py
     joblib
-    matplotlib
     numpy
+    dill
 docs =
     alabaster
     emcee


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..a3b3e0a
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,51 @@
+name: Tests
+
+on:
+  push:
+    branches: [ main, github-actions ]  # FIXME
+  pull_request:
+    branches: [ main ]
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.7, 3.8, 3.9]
+        mpi-dist: ["openmpi", "mpich"]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install OpenMPI
+      if: matrix.mpi-dist == 'openmpi'
+      run: sudo apt-get install -y -q openmpi-bin libopenmpi-dev
+    - name: Install MPICH
+      if: matrix.mpi-dist == 'mpich'
+      run: sudo apt-get install -y -q mpich libmpich-dev
+    - name: Install dependencies
+      run: |
+        python -m pip install -U pip
+        python -m pip install -e .[test]
+    - name: Test MPI
+      run: |
+        mpiexec -n 2 python $PWD/schwimmbad/tests/test_mpi.py
+        mpiexec -n 2 python $PWD/schwimmbad/tests/test_mpi_with_dill.py
+    - name: Unit tests
+      run: python -m pytest --cov schwimmbad
+    - name: Collect coverage results
+      uses: AndreMiras/coveralls-python-action@v20201129
+      with:
+        parallel: true
+        flag-name: ${{ matrix.python-version }}-${{ matrix.mpi-dist }}
+
+  coverage:
+    needs: test
+    runs-on: ubuntu-latest
+    steps:
+    - name: Combine and upload coverage
+      uses: AndreMiras/coveralls-python-action@v20201129
+      with:
+        parallel-finished: true