-
-
Notifications
You must be signed in to change notification settings - Fork 2
207 lines (164 loc) · 5.29 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
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
# Test code base and upload coverage
name: Test code
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
env:
QT_QPA_PLATFORM: offscreen
DISPLAY: :99
jobs:
pytest:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
pyversion: ['3.10', '3.11', '3.12', '3.13']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install freeglut3-dev xvfb
sudo apt-get install x11-utils
nohup Xvfb $DISPLAY -screen 0 1400x900x24 -dpi 96 +extension RANDR +render &
- name: Install Mesa (OpenGL on Windows)
if: matrix.os == 'windows-latest'
uses: ssciwr/setup-mesa-dist-win@v2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: uv run --python ${{ matrix.pyversion }} --frozen --no-dev --extra tests pytest
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }}
fail_ci_if_error: true
cargo-test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
pyversion: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install NumPy
run: pip install numpy
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run Cargo test
run: cargo test
cargo-tarpaulin:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install NumPy
run: pip install numpy
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Generate code coverage
run: cargo tarpaulin --verbose --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }}
fail_ci_if_error: true
python-benchmark:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: setup-python
with:
cache: pip
cache-dependency-path: uv.lock
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Install dependencies for profiling
run: |
rm -rf differt-core/python/differt_core/*.so
uv pip install -r pyproject.toml --extra tests \
--python='${{ steps.setup-python.outputs.python-path }}' \
--config-settings=build-args='--profile profiling' --reinstall-package differt_core
env:
RUSTFLAGS: -Cprofile-generate=${{ github.workspace }}/profdata
- name: Detect Rust host
run: echo RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) >> "$GITHUB_ENV"
shell: bash
- name: Generate profile data
run: pytest --dist=no -n0 --benchmark-enable differt/tests/benchmarks
- name: Merge PGO data
run: rustup run stable bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata'
- name: Re-install dependencies
run: |
rm -rf differt-core/python/differt_core/*.so
uv pip install -r pyproject.toml --extra tests \
--python='${{ steps.setup-python.outputs.python-path }}' \
--config-settings=build-args='--profile profiling' --reinstall-package differt_core
env:
RUSTFLAGS: -Cprofile-use=${{ github.workspace }}/merged.profdata
- name: Run CodSpeed benchmarks
uses: CodSpeedHQ/action@v3
with:
run: pytest differt/tests/benchmarks --codspeed
rust-benchmark:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install NumPy
run: pip install numpy
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Run Benchmarks
run: cargo bench
linkcheck-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Just
uses: taiki-e/install-action@just
- name: Install dependencies
run: just install --locked --no-dev --extra docs
- name: Check links in documentation
run: just docs/linkcheck