OasisMove CI #588
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: OasisMove CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 8 * * *' | |
env: | |
CACHE_NUMBER: 4 # Increase to reset cache | |
jobs: | |
run-lint-check: | |
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 OasisMove | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install '.[test]' | |
- name: Run linting and checks | |
run: | | |
bash linting.sh | |
run-tests: | |
needs: run-lint-check | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/oasismove-env | |
- os: macos-13 | |
label: osx-64 | |
prefix: /Users/runner/miniconda3/envs/oasismove-env | |
name: Test OasisMove 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 OasisMove | |
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 |