-
Notifications
You must be signed in to change notification settings - Fork 17
159 lines (133 loc) · 4.99 KB
/
checks.yml
File metadata and controls
159 lines (133 loc) · 4.99 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Checks
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '41 16 * * *' # Every day at 16:41 UTC (to avoid high load at exact hour values).
env:
UV_NO_SYNC: 1
jobs:
tests:
# Default config: py3.14, ubuntu-latest, float32, full options.
# The idea is to make each of those params vary one by one, to limit the number of tests to run.
name: Tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}${{ matrix.extra_groups && format(', {0}', matrix.extra_groups) || '' }})
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
# Python version variations
- python-version: '3.10'
- python-version: '3.11'
- python-version: '3.12'
- python-version: '3.13'
- python-version: '3.14' # To actually run the default config
# OS variations
- os: macOS-latest
- os: windows-latest
# dtype variations
- dtype: float64
# Installation options variations
- options: 'none'
# Lower-bounds of all dependencies and Python version.
- python-version: '3.10.0'
extra_groups: 'lower_bounds'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version || '3.14' }}
- uses: ./.github/actions/install-deps
with:
options: ${{ matrix.options || 'full' }}
groups: test ${{ matrix.extra_groups }}
- name: Run tests
run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml
env:
PYTEST_TORCH_DTYPE: ${{ matrix.dtype || 'float32' }}
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
build-doc:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.14'
- uses: ./.github/actions/install-deps
with:
groups: doc
- name: Build Documentation
working-directory: docs
run: uv run make dirhtml
check-links:
name: Link correctness
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# This will restore the cache for the current commit if it exists, or the most recent lychee
# cache otherwise (including those saved for the main branch). It will also save the cache for
# the current commit if none existed for it, and only if the link check succeeded. We don't
# want to save a cache when the action failed, because the reason for failure might be
# temporary (rate limiting, network issue, etc.), and we always want to retry those links
# everytime this action is run.
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run lychee
uses: lycheeverse/lychee-action@v2
with:
args: --verbose --no-progress --cache --max-cache-age 1d "." --exclude-path "docs/source/_templates/page.html"
fail: true
env:
# This reduces false positives due to rate limits
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
typing:
name: Typing correctness
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.14'
- uses: ./.github/actions/install-deps
with:
groups: check test plot
- name: Run ty
run: uv run ty check --output-format=github
check-todos:
name: Absence of TODOs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Scan for TODO strings
run: |
echo "Scanning codebase for TODOs..."
git grep -nE "TODO" -- . ':(exclude).github/workflows/*' > todos_found.txt || true
if [ -s todos_found.txt ]; then
echo "❌ ERROR: Found TODOs in the following files:"
echo "-------------------------------------------"
while IFS=: read -r file line content; do
echo "::error file=$file,line=$line::TODO found at $file:$line - must be resolved before merge:%0A$content"
done < todos_found.txt
echo "-------------------------------------------"
echo "Please resolve these TODOs or track them in an issue before merging."
exit 1
else
echo "✅ No TODOs found. Codebase is clean!"
exit 0
fi