-
Notifications
You must be signed in to change notification settings - Fork 2.4k
525 lines (482 loc) · 17.1 KB
/
Copy pathrust.yml
File metadata and controls
525 lines (482 loc) · 17.1 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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
name: Rust
on:
push:
branches: [ 'devnet_*', 'testnet_*' ]
merge_group:
pull_request:
branches:
- "**"
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs on pull requests
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}'
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: full
# We allow redundant explicit links because `cargo rdme` doesn't know how to resolve implicit intra-crate links.
RUSTDOCFLAGS: -A rustdoc::redundant_explicit_links -D warnings
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
RUST_LOG: linera=debug
RUST_LOG_FORMAT: plain
LINERA_STORAGE_SERVICE: 127.0.0.1:1235
LINERA_WALLET: /tmp/local-linera-net/wallet_0.json
LINERA_KEYSTORE: /tmp/local-linera-net/keystore_0.json
LINERA_STORAGE: rocksdb:/tmp/local-linera-net/client_0.db
LINERA_FAUCET_URL: http://localhost:8079
permissions:
contents: read
jobs:
# paths-ignore within a pull_request doesn't work well with merge_group, so we need to use a custom filter.
changed-files:
runs-on: ubuntu-latest
outputs:
should-run: ${{ steps.files-changed.outputs.paths }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Filter paths
uses: dorny/[email protected]
id: files-changed
with:
predicate-quantifier: 'every'
filters: |
paths:
- '!docker/**'
- '!configuration/**'
- '!docs/**'
- '!mdbook/**'
- '!CONTRIBUTING.md'
- '!INSTALL.md'
- '!README.md'
# Workflow-only PRs don't need heavy code tests; merge to main
# validates the workflow itself by running it for real.
- '!.github/workflows/**'
execution-wasmtime-test:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run some extra execution tests with wasmtime
run: |
cargo test --locked -p linera-execution --features wasmtime
bridge-tests:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: linera-io-self-hosted-ci
timeout-minutes: 25
steps:
- uses: actions/[email protected]
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.7.0
- name: Ensure Solc Directory Exists
run: mkdir -p /home/runner/.solc
- name: Cache Solc
id: cache-solc
uses: actions/cache@v4
with:
path: /home/runner/.solc
key: solc-v0.8.33
restore-keys: solc-
- name: Get Solc
if: ${{ steps.cache-solc.outputs.cache-hit != 'true' }}
uses: ./.github/actions/get-solc
with:
version: v0.8.33
- name: Add Solc to PATH
run: echo "/home/runner/.solc" >> $GITHUB_PATH
- name: List the content of the Solc cache
run: ls /home/runner/.solc/v0.8.33/solc-static-linux
- name: Create a Solc symbolic link
run: ln -sf /home/runner/.solc/v0.8.33/solc-static-linux /home/runner/.solc/solc
- name: Check if Solc is in PATH
id: check-solc
run: |
if which solc; then
echo "solc-available=true" >> $GITHUB_OUTPUT
else
echo "::warning::solc not found in PATH, skipping bridge tests"
echo "solc-available=false" >> $GITHUB_OUTPUT
fi
- name: Regenerate Solidity types
if: steps.check-solc.outputs.solc-available == 'true'
run: |
cargo build --locked -p linera-bridge --features codegen
- name: Check generated Solidity files are up to date
if: steps.check-solc.outputs.solc-available == 'true'
run: |
if ! git diff --exit-code linera-bridge/src/solidity/
then
echo 'Generated Solidity files are out of date. Run `cargo build -p linera-bridge --features codegen` and commit the results.'
exit 1
fi
- name: Run bridge tests
if: steps.check-solc.outputs.solc-available == 'true'
run: |
cargo test --locked -p linera-bridge
- name: Run Solidity (forge) tests
if: steps.check-solc.outputs.solc-available == 'true'
working-directory: linera-bridge/src/solidity
run: forge test -vvv
metrics-test:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run metrics tests
run: |
cargo test --locked -p linera-base --features metrics
wasm-application-test:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-workspaces: |
examples -> target
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Run Wasm application tests
run: |
cd examples
cargo test --locked
linera-sdk-tests-fixtures:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-workspaces: |
linera-sdk/tests/fixtures -> target
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Run linera-sdk fixtures
run: |
cd linera-sdk/tests/fixtures
cargo test --locked
- name: Run linera-sdk tests application lints
run: |
cd linera-sdk/tests/fixtures
cargo fmt -- --check
cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked
default-features-and-witty-integration-test:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: linera-io-self-hosted-ci
timeout-minutes: 40
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Compile Wasm test modules for Witty integration tests
run: |
cargo build -p linera-witty-test-modules --target wasm32-unknown-unknown --locked
- name: Run all tests using the default features (except storage-service)
run: |
# TODO(#2764): Actually link this to the default features
cargo test --no-default-features --features fs,macros,wasmer,rocksdb --locked
- name: Run Witty integration tests
run: |
cargo test -p linera-witty --features wasmer,wasmtime --locked
check-outdated-cli-md:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Check for outdated CLI.md
run: |
if ! diff CLI.md <(cargo run --bin linera -- help-markdown)
then
echo '`CLI.md` differs from the output of `linera help-markdown`'
echo 'Run `linera help-markdown > CLI.md` to update it.'
exit 1
fi
ethereum-tests:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: foundry-rs/[email protected]
- name: Ensure Solc Directory Exists
run: mkdir -p /home/runner/.solc
- name: Cache Solc
id: cache-solc
uses: actions/cache@v4
with:
path: /home/runner/.solc
key: solc-v0.8.33
restore-keys: solc-
- name: Get Solc
if: ${{ steps.cache-solc.outputs.cache-hit != 'true' }}
uses: ./.github/actions/get-solc
with:
version: v0.8.33
- name: Add Solc to PATH
run: echo "/home/runner/.solc" >> $GITHUB_PATH
- name: List the content of the Solc cache
run: ls /home/runner/.solc/v0.8.33/solc-static-linux
- name: Create a Solc symbolic link
run: ln -sf /home/runner/.solc/v0.8.33/solc-static-linux /home/runner/.solc/solc
- name: Check if Solc is in PATH
run: which solc || echo "Solc not found in PATH"
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Install serde-generate-bin
run: |
cargo install [email protected] --locked
- name: Compile the LineraTypes.yaml
run: |
serdegen --language solidity --module-name LineraTypes --target-source-dir dest linera-execution/solidity/LineraTypes.yaml
- name: Check for generated LineraTypes.sol
run: |
if ! diff dest/LineraTypes.sol linera-execution/solidity/LineraTypes.sol
then
echo '`LineraTypes.sol` differs from the output of `serdegen`'
exit 1
fi
- name: Run the storage-service instance
run: |
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
- name: Wait for storage service to be ready
run: |
STORAGE_HOST=$(echo "$LINERA_STORAGE_SERVICE" | cut -d: -f1)
STORAGE_PORT=$(echo "$LINERA_STORAGE_SERVICE" | cut -d: -f2)
until nc -z "$STORAGE_HOST" "$STORAGE_PORT"; do sleep 1; done
- name: Run Ethereum tests
run: |
cargo test -p linera-ethereum --features ethereum
cargo test test_wasm_end_to_end_ethereum_tracker --features ethereum,storage-service
- name: Run REVM test
run: |
cargo test evm --features revm,storage-service
storage-service-tests:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: linera-io-self-hosted-ci
timeout-minutes: 40
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Build example applications
run: |
cd examples
cargo build --locked --release --target wasm32-unknown-unknown
- name: Run the storage-service instance
run: |
cargo run --release -p linera-storage-service -- memory --endpoint $LINERA_STORAGE_SERVICE &
- name: Wait for storage service to be ready
run: |
STORAGE_HOST=$(echo "$LINERA_STORAGE_SERVICE" | cut -d: -f1)
STORAGE_PORT=$(echo "$LINERA_STORAGE_SERVICE" | cut -d: -f2)
until nc -z "$STORAGE_HOST" "$STORAGE_PORT"; do sleep 1; done
- name: Run the storage-service tests
run: |
cargo test --features storage-service,opentelemetry -- storage_service --nocapture
check-wit-files:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check WIT files
run: |
cargo run --bin wit-generator -- -c
lint-unexpected-chain-load-operations:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/[email protected]
- name: Check for unexpected chain load operations
run: |
./scripts/check_chain_loads.sh
lint-check-copyright-headers:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/[email protected]
- name: Build check_copyright_header script
run: |
cd ./scripts/check_copyright_header
cargo build --locked --release
- name: Check Copyright headers
run: >
find linera-* examples -name '*.rs' -a -not -wholename '*/target/*' -print0
| xargs -0 scripts/target/release/check_copyright_header
lint-cargo-machete:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-machete
run: |
cargo install [email protected] --locked
- name: Check for unused dependencies
run: |
cargo machete
lint-cargo-fmt:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check formatting
run: |
cargo fmt -- --check
lint-taplo-fmt:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install `taplo-cli`
run: RUSTFLAGS='' cargo install [email protected] --locked
- name: Check if `Cargo.toml` files are formatted
run: taplo fmt --check --diff
lint-check-for-outdated-readme:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-rdme
run: |
cargo install cargo-rdme --locked
- name: Check for outdated README.md
run: |
set -e
linera_packages=($(
cargo metadata --format-version 1 \
| jq -r '.workspace_members[] | match("/(linera-.*)#").captures[0].string' \
))
for package in "${linera_packages[*]}"
do
[ -d "$package" ] || continue
echo $package
cargo rdme --check --no-fail-on-warnings -w $package
done
lint-wasm-applications:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Run Wasm application lints
run: |
cd examples
cargo fmt -- --check
cargo clippy --all-targets --all-features --target wasm32-unknown-unknown --locked
cargo clippy --all-targets --all-features --target x86_64-unknown-linux-gnu --locked
cd agent
cargo fmt -- --check
lint-cargo-clippy:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Run clippy
run: |
cargo clippy --locked --all-targets --all-features --workspace
cargo clippy --locked --no-default-features
cargo clippy --locked --target wasm32-unknown-unknown --no-default-features --features web-default \
-p linera-client \
-p linera-rpc \
-p linera-views
lint-cargo-doc:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/[email protected]
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Run cargo doc
run: |
cargo doc --locked --all-features --no-deps
lint-check-linera-service-graphql-schema:
needs: changed-files
if: needs.changed-files.outputs.should-run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Protoc
uses: ./.github/actions/install-protoc
- name: Check linera-service GraphQL schema
run: |
diff <(cargo run --locked --bin linera-schema-export) linera-service-graphql-client/gql/service_schema.graphql