-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (62 loc) · 2.33 KB
/
tests.yml
File metadata and controls
74 lines (62 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# CI tests workflow — runs the full pytest suite across the supported Python version matrix
# and uploads coverage to Codecov.
#
# References:
# Codecov GitHub Action: https://docs.codecov.com/docs/github-actions
# Security hardening: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions
# Concurrency best practices: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-concurrency
# Workflow permissions: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
name: CI Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
# Least-privilege: read-only access to repository contents is sufficient for tests.
permissions:
contents: read
# Cancel redundant runs on the same branch/PR to save CI minutes.
concurrency:
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
enable-cache: true
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Sync dependencies
run: uv sync --frozen --extra dev --extra test
- name: Run tests
run: |
if [ "${{ matrix.python-version }}" = "3.11" ]; then
uv run pytest -q --no-testmon --cov=scripts --cov-report=xml --cov-report=term-missing -p no:cacheprovider
else
uv run pytest -q --no-testmon -p no:cacheprovider
fi
- name: Upload coverage XML
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v7
with:
name: coverage-xml
path: coverage.xml
if-no-files-found: error
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: false
verbose: true