Add Python API #14
Workflow file for this run
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: Run code coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
run-coverage: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
# TODO handle forks | |
# run pipeline on either a push event or a PR event on a fork | |
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
include: | |
- { os: ubuntu-latest, python-ver: "3.12" } | |
- { os: ubuntu-latest, python-ver: "3.8" } | |
- { os: windows-latest, python-ver: "3.12" } | |
- { os: macos-latest, python-ver: "3.12" } | |
env: # used by codecov-action | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-ver }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-ver }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-dev.txt -r requirements.txt | |
- name: Install package | |
run: | | |
python -m pip install -e . # must install in editable mode for coverage to find sources | |
python -m pip list | |
- name: Run tests and generate coverage report | |
run: | | |
pytest --cov | |
python -m coverage xml # codecov uploader requires xml format | |
python -m coverage report -m | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true |