Skip to content

Merge pull request #82 from macauff/hsc_test_fixes #2

Merge pull request #82 from macauff/hsc_test_fixes

Merge pull request #82 from macauff/hsc_test_fixes #2

# This workflow will install Python dependencies, run tests and report code coverage 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: Unit test and code coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: Linux, Python 3.8
os: ubuntu-latest
python-version: 3.8
toxenv: py38-test
gfortran-version: 9
- name: Linux, Python 3.9
os: ubuntu-22.04
python-version: 3.9
toxenv: py39-test
gfortran-version: 11
- name: Linux, Python 3.11
os: ubuntu-22.04
python-version: "3.11"
toxenv: py311-test
gfortran-version: 11
- name: macOS, Python 3.8
os: macOS-11
python-version: 3.8
toxenv: py38-test
gfortran-version: 10
- name: macOS, Python 3.10, coverage
os: macOS-11
python-version: "3.10"
# Include at least one coverage option for codecov.
toxenv: py310-test-cov
gfortran-version: 11
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- if: runner.os == 'macOS'
name: macOS gfortran
run: |
sudo ln -s /usr/local/bin/gfortran-${{ matrix.gfortran-version }} /usr/local/bin/gfortran
sudo mkdir /usr/local/gfortran
sudo ln -s /usr/local/Cellar/gcc@${{ matrix.gfortran-version }}/*/lib/gcc/${{ matrix.gfortran-version }} /usr/local/gfortran/lib
- if: runner.os == 'Linux'
name: ubuntu gfortran
run: sudo ln -sf /usr/bin/gfortran-${{ matrix.gfortran-version }} /usr/bin/gfortran
- name: Check gfortran version
run: gfortran --version
- name: Install dependencies
run: pip install numpy tox
- name: Run unit tests with pytest
run: |
mkdir ./.tmp
mkdir ./.tmp/${{ matrix.toxenv }}
tox -e ${{ matrix.toxenv }} -- --remote-data
- name: Upload coverage report to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@v3
with:
files: .tox/coverage.xml