Skip to content

CI

CI #123

Workflow file for this run

name: "CI"
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
# At 07:00 UTC on Monday and Thursday.
- cron: "0 7 * * *"
workflow_dispatch:
defaults:
run:
shell: bash -leo pipefail {0}
jobs:
tests:
runs-on: ${{ matrix.os}}
name: "πŸ’»-${{matrix.os }} 🐍-${{ matrix.python-version }}"
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "macos-13"]
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- name: "Setup Micromamba"
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
environment-name: openfe_analysis_env
cache-environment: true
cache-downloads: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
create-args: >-
python=${{ matrix.python-version }}
init-shell: bash
- name: "Install"
run: |
python -m pip install --no-deps .
- name: "Restore pooch test data cache"
id: cache-testdata-restore
uses: actions/cache/restore@v3
with:
path: |
~/.cache/openfe_analysis/
key: ${{ runner.os }}
- name: "Test imports"
run: |
python -Ic "import openfe_analysis; print(openfe_analysis.__version__)"
- name: "Run tests"
run: |
pytest -n auto -v --cov=openfe_analysis --cov-report=xml --durations=10
- name: "Save pooch test data cache"
id: cache-testdata-save
uses: actions/cache/save@v3
with:
path: |
~/.cache/openfe_analysis/
key: ${{ runner.os }}
- name: codecov
if: ${{ github.repository == 'OpenFreeEnergy/openfe_analysis'
&& github.event_name == 'pull_request' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
fail_ci_if_error: false
verbose: true