Fixing actions problem with missing gfortran #348
Workflow file for this run
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] | |
exclude: | |
- os: macos-latest | |
python-version: 3.7 | |
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 | |
&& COSMOSIS_GCC_VER=$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) | |
&& GFORTRAN_PATH1=/usr/local/bin/gfortran | |
&& GFORTRAN_PATH2=/usr/local/bin/gfortran-${COSMOSIS_GCC_VER} | |
&& GFORTRAN_PATH3=/opt/homebrew/bin/gfortran | |
&& GFORTRAN_PATH4=/opt/homebrew/bin/gfortran-${COSMOSIS_GCC_VER} | |
&& if ! which -s gfortran | |
; then if [ -f $GFORTRAN_PATH2 ]; then ln -s $GFORTRAN_PATH2 GFORTRAN_PATH1; echo Linking gfortran from /usr/local | |
; elif [ -f $GFORTRAN_PATH4 ]; then ln -s $GFORTRAN_PATH4 GFORTRAN_PATH3; echo Linking gfortran from /opt/homebrew | |
; else echo "gfortran not found" && exit 1 | |
; fi | |
; 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==0.2.4 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 }} | |