-
Notifications
You must be signed in to change notification settings - Fork 8
373 lines (356 loc) · 13.8 KB
/
rust.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
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
name: Rust
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG: "true"
jobs:
test-gen:
uses: ./.github/workflows/test-codegen.yml
test:
name: Test matrix
runs-on: ${{ matrix.os }}
needs: test-gen
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- nightly
target_triple:
- aarch64-unknown-linux-gnu
- i686-pc-windows-gnu
- i686-pc-windows-msvc
- i686-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-gnu
include:
- os: [self-hosted, linux, ARM64]
target_triple:
aarch64-unknown-linux-gnu
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings"
- os: windows-latest
target_triple:
i686-pc-windows-gnu
# This target needs special setup with MinGW.
needs-mingw: x86
# lld on Windows uses extreme amounts of memory for debuginfo=2
rustflags: "-C link-arg=-fuse-ld=lld -C debuginfo=1 --deny warnings"
- os: windows-latest
target_triple: i686-pc-windows-msvc
# lld on Windows uses extreme amounts of memory for debuginfo=2
rustflags: "-C link-arg=-fuse-ld=lld -C debuginfo=1 --deny warnings"
- os: ubuntu-latest
target_triple:
i686-unknown-linux-gnu
# This target needs special setup.
prologue-script: sudo apt update && sudo apt install gcc-multilib
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings"
- os: macos-latest
target_triple: x86_64-apple-darwin
rustflags: "--deny warnings"
- os: windows-latest
target_triple: x86_64-pc-windows-gnu
# lld on Windows uses extreme amounts of memory for debuginfo=2
rustflags: "-C link-arg=-fuse-ld=lld -C debuginfo=1 --deny warnings"
- os: windows-latest
target_triple: x86_64-pc-windows-msvc
# lld on Windows uses extreme amounts of memory for debuginfo=2
rustflags: "-C link-arg=-fuse-ld=lld -C debuginfo=1 --deny warnings"
- os: ubuntu-latest
target_triple: x86_64-unknown-linux-gnu
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings"
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: block
allowed-endpoints: >
github.com:443
api.github.com:443
azure.archive.ubuntu.com:80
esm.ubuntu.com:443
motd.ubuntu.com:443
crates.io:443
index.crates.io:443
static.crates.io:443
static.rust-lang.org:443
packages.microsoft.com:443
ppa.launchpadcontent.net:443
- name: Cache restore (MinGW)
id: cache-restore-mingw
if: matrix.needs-mingw != ''
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: |
C:\ProgramData\chocolatey\lib\mingw
key: ${{ matrix.os }}-mingw-${{ matrix.needs-mingw }}-11-2
- name: Set up MinGW ${{ matrix.needs-mingw }}
if: matrix.needs-mingw != '' && steps.cache-restore-mingw.outputs.cache-hit != 'true'
uses: egor-tensin/setup-mingw@84c781b557efd538dec66bde06988d81cd3138cf # v2.2.0
with:
platform: ${{ matrix.needs-mingw }}
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14
- name: Add MinGW to PATH
if: matrix.needs-mingw != '' && steps.cache-restore-mingw.outputs.cache-hit == 'true'
run: echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin" >> $env:GITHUB_PATH
- name: Run prologue script
if: matrix.prologue-script != ''
run: ${{ matrix.prologue-script }}
- name: Install lld (Unix)
if: matrix.os == 'ubuntu-latest'
run: sudo apt install lld
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: Install Rust toolchain (${{ matrix.toolchain }})
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target_triple }}
- name: Override toolchain
run: rustup override set ${{ matrix.toolchain }}
- name: Cache restore (Cargo)
id: cache-restore-cargo
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.toolchain }}-${{ matrix.target_triple }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: cargo install cargo-hack
uses: baptiste0928/cargo-install@94e1849646e5797d0c8b34d8e525124ae9ae1d86 # v3.0.1
with:
# Name of the crate to install
crate: cargo-hack
env:
CARGO_TARGET_DIR: target/
- name: Build all feature sets
run: cargo hack build --workspace --feature-powerset --skip default --target ${{ matrix.target_triple }} --features arbitrary --ignore-unknown-features
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Download rsonpath-test artifact
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: ${{ needs.test-gen.outputs.artifact-name }}
path: ${{ needs.test-gen.outputs.artifact-path }}
- name: Test all feature sets
run: cargo hack test --workspace --feature-powerset --skip default --target ${{ matrix.target_triple }} --features arbitrary --ignore-unknown-features
env:
RUSTFLAGS: ${{ matrix.rustflags }}
test-x86-simd:
name: Test all x86 SIMD configurations
runs-on: ubuntu-latest
needs: test-gen
strategy:
fail-fast: false
matrix:
target_triple:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
simd_override:
- avx2;fast_quotes;fast_popcnt
- ssse3;fast_quotes;fast_popcnt
- ssse3;fast_quotes;slow_popcnt
- ssse3;slow_quotes;fast_popcnt
- ssse3;slow_quotes;slow_popcnt
- sse2;fast_quotes;fast_popcnt
- sse2;fast_quotes;slow_popcnt
- sse2;slow_quotes;fast_popcnt
- sse2;slow_quotes;slow_popcnt
- nosimd;slow_quotes;slow_popcnt
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Install lld
run: sudo apt update && sudo apt install lld gcc-multilib
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: Install Rust toolchain (stable)
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # master
with:
toolchain: stable
target: ${{ matrix.target_triple }}
- name: Cache restore (Cargo)
id: cache-restore-cargo
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: stable-${{ matrix.target_triple }}-cargo-${{ hashFiles('**/Cargo.toml') }}-x86-simd
- name: Build
run: cargo build --workspace --target ${{ matrix.target_triple }}
env:
RUSTFLAGS: "-C link-arg=-fuse-ld=lld --deny warnings"
- name: Download rsonpath-test artifact
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: ${{ needs.test-gen.outputs.artifact-name }}
path: ${{ needs.test-gen.outputs.artifact-path }}
- name: Test
run: cargo test --workspace --target ${{ matrix.target_triple }}
env:
RSONPATH_UNSAFE_FORCE_SIMD: ${{ matrix.simd_override }}
RUSTFLAGS: "-C link-arg=-fuse-ld=lld --deny warnings"
clippy:
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- nightly
permissions:
checks: write
name: Clippy (${{ matrix.toolchain }})
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: Install lld
run: sudo apt update && sudo apt install lld
- name: Install Rust toolchain (${{ matrix.toolchain }})
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- name: Override toolchain
run: rustup override set ${{ matrix.toolchain }}
- name: Cache restore
id: cache-restore
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.toml') }}-clippy
- name: Build all features
run: cargo build --workspace --all-features --release
env:
RUSTFLAGS: "-C link-arg=-fuse-ld=lld --deny warnings"
- name: Clippy all features
uses: auguwu/clippy-action@a1f4eaac010d8f420818674bdd5eb9937e7efe26 # v1.3.0
with:
deny: warnings
all-features: true
token: ${{ secrets.GITHUB_TOKEN }}
env:
RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: Install Rust toolchain (nightly)
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # master
with:
toolchain: nightly
- name: Override toolchain
run: rustup override set nightly
- name: Install lld
run: sudo apt install lld
- name: Cache restore
id: cache-restore
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-nightly-avx2-cargo-${{ hashFiles('**/Cargo.toml') }}-doc
- name: cargo doc (rsonpath-lib)
run: cargo doc --package rsonpath-lib --all-features --no-deps --release
env:
RUSTDOCFLAGS: "-Dwarnings --cfg docsrs"
- name: cargo doc (rsonpath-syntax)
run: cargo doc --package rsonpath-syntax --all-features --no-deps --release
env:
RUSTDOCFLAGS: "-Dwarnings --cfg docsrs"
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: Install Rust toolchain (stable)
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # master
with:
toolchain: stable
components: rustfmt
- name: Override toolchain
run: rustup override set stable
- name: Format
run: cargo fmt --package rsonpath rsonpath-lib rsonpath-syntax -- --check
cargo-deny:
name: Dependency scan (cargo-deny)
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: EmbarkStudios/cargo-deny-action@64015a69ee7ee08f6c56455089cdaf6ad974fd15 # v1.6.1
cargo-msrv:
name: Verify MSRV (cargo-msrv)
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: true
- name: cargo install cargo-msrv
uses: baptiste0928/cargo-install@94e1849646e5797d0c8b34d8e525124ae9ae1d86 # v3.0.1
with:
# Name of the crate to install
crate: cargo-msrv
- name: Run cargo-msrv verify on rsonpath
run: cargo msrv --path ./crates/rsonpath verify
- name: Run cargo-msrv verify on rsonpath-lib
run: cargo msrv --path ./crates/rsonpath-lib verify
- name: Run cargo-msrv verify on rsonpath-syntax
run: cargo msrv --path ./crates/rsonpath-syntax verify