Merge pull request #300 from primap-community/pre-commit-ci-update-co… #996
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: # allows you to trigger the workflow run manually | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
python-version: [ "3.10", "3.11", "3.12" ] | |
resolution: [ "highest", "lowest-direct" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up uv and caching | |
uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
cache-suffix: "${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.resolution }}" | |
cache-dependency-glob: "setup.cfg" | |
version: "0.4.9" | |
- name: Create venv | |
run: | | |
uv venv --seed --python ${{ matrix.python-version }} | |
- name: Install ${{ matrix.resolution }} dependencies | |
run: | | |
uv pip install --resolution ${{ matrix.resolution }} .[test] | |
- name: Test with pytest (linux) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
source .venv/bin/activate | |
pytest --xdoc --cov=primap2 --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
- name: Test with pytest (windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
.venv\Scripts\activate | |
pytest --xdoc --cov=primap2 --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |