-
Notifications
You must be signed in to change notification settings - Fork 2
250 lines (218 loc) · 7.03 KB
/
test.yml
File metadata and controls
250 lines (218 loc) · 7.03 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
name: Run Tests
on: [pull_request]
jobs:
prepare-linux:
name: Prepare Environment (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.12'
install-cargo-tools: 'true'
install-python-deps: 'true'
prepare-macos:
name: Prepare Environment (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.12'
install-cargo-tools: 'true'
install-python-deps: 'true'
build-linux:
name: Build Package and Run Python Tests (Linux)
needs: prepare-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.12'
install-cargo-tools: 'true'
install-python-deps: 'true'
- name: Code style checking
run: cargo fmt --all -- --check
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install Python coverage dependencies
run: |
pip install pytest pytest-cov coverage
- name: Build package
run: |
make ZIG=1 wheel
- name: Run Python tests and collect coverage
run: |
PROBING=1 PYTHONPATH=python/ uv run --python 3.12 -w pytest -w pytest-cov -w coverage -w websockets -w pandas -w torch -w ipykernel -- \
python -m pytest --cov=python/probing --cov=tests --cov-report=xml:coverage.xml \
python/probing tests
env:
PROBING: "1"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel
path: python
- name: Upload Python coverage report
uses: actions/upload-artifact@v4
with:
name: python-coverage
path: coverage.xml
retention-days: 30
rust-test:
name: Run Rust Tests
needs: prepare-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.12'
install-cargo-tools: 'true'
install-python-deps: 'false'
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Build web frontend
run: |
# Ensure wasm32 target is available (should already be installed by setup-build-env)
rustup target add wasm32-unknown-unknown || true
# Build web frontend (dioxus-cli should already be installed by setup-build-env)
make web/dist
- name: Install llvm-tools-preview component
run: |
rustup component add llvm-tools-preview --toolchain nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run Rust tests and collect coverage
shell: bash
run: |
source <(cargo llvm-cov show-env --export-prefix)
export CARGO_TARGET_DIR=$CARGO_LLVM_COV_TARGET_DIR
export CARGO_INCREMENTAL=1
cargo llvm-cov clean --workspace
cargo nextest run --workspace --no-default-features --nff
cargo llvm-cov --no-run --lcov --output-path coverage.lcov
- name: Upload Rust coverage report
uses: actions/upload-artifact@v4
with:
name: rust-coverage
path: coverage.lcov
retention-days: 30
test:
name: Run Python Tests (Multi-version)
needs: [prepare-linux, build-linux]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.13"
- "3.12"
- "3.11"
- "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel
path: python
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov coverage
python -m pip install websockets pandas torch ipykernel
- name: Verify pytest installation
run: |
python -m pytest --version
which python
python --version
- name: Run Python Test
env:
PROBING: "1"
run: make pytest
codecov:
name: Upload Coverage to Codecov
needs: [build-linux, rust-test]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Rust coverage report
uses: actions/download-artifact@v4
with:
name: rust-coverage
path: .
- name: Download Python coverage report
uses: actions/download-artifact@v4
with:
name: python-coverage
path: .
- name: Check coverage files exist
run: |
if [ -f coverage.lcov ]; then
echo "✓ coverage.lcov exists ($(wc -l < coverage.lcov) lines)"
else
echo "✗ coverage.lcov not found"
exit 1
fi
if [ -f coverage.xml ]; then
echo "✓ coverage.xml exists ($(wc -l < coverage.xml) lines)"
else
echo "✗ coverage.xml not found"
exit 1
fi
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.lcov,coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
macos-test:
name: macOS Tests (Rust + Python)
needs: prepare-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.12'
install-cargo-tools: 'true'
install-python-deps: 'true'
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Build web frontend
run: |
rustup target add wasm32-unknown-unknown || true
make web/dist
- name: Run Rust Tests
run: cargo nextest run --workspace --no-default-features --nff
- name: Build and Install Wheel
run: |
maturin build --release
pip install target/wheels/*.whl
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov coverage
python -m pip install websockets pandas torch ipykernel
- name: Run Python Tests
env:
PROBING: "1"
run: pytest tests