Skip to content

CI

CI #1175

Workflow file for this run

name: "CI"
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
# At 07:00 UTC
- cron: "0 7 * * *"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
defaults:
run:
shell: bash -leo pipefail {0}
jobs:
tests:
runs-on: ${{ matrix.OS }}-latest
name: "tests"
strategy:
fail-fast: false
matrix:
os: ['ubuntu',]
python-version:
- "3.11"
- "3.12"
- "3.13"
include:
- os: 'macos'
python-version: "3.13"
steps:
- uses: actions/checkout@v6
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v3
with:
environment-file: environment.yml
environment-name: kartograf
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 }}
openfe
- name: "Install"
run: pip install --no-deps -e .
- name: "Test imports"
run: |
# if we add more to this, consider changing to for + env vars
python -Ic "import kartograf"
- name: "Environment Information"
run: |
micromamba info
micromamba list
- name: "Print Version"
run: python -c "import kartograf; print(kartograf.__version__)"
- name: "Run tests"
run: |
# add openfe-benchmarks
pip install --no-deps git+https://github.com/OpenFreeEnergy/openfe-benchmarks.git
# run tests
pytest -n auto -v --cov=kartograf --cov-report=xml
- name: "Test Notebooks"
if: ${{ matrix.os != 'macos' }}
run: |
# Only need to test the notebook(s) in examples/
pytest -v --nbval-lax examples/
- name: codecov
if: ${{ github.repository == 'OpenFreeEnergy/kartograf' && github.event_name != 'schedule'}}
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
check_packaging:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: mamba-org/setup-micromamba@v3
with:
environment-file: environment.yml
environment-name: kartograf
create-args: >-
python=3.13
- name: install_deps
run: |
python -m pip install -U pip pipx wheel build
- name: build_package_sdist
run: pipx run build --sdist
- name: check_package_build
run: |
DISTRIBUTION=$(ls -t1 dist/kartograf-*.tar.gz | head -n1)
test -n "${DISTRIBUTION}" || { echo "no distribution dist/kartograf-*.tar.gz found"; exit 1; }
- name: install sdist
working-directory: ./dist
run: |
ls -a .
python -m pip install kartograf-*.tar.gz
du -sh kartograf-*.tar.gz
- name: check install
run: pip list
- name: run tests
working-directory: ./dist
run: python -m pytest -n logical --pyargs kartograf