-
Notifications
You must be signed in to change notification settings - Fork 119
391 lines (370 loc) · 14.9 KB
/
Copy pathci.yml
File metadata and controls
391 lines (370 loc) · 14.9 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
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# Continuous integration jobs.
# These get run on every pull-request, with Warp caches updated on push into `main` or `next`.
name: CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
- next
paths-ignore:
- "**.txt"
pull_request:
paths-ignore:
- "**.txt"
env:
# Shared prefix key for the Rust caches.
#
# Cache is trunk specific (next|main).
CACHE_PREFIX: rust-cache-${{ github.base_ref || github.ref_name }}
# Only trusted branch pushes should update caches; PRs restore from the target branch cache.
SAVE_CACHE: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') }}
# Reduce cache usage by removing debug information.
CARGO_PROFILE_DEV_DEBUG: 0
# Limits workflow concurrency to only the latest commit in the PR.
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
# ===============================================================================================
# Conventional builds, lints and tests
# ===============================================================================================
# Normal cargo build that verifies the workspace compiles.
build:
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- name: cargo build
run: cargo build --workspace --all-targets --locked
- name: Check static linkage
run: |
# Ensure database libraries are statically linked to avoid system library dependencies
#
# It explodes our possible dependency matrix when debugging, particularly
# in the case of sqlite and rocksdb as embedded databases, we want them
# shipped in identical versions we test with. Those are notoriously difficult
# to compile time configure and OSes make very opinionated choices.
metadata=$(cargo metadata --no-deps --format-version 1)
mapfile -t bin_targets < <(
echo "${metadata}" | jq -r '.packages[].targets[] | select(.kind[] == "bin") | .name' | sort -u
)
if [[ ${#bin_targets[@]} -eq 0 ]]; then
echo "error: No binary targets found in cargo manifest."
exit 1
fi
for bin_target in "${bin_targets[@]}"; do
# Ensure the binary was built by the previous step.
binary_path="target/debug/${bin_target}"
if ! [[ -x "${binary_path}" ]]; then
echo "error: Missing binary or missing executable bit: ${binary_path}";
exit 2;
fi
# ldd exits non-zero for static binaries, so we inspect its output instead.
# if ldd fails we use an empty string instead
ldd_output="$(ldd "${binary_path}" 2>&1 || true)"
if echo "${ldd_output}" | grep -E -q 'not a dynamic executable'; then
continue
fi
# librocksdb/libsqlite entries indicate dynamic linkage (bad).
if echo "${ldd_output}" | grep -E -q 'librocksdb|libsqlite'; then
echo "error: Dynamic linkage detected for ${bin_target}."
echo "${ldd_output}"
exit 3
fi
done
printf "Static linkage check passed for all of %s\n" "${bin_targets[*]}"
clippy:
name: lint - clippy
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- name: clippy
run: cargo clippy --locked --all-targets --all-features --workspace -- -D warnings
tests:
runs-on: warp-ubuntu-latest-x64-8x
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: nextest@0.9.122
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- name: Build tests
run: cargo nextest run --all-features --workspace --no-run
- name: Run tests
run: cargo nextest run --all-features --workspace
- name: Doc tests
run: cargo test --doc --workspace --all-features
# Temporary Diesel schema drift checks. Delete this job once Diesel is removed.
diesel-schema:
name: diesel schema
runs-on: warp-ubuntu-latest-x64-8x
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: diesel_cli@2.3.9
- name: Check Diesel schemas
run: |
cargo test --locked --workspace --all-features \
diesel_schema_is_in_sync_with_migrations -- --ignored
doc:
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- name: Build docs
run: cargo doc --no-deps --workspace --all-features --locked
external-docs:
name: docs - external
runs-on: ubuntu-24.04
env:
# Docusaurus checks for package updates during builds and may try to write to a user config
# directory. Disable that notifier in CI so docs output is limited to build/link failures.
NO_UPDATE_NOTIFIER: "1"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: "22.18.0"
cache: "npm"
cache-dependency-path: docs/external/package-lock.json
- name: Install dependencies
working-directory: ./docs/external
run: npm ci
- name: Build documentation and check links
working-directory: ./docs/external
run: npm run build:dev
# Ensure the stress-test still functions by running some cheap benchmarks.
stress-test:
name: stress test
runs-on: warp-ubuntu-latest-x64-8x
timeout-minutes: 20
env:
DATA_DIR: /tmp/store
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: nextest@0.9.122
- name: Build
run: cargo build --bin miden-node-stress-test --locked
- name: Create store directory
run: mkdir -p ${{ env.DATA_DIR }}
- name: Seed the store
run: |
cargo run --bin miden-node-stress-test seed-store \
--data-directory ${{ env.DATA_DIR }} \
--num-accounts 500 --public-accounts-percentage 50
# TODO re-introduce
# - name: Benchmark state sync
# run: |
# cargo run --bin miden-node-stress-test benchmark-store \
# --data-directory ${{ env.DATA_DIR }} \
# --iterations 10 --concurrency 1 sync-state
- name: Benchmark notes sync
run: |
cargo run --bin miden-node-stress-test benchmark-store \
--data-directory ${{ env.DATA_DIR }} \
--iterations 10 --concurrency 1 sync-notes
- name: Benchmakr nullifiers sync
run: |
cargo run --bin miden-node-stress-test benchmark-store \
--data-directory ${{ env.DATA_DIR }} \
--iterations 10 --concurrency 1 sync-nullifiers --prefixes 10
# ===============================================================================================
# WASM related jobs
# ===============================================================================================
# Tests the miden-remote-prover-client WASM support.
#
# The WASM build is incompatible with native build caches, so it uses a dedicated cache.
client-wasm:
name: wasm targets
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: warpbuild
save-if: ${{ env.SAVE_CACHE }}
- name: cargo build
run: |
cargo build --locked -p miden-remote-prover-client \
--target wasm32-unknown-unknown --no-default-features \
--features batch-prover,block-prover,tx-prover # no-std compatible build
- name: clippy
run: |
cargo clippy --locked -p miden-remote-prover-client \
--target wasm32-unknown-unknown --no-default-features \
--features batch-prover,block-prover,tx-prover -- -D warnings
# ===============================================================================================
# Jobs that don't require caching to be efficient
# ===============================================================================================
typos:
name: lint - spelling
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: "22.18.0"
package-manager-cache: false
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: typos@1.42.0
- name: Install CSpell
run: npm install --global cspell@10.0.1
- run: make typos-check
- run: make markdown-spellcheck
fmt:
name: lint - formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Rustup
run: rustup toolchain install --no-self-update
- name: Rustup +nightly
run: rustup toolchain install --no-self-update nightly --component rustfmt
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: ${{ github.job }}
prefix-key: ${{ env.CACHE_PREFIX }}
cache-provider: github
save-if: ${{ env.SAVE_CACHE }}
- name: Install Markdown tools
run: npm install --global prettier@3.8.3 markdownlint-cli2@0.22.1
- name: Fmt
run: make format-check
- name: Markdown lint
run: make markdown-lint
toml:
name: lint - toml fmt
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: taplo-cli@0.10.0
- run: make toml-check
workspace-lints:
name: lint - workspace toml
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-workspace-lints@0.1.4
- run: make workspace-check
workspace-inheritance:
name: lint - workspace inheritance
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install cargo-binstall
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-binstall
- name: Install workspace inheritance checker
run: cargo binstall --no-confirm cargo-workspace-inheritance-check@1.2.0
- name: Check workspace inheritance
run: cargo workspace-inheritance-check --promotion-threshold 2 --promotion-failure
unused_deps:
name: lint - unused deps
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install cargo-shear
uses: taiki-e/install-action@055f5df8c3f65ea01cd41e9dc855becd88953486 # v2.75.18
with:
tool: cargo-shear@1.12.4
- name: Check for unused dependencies
run: make shear