-
Notifications
You must be signed in to change notification settings - Fork 5
224 lines (203 loc) · 6.34 KB
/
CI.yml
File metadata and controls
224 lines (203 loc) · 6.34 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
strategy:
matrix:
settings:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: aarch64-apple-darwin
os: macos-latest
fail-fast: false
runs-on: ${{ matrix.settings.os }}
steps:
- uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
- name: print cpu features
run: |
rustup toolchain install nightly
cargo +nightly run -p cpu-features --features nightly
- uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Download fixtures
run: node download-fixtures.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --check
cargo test
miri:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: miri,rust-src
toolchain: nightly
- uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Download fixtures
run: node download-fixtures.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run miri
run: cargo miri test
env:
MIRIFLAGS: "-Zmiri-disable-isolation"
asan:
name: ASAN - Linux-x86_64 - ${{ matrix.asan.flag }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
asan:
- flag: sanitizer=address
options: detect_leaks=1 detect_stack_use_after_return=1
- flag: sanitizer=memory
options: ""
- flag: sanitizer=safestack
options: ""
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rust-src
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Download fixtures
run: node download-fixtures.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test with ASAN
run: cargo test --tests --target x86_64-unknown-linux-gnu --features asan
env:
RUST_TARGET: x86_64-unknown-linux-gnu
RUST_BACKTRACE: 1
RUSTFLAGS: "-Z${{ matrix.asan.flag }}"
ASAN_OPTIONS: ${{ matrix.asan.options }}
CARGO_UNSTABLE_BUILD_STD: std,panic_abort
asan-win32:
name: ASAN - Windows-x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rust-src
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Download fixtures
run: node download-fixtures.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test with ASAN (Windows)
shell: pwsh
run: |
# Set ASAN environment variables for Windows
$env:ASAN_OPTIONS = "windows_hook_rtl_allocators=true:detect_leaks=0:print_stats=1:check_initialization_order=true:strict_string_checks=true"
# Find and set the path to the ASAN runtime DLL
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
$asanDllPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "clang_rt.asan_dynamic-x86_64.dll" | Select-Object -First 1
if ($asanDllPath) {
$env:PATH = "$($asanDllPath.DirectoryName);$env:PATH"
Write-Host "Found ASAN DLL at: $($asanDllPath.FullName)"
}
cargo test --tests --target x86_64-pc-windows-msvc
env:
RUSTFLAGS: -Zsanitizer=address
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_OPT_LEVEL: 1
CARGO_UNSTABLE_BUILD_STD: std,panic_abort
- name: Upload ASAN logs (Windows)
if: failure()
uses: actions/upload-artifact@v7
with:
name: windows-asan-logs
path: |
asan.log*
*.asan.log
bench:
strategy:
matrix:
settings:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-11-arm
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: aarch64-apple-darwin
os: macos-latest
fail-fast: false
runs-on: ${{ matrix.settings.os }}
steps:
- uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
- uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Download fixtures
run: node download-fixtures.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run benchmarks
run: cargo bench
env:
RUSTFLAGS: "-C target-cpu=native"
done:
runs-on: ubuntu-latest
needs: [test, miri, asan, asan-win32, bench]
steps:
- run: exit 1
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}