-
Notifications
You must be signed in to change notification settings - Fork 32
330 lines (267 loc) · 10.6 KB
/
Copy pathci.yml
File metadata and controls
330 lines (267 loc) · 10.6 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
name: CI
on:
pull_request:
push:
branches:
- master
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
jobs:
rust-format:
name: Rust format
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal --component rustfmt
rustup default "$toolchain"
rustc --version
cargo --version
- name: Check formatting
run: cargo fmt --all --check
- name: Naming gate (retired legacy tokens)
run: ./scripts/check_legacy_naming.sh
rust-check:
name: Rust check
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Check workspace
run: RUSTFLAGS='-D warnings' cargo check --workspace --all-targets --locked
- name: Check all features
run: RUSTFLAGS='-D warnings' cargo check --workspace --all-targets --all-features --locked
rust-clippy:
name: Rust clippy
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal --component clippy
rustup default "$toolchain"
rustc --version
cargo --version
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run clippy
run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Run clippy with all features
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
rust-test:
name: Rust tests (${{ matrix.partition }}/4)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
partition: [1, 2, 3, 4]
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Install cargo-nextest
uses: taiki-e/install-action@b18fb392e1a1b90971f7c7572c92790fa54f23d5 # nextest
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run workspace tests
# The subprocess-heavy `wn-cli::cli` suite runs in its own
# `cli-e2e` job so its fan-out never starves these fast unit tests
# (issue #103). `relay_runtime` keeps its own serial job.
run: cargo nextest run --workspace --exclude cgka-conformance-simulator --locked --profile ci --partition count:${{ matrix.partition }}/4 -E 'not (package(marmot-app) & binary(relay_runtime)) and not (package(wn-cli) & binary(cli))'
- name: Run doctests
if: matrix.partition == 1
run: cargo test --workspace --exclude cgka-conformance-simulator --doc --locked
cli-e2e:
name: CLI e2e (mock relay)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Install cargo-nextest
uses: taiki-e/install-action@b18fb392e1a1b90971f7c7572c92790fa54f23d5 # nextest
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run CLI end-to-end tests
# Dedicated job: this subprocess-heavy suite is capped by the `cli-e2e`
# test-group and the `ci` profile adds retries + a hung-test backstop.
# The real-relay test self-skips here; it has its own `Relay CLI E2E`
# job with a docker relay stack.
run: cargo nextest run -p wn-cli --test cli --locked --profile ci
relay-runtime:
name: Relay runtime tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run relay runtime tests serially
run: cargo test -p marmot-app --test relay_runtime --locked -- --test-threads=1
relay-e2e:
name: Relay CLI E2E
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Install cargo-nextest
uses: taiki-e/install-action@b18fb392e1a1b90971f7c7572c92790fa54f23d5 # nextest
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Start local relay stack
run: docker compose up -d setup nostr-rs-relay strfry-nostr-relay
- name: Wait for local relays
run: |
docker compose ps
./scripts/wait_for_relays.sh
- name: Run real relay CLI E2E
env:
MDK_E2E_REQUIRE_RELAYS: "1"
run: cargo nextest run -p wn-cli --test cli --locked --profile ci -E 'test(=real_local_relays_deliver_cli_messages_over_sdk_path)'
- name: Dump local relay logs
if: failure()
run: docker compose logs nostr-rs-relay strfry-nostr-relay || true
- name: Stop local relay stack
if: always()
run: docker compose down -v
conformance:
name: Simulator and vectors
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Rust toolchain
run: |
set -euo pipefail
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
rustup toolchain install "$toolchain" --profile minimal
rustup default "$toolchain"
rustc --version
cargo --version
- name: Install cargo-nextest
uses: taiki-e/install-action@b18fb392e1a1b90971f7c7572c92790fa54f23d5 # nextest
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run simulator tests
run: cargo nextest run -p cgka-conformance-simulator --locked --profile ci
- name: Run simulator doctests
run: cargo test -p cgka-conformance-simulator --doc --locked
- name: Run vector report
run: |
cargo run -p cgka-conformance-simulator --bin cgka-conformance-simulator-report --locked -- \
--vectors crates/cgka-conformance-simulator/vectors \
--out target/cgka-conformance-simulator-reports \
--strict-oracle
- name: Upload vector report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cgka-conformance-simulator-reports
path: target/cgka-conformance-simulator-reports
if-no-files-found: error
formal:
name: Tamarin proofs
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Install Tamarin dependencies
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends graphviz maude
- name: Install Tamarin
env:
TAMARIN_VERSION: 1.12.0
run: |
set -euo pipefail
curl -L --fail --show-error --silent \
"https://github.com/tamarin-prover/tamarin-prover/releases/download/${TAMARIN_VERSION}/tamarin-prover-${TAMARIN_VERSION}-linux64-ubuntu.tar.gz" \
-o /tmp/tamarin-prover.tar.gz
tar -xzf /tmp/tamarin-prover.tar.gz -C /tmp
sudo install -m 0755 /tmp/tamarin-prover /usr/local/bin/tamarin-prover
tamarin-prover --version
- name: Run Tamarin proofs
run: make -C formal/tamarin prove