-
Notifications
You must be signed in to change notification settings - Fork 104
282 lines (264 loc) · 9.54 KB
/
ci.yml
File metadata and controls
282 lines (264 loc) · 9.54 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
# Continuous integration jobs.
#
# These get run on every pull-request, with github cache updated on push into `next`.
name: CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
- next
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
pull_request:
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
env:
# Shared prefix key for the rust cache.
#
# This provides a convenient way to evict old or corrupted cache.
RUST_CACHE_KEY: rust-cache-2026.02.02
# 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 that re-use a single cache for efficiency
# ===============================================================================================
# Normal cargo build that populates a cache for all subsequent jobs to re-use.
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- uses: ./.github/actions/install-rocksdb
- uses: ./.github/actions/install-protobuf-compiler
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.ref == 'refs/heads/next' }}
- 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
echo "Static linkage check passed for all of ${bin_targets[@]}"
clippy:
name: lint - clippy
runs-on: ubuntu-24.04
needs: [build]
steps:
- uses: actions/checkout@v6
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: false
- name: clippy
run: cargo clippy --locked --all-targets --all-features --workspace -- -D warnings
tests:
runs-on: ubuntu-24.04
needs: [build]
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Rustup
run: rustup update --no-self-update
- uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.122
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: false
- 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
doc:
needs: [build]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: false
- name: Build docs
run: cargo doc --no-deps --workspace --all-features --locked
# Ensure the stress-test still functions by running some cheap benchmarks.
stress-test:
name: stress test
needs: [build]
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
DATA_DIR: /tmp/store
steps:
- uses: actions/checkout@v6
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-build
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: false
- uses: taiki-e/install-action@v2
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 the build job's cache, thankfully this compilation is fairly
# quick so we don't need a separate cache here.
client-wasm:
name: wasm targets
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Rustup
run: rustup update --no-self-update
- 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@v6
- uses: taiki-e/install-action@v2
with:
tool: typos@1.42.0
- run: make typos-check
fmt:
name: lint - rustfmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Rustup +nightly
run: |
rustup update --no-self-update nightly
rustup +nightly component add rustfmt
- name: Fmt
run: make format-check
toml:
name: lint - toml fmt
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@v2
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@v6
- uses: taiki-e/install-action@v2
with:
tool: cargo-workspace-lints@0.1.4
- run: make workspace-check
unused_deps:
name: lint - unused deps
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: machete
uses: bnjbvr/cargo-machete@main