-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (87 loc) · 2.55 KB
/
test.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel concurent in-progress jobs or run on pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ruff-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
with:
args: "check --output-format concise"
ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
with:
args: "format --diff"
mypy:
name: Mypy ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Sync environment
run: uv sync --no-default-groups --group mypy
- name: Run mypy
run: uv run --no-sync -- mypy
tests:
name: Tests ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Sync environment
run: uv sync --no-default-groups --group test --group cov
- name: Run tests
run: uv run --no-sync -- coverage run --parallel-mode --module pytest -vv
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
if-no-files-found: ignore
coverage:
name: Coverage Report
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Download coverage data
uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine and report coverage
run: |
uv tool install coverage
coverage combine
# Report to summary
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
# Report to console
coverage report