-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (129 loc) · 3.94 KB
/
tests.yml
File metadata and controls
141 lines (129 loc) · 3.94 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Tests
on:
pull_request:
branches: [ "*" ]
permissions:
contents: write
pull-requests: write
actions: write
checks: write
statuses: write
issues: write
discussions: write
jobs:
Run-tests-on-Ubuntu:
name: Run tests on Ubuntu-latest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.2"
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install dependencies
run: |
uv venv .venv
uv sync --locked --dev
- name: Test Linting
run: |
uv run black src tests --check --diff
uv run isort src tests --check-only --diff
- name: Test Typing
run: |
uv run mypy src tests
- name: Test Notebooks
run: |
uv run pytest --nbmake notebooks -n=auto --nbmake-kernel=python3 --nbmake-timeout=600 # 10 minutes timeout
- name: Test Unittests with pytest
run: |
uv run pytest tests \
${{ github.event.pull_request.head.repo.full_name != github.repository && '--cov-fail-under=98' || '' }} \
-n=auto --cov=src --cov-branch --cov-report="xml:tests/.tmp/coverage.xml" --cov-report=term-missing \
--durations=30 --session-timeout=600
- name: Debug coverage before upload
if: matrix.python-version == '3.11'
run: |
echo "=== Coverage summary ==="
head -5 tests/.tmp/coverage.xml
- name: Upload coverage artifact
if: |
matrix.python-version == '3.11' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: actions/upload-artifact@v4
with:
name: coverage
path: tests/.tmp/coverage.xml
if-no-files-found: error
retention-days: 1
- name: Test Build
if: ${{ matrix.python-version == '3.10' }}
run: |
uv run python -m build --sdist --wheel --no-isolation --outdir dist/ .
uv run twine check dist/*
Run-tests-on-Windows:
name: Run tests on Windows-latest
needs: [ Run-tests-on-Ubuntu ]
runs-on: windows-latest
if: success()
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.2"
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install dependencies
run: |
uv venv .venv
uv sync --locked --dev
- name: Test Unittests with pytest
run: |
uv run pytest tests -n=auto --session-timeout=600
Coverage:
name: Post Coverage Report
needs: [ Run-tests-on-Ubuntu ]
runs-on: ubuntu-latest
if: success() && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
pull-requests: write
actions: write
checks: write
statuses: write
issues: write
discussions: write
steps:
- uses: actions/checkout@v4
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
path: tests/.tmp
name: coverage
- run: ls -R tests/.tmp
- name: Debug coverage file
run: cat tests/.tmp/coverage.xml | head -50
- name: Post coverage
uses: orgoro/coverage@v3.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
coverageFile: tests/.tmp/coverage.xml
thresholdAll: 0.98
thresholdNew: 0.98
thresholdModified: 0.98