morphMan CI #92
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
name: morphMan CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: '0 8 * * *' | |
env: | |
CACHE_NUMBER: 2 # Increase to reset cache | |
jobs: | |
check-code: | |
name: Check code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies and project | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install '.[test]' | |
- name: Run linting and checks | |
run: | | |
bash linting.sh | |
test-code: | |
needs: check-code | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/morphman-env | |
# Workaround for arm64: https://github.com/vmtk/vmtk/issues/452#issuecomment-1489829429 | |
- os: macos-13 | |
label: osx-64 # No support for arm64 | |
prefix: /Users/runner/miniconda3/envs/morphman-env | |
- os: windows-latest | |
label: win-64 | |
prefix: C:/Miniconda3/envs/morphman-env | |
name: Test morphMan on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: # https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
init-shell: bash | |
cache-environment: true | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
restore-keys: ${{ matrix.label }}-${{ env.CACHE_NUMBER }}- | |
- name: Install morphMan | |
run: | | |
python -m pip install '.[test]' | |
- name: Run tests | |
run: | | |
python -m pytest tests | |
- name: Upload coverage report to Codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: false | |
verbose: true |