-
Notifications
You must be signed in to change notification settings - Fork 16
295 lines (249 loc) · 10.7 KB
/
Copy pathci.yml
File metadata and controls
295 lines (249 loc) · 10.7 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
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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
schedule:
- cron: "0 6 * * 1"
# The workflow only reads repository contents. Individual jobs do not receive
# credentials beyond this unless they declare them explicitly.
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
VERUSFMT_VERSION: 0.7.2
MDBOOK_VERSION: 0.5.4
jobs:
rust:
name: Rust checks
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Read the pinned Rust version
id: toolchain
run: echo "rust=$(python3 -c 'import json; print(json.load(open("verus.json"))["rust"])')" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # master
with:
toolchain: ${{ steps.toolchain.outputs.rust }}
components: clippy, rustfmt
- name: Restore Cargo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ runner.os }}-${{ runner.arch }}-rust-${{ steps.toolchain.outputs.rust }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-rust-${{ steps.toolchain.outputs.rust }}-
- name: Check formatting
run: cargo fmt -p vest -p vest_asn1 -- --check
- name: Run Clippy
run: cargo clippy -p vest -p vest_asn1 --all-targets --locked
- name: Run workspace tests
run: cargo test --workspace --locked
- name: Run error-path tests with the full format trace
run: cargo test -p vest_tests --features error-trace --locked
- name: Check vest_lib without allocation support
run: cargo check -p vest_lib --no-default-features --all-targets --locked
- name: Check vest_lib with alloc but without std
run: cargo check -p vest_lib --no-default-features --features alloc --all-targets --locked
- name: Check vest_lib documentation links
env:
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D rustdoc::invalid_codeblock_attributes
run: cargo doc -p vest_lib --no-deps --locked
- name: Compile benchmarks with the workspace profile
run: |
cargo bench --no-run -p vest_tests -p vest_dev --locked 2>&1 | tee "$RUNNER_TEMP/bench-build.log"
if grep -qi "profile.*non root package.*ignored" "$RUNNER_TEMP/bench-build.log"; then
echo "A benchmark profile outside the workspace root was ignored." >&2
exit 1
fi
regeneration:
name: Generated files and guide
runs-on: ubuntu-24.04
timeout-minutes: 35
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Read the pinned Rust version
id: toolchain
run: echo "rust=$(python3 -c 'import json; print(json.load(open("verus.json"))["rust"])')" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # master
with:
toolchain: ${{ steps.toolchain.outputs.rust }}
components: rustfmt
- name: Restore Cargo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ runner.os }}-${{ runner.arch }}-regen-${{ steps.toolchain.outputs.rust }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-regen-${{ steps.toolchain.outputs.rust }}-
- name: Restore documentation tools
# Cache only version-pinned binaries; do not mix them into the Cargo cache.
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/bin/verusfmt
~/.cargo/bin/mdbook
key: ${{ runner.os }}-${{ runner.arch }}-tools-verusfmt-${{ env.VERUSFMT_VERSION }}-mdbook-${{ env.MDBOOK_VERSION }}
- name: Install exact generator tool versions
run: |
if [[ "$(verusfmt --version 2>/dev/null || true)" != "verusfmt ${VERUSFMT_VERSION}" ]]; then
cargo install verusfmt --version "${VERUSFMT_VERSION}" --locked
fi
if [[ "$(mdbook --version 2>/dev/null || true)" != "mdbook v${MDBOOK_VERSION}" ]]; then
cargo install mdbook --version "${MDBOOK_VERSION}" --locked
fi
- name: Regenerate Vest fixtures
working-directory: vest_tests
run: make vest
- name: Check rejected Vest fixtures
working-directory: vest_tests
run: make bad
- name: Test Vest snippets in the guide
run: cargo test -p vest_guide_tests --locked
- name: Regenerate ASN.1 fixtures
working-directory: vest_asn1_tests
run: make generate
- name: Build and test the guide
run: scripts/build-guide.sh && mdbook test
- name: Check that generated files are current
run: |
git diff --exit-code
untracked="$(git ls-files --others --exclude-standard)"
if [[ -n "$untracked" ]]; then
echo "Generation produced untracked files:" >&2
printf '%s\n' "$untracked" >&2
exit 1
fi
verus-linux:
name: Prepare pinned Verus
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Restore pinned Verus
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .verus
key: verus-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('verus.json', 'scripts/install-verus.sh') }}
- name: Install and validate pinned Verus
run: scripts/install-verus.sh
verify:
name: Verify ${{ matrix.name }}
needs: verus-linux
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- name: vest_lib-core
cargo_args: -p vest_lib --no-default-features
verus_args: --expand-errors
- name: vest_lib-alloc
cargo_args: -p vest_lib --no-default-features --features alloc
verus_args: --expand-errors
- name: vest_lib-std
cargo_args: -p vest_lib
verus_args: --expand-errors
- name: vest-tests
cargo_args: -p vest_tests
verus_args: --expand-errors
# This matches vest_asn1_tests/Makefile. The width stress fixture needs
# more SMT budget than the Verus default.
- name: vest-asn1-tests
cargo_args: -p vest_asn1_tests
verus_args: --expand-errors --rlimit 100
- name: vest-dev
cargo_args: -p vest_dev
verus_args: --expand-errors
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Restore pinned Verus
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .verus
key: verus-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('verus.json', 'scripts/install-verus.sh') }}
- name: Install pinned Verus and Rust toolchain
run: scripts/install-verus.sh
- name: Add Verus to PATH
run: echo "${{ github.workspace }}/.verus" >> "$GITHUB_PATH"
- name: Restore Cargo downloads
# Deliberately do not cache target/: cached Verus artifacts can cause
# verification conditions to be skipped as already fresh.
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-${{ runner.arch }}-verus-cargo-${{ hashFiles('Cargo.lock', 'verus.json') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-verus-cargo-
- name: Verify ${{ matrix.name }}
env:
CARGO_ARGS: ${{ matrix.cargo_args }}
VERUS_ARGS: ${{ matrix.verus_args }}
run: |
# A new target directory guarantees that this job checks the current
# verification conditions rather than restored Cargo freshness data.
cargo verus verify ${CARGO_ARGS} --locked --check-toolchain \
--target-dir "$RUNNER_TEMP/verus-target" -- ${VERUS_ARGS}
verify-macos:
name: Verify supported packages on macOS
if: github.event_name == 'schedule'
runs-on: macos-15
timeout-minutes: 150
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Restore pinned Verus
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .verus
key: verus-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('verus.json', 'scripts/install-verus.sh') }}
- name: Install pinned Verus and Rust toolchain
run: scripts/install-verus.sh
- name: Add Verus to PATH
run: echo "${{ github.workspace }}/.verus" >> "$GITHUB_PATH"
- name: Restore Cargo downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-${{ runner.arch }}-verus-cargo-${{ hashFiles('Cargo.lock', 'verus.json') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-verus-cargo-
- name: Verify vest_lib
run: cargo verus verify -p vest_lib --locked --check-toolchain --target-dir "$RUNNER_TEMP/verus-target" -- --expand-errors
- name: Verify Vest fixtures
run: cargo verus verify -p vest_tests --locked --check-toolchain --target-dir "$RUNNER_TEMP/verus-target" -- --expand-errors
- name: Verify ASN.1 fixtures
run: cargo verus verify -p vest_asn1_tests --locked --check-toolchain --target-dir "$RUNNER_TEMP/verus-target" -- --expand-errors --rlimit 100
- name: Verify development formats
run: cargo verus verify -p vest_dev --locked --check-toolchain --target-dir "$RUNNER_TEMP/verus-target" -- --expand-errors