Merge pull request #112 from joezuntz/campaign-self-name2 #308
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Continuous Integration | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
# run this every week at 12 noon on Monday | |
- cron: '0 12 * * 1' | |
jobs: | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10", 3.11] | |
os: [ubuntu-20.04, macos-latest] | |
include: | |
- os: ubuntu-20.04 | |
INSTALL_DEPS: sudo apt-get update && sudo apt-get -y install gfortran-7 swig libopenmpi-dev openmpi-bin libopenblas-dev && sudo ln -s `which gfortran-7` /usr/local/bin/gfortran | |
- os: macos-latest | |
INSTALL_DEPS: brew update-reset && HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gcc swig libomp open-mpi openblas && if [ ! -f /usr/local/bin/gfortran ]; then ln -s /usr/local/bin/gfortran-$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) /usr/local/bin/gfortran; fi | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: ${{ matrix.INSTALL_DEPS }} | |
- uses: actions/cache@v3 | |
name: Load pip cache | |
id: cache-pip | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }} | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -v . | |
pip install --no-binary=mpi4py mpi4py astropy pocomc pytest pytest-cov | |
- name: Test with pytest | |
run: | | |
cosmosis --version | |
mkdir tmp && cd tmp && pytest --pyargs cosmosis --cov cosmosis --cov-report=xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-20.04' | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |