Skip to content

move to hatch, src and pyproject.toml #361

move to hatch, src and pyproject.toml

move to hatch, src and pyproject.toml #361

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint 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: tests
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
- develop
- "release/*"
- "hotfix/*"
pull_request:
branches-ignore:
- "docs/*"
- "doc/*"
jobs:
codecov:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
sudo apt install graphviz -y
uv pip install -e .[dev] --system
uv pip install coverage --system
- name: Download test data
run: python data/download_test_files.py > /dev/null
- name: Run pytest-cov
run: PYTHONPATH=src coverage run -m pytest --basetemp={envtmpdir}
- name: Create XML report
run: coverage xml
- uses: codecov/[email protected]
with:
file: ./coverage.xml
pytest:
runs-on: ${{ matrix.os }}
name: tests ${{ matrix.os }}, ${{ matrix.python-version }}, eager=${{ matrix.eager }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: ["3.9", "3.12"]
eager: [0, 1]
# include: # todo: activate when we can install graphviz on these platforms
# - os: macos-latest
# python-version: "3.9"
# - os: windows-latest
# python-version: "3.9"
# - os: macos-14 # Apple silicon runner
# python-version: '3.12'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
sudo apt install graphviz -y
uv pip install -e .[dev] --system
uv pip install pytest-xdist --system
- name: Download test data
run: python data/download_test_files.py > /dev/null
- name: Test with pytest, eager=${{ matrix.eager }}
run: |
PHASESPACE_EAGER=${{ matrix.eager }} pytest -n auto --basetemp={envtmpdir} tests
cd docs
PHASESPACE_EAGER=${{ matrix.eager }} pytest --dist loadscope --nbval-lax --ignore=.ipynb_checkpoints -n${{ steps.cpu-cores.outputs.count }}
cd ..