38
38
with :
39
39
go-version : ' ^1.16'
40
40
41
+ - name : Cache
42
+ if : ${{ env.ACT }}
43
+ uses : actions/cache@v2
44
+ with :
45
+ path : |
46
+ ~/go/pkg/mod
47
+ key : licenses-${{ hashFiles('.github/workflows/rust.yml') }}
48
+
41
49
- name : Check licenses
42
50
run : |
43
51
go install github.com/google/addlicense@latest
53
61
with :
54
62
go-version : ' ^1.16'
55
63
56
- - name : Install dependencies
57
- if : ${{ env.ACT }}
58
- run : |
59
- go install github.com/bazelbuild/[email protected]
60
-
61
64
- name : Cache
62
65
uses : actions/cache@v2
63
66
with :
@@ -66,22 +69,28 @@ jobs:
66
69
~/.cache/bazelisk
67
70
~/.cargo/.crates.toml
68
71
~/.cargo/.crates2.json
72
+ ~/.cargo/advisory-db
69
73
~/.cargo/bin
70
74
~/.cargo/registry
71
- key : ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
75
+ ~/go/pkg/mod
76
+ key : bazel-${{ hashFiles('BUILD', 'WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
77
+
78
+ - name : Install dependencies
79
+ if : ${{ env.ACT }}
80
+ run : |
81
+ go install github.com/bazelbuild/[email protected]
72
82
73
83
- name : Build (wasm32-unknown-unknown)
74
84
run : bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...
75
85
76
- - name : Build (wasm32-wasi )
86
+ - name : Build (wasm32-wasip1 )
77
87
run : bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasi //...
78
88
79
89
- name : Format (buildifier)
80
90
run : |
81
91
go install github.com/bazelbuild/buildtools/buildifier@latest
82
92
export PATH=$PATH:$(go env GOPATH)/bin
83
- buildifier -mode=check WORKSPACE
84
- buildifier -mode=check BUILD
93
+ buildifier -mode=check -r .
85
94
86
95
- name : Format (rules_rust)
87
96
run : |
@@ -97,6 +106,20 @@ jobs:
97
106
steps :
98
107
- uses : actions/checkout@v2
99
108
109
+ - name : Cache
110
+ if : ${{ env.ACT }}
111
+ uses : actions/cache@v2
112
+ with :
113
+ path : |
114
+ ~/.cargo/.crates.toml
115
+ ~/.cargo/.crates2.json
116
+ ~/.cargo/advisory-db
117
+ ~/.cargo/bin
118
+ ~/.cargo/registry
119
+ ~/.rustup
120
+ **/target
121
+ key : msrv-${{ hashFiles('Cargo.toml') }}
122
+
100
123
- name : Install dependencies
101
124
if : ${{ env.ACT }}
102
125
run : |
@@ -149,6 +172,20 @@ jobs:
149
172
steps :
150
173
- uses : actions/checkout@v2
151
174
175
+ - name : Cache
176
+ if : ${{ env.ACT }}
177
+ uses : actions/cache@v2
178
+ with :
179
+ path : |
180
+ ~/.cargo/.crates.toml
181
+ ~/.cargo/.crates2.json
182
+ ~/.cargo/advisory-db
183
+ ~/.cargo/bin
184
+ ~/.cargo/registry
185
+ ~/.rustup
186
+ **/target
187
+ key : stable-${{ hashFiles('Cargo.toml') }}
188
+
152
189
- name : Install dependencies
153
190
if : ${{ env.ACT }}
154
191
run : |
@@ -162,19 +199,19 @@ jobs:
162
199
run : |
163
200
rustup toolchain install stable --component clippy --component rustfmt
164
201
rustup target add wasm32-unknown-unknown
165
- rustup target add wasm32-wasi
202
+ rustup target add wasm32-wasip1
166
203
167
204
- name : Build (wasm32-unknown-unknown)
168
205
run : cargo build --release --all-targets --target=wasm32-unknown-unknown
169
206
170
207
- name : Clippy (wasm32-unknown-unknown)
171
208
run : cargo clippy --release --all-targets --target=wasm32-unknown-unknown
172
209
173
- - name : Build (wasm32-wasi )
174
- run : cargo build --release --all-targets --target=wasm32-wasi
210
+ - name : Build (wasm32-wasip1 )
211
+ run : cargo build --release --all-targets --target=wasm32-wasip1
175
212
176
- - name : Clippy (wasm32-wasi )
177
- run : cargo clippy --release --all-targets --target=wasm32-wasi
213
+ - name : Clippy (wasm32-wasip1 )
214
+ run : cargo clippy --release --all-targets --target=wasm32-wasip1
178
215
179
216
- name : Format (rustfmt)
180
217
run : cargo fmt -- --check
@@ -200,6 +237,20 @@ jobs:
200
237
steps :
201
238
- uses : actions/checkout@v2
202
239
240
+ - name : Cache
241
+ if : ${{ env.ACT }}
242
+ uses : actions/cache@v2
243
+ with :
244
+ path : |
245
+ ~/.cargo/.crates.toml
246
+ ~/.cargo/.crates2.json
247
+ ~/.cargo/advisory-db
248
+ ~/.cargo/bin
249
+ ~/.cargo/registry
250
+ ~/.rustup
251
+ **/target
252
+ key : nightly-${{ hashFiles('Cargo.toml') }}
253
+
203
254
- name : Install dependencies
204
255
if : ${{ env.ACT }}
205
256
run : |
@@ -214,19 +265,19 @@ jobs:
214
265
rustup toolchain install nightly --component clippy --component rustfmt
215
266
rustup default nightly
216
267
rustup target add wasm32-unknown-unknown
217
- rustup target add wasm32-wasi
268
+ rustup target add wasm32-wasip1
218
269
219
270
- name : Build (wasm32-unknown-unknown)
220
271
run : cargo build --release --all-targets --target=wasm32-unknown-unknown
221
272
222
273
- name : Clippy (wasm32-unknown-unknown)
223
274
run : cargo clippy --release --all-targets --target=wasm32-unknown-unknown
224
275
225
- - name : Build (wasm32-wasi )
226
- run : cargo build --release --all-targets --target=wasm32-wasi
276
+ - name : Build (wasm32-wasip1 )
277
+ run : cargo build --release --all-targets --target=wasm32-wasip1
227
278
228
- - name : Clippy (wasm32-wasi )
229
- run : cargo clippy --release --all-targets --target=wasm32-wasi
279
+ - name : Clippy (wasm32-wasip1 )
280
+ run : cargo clippy --release --all-targets --target=wasm32-wasip1
230
281
231
282
- name : Format (rustfmt)
232
283
run : cargo fmt -- --check
@@ -249,6 +300,19 @@ jobs:
249
300
steps :
250
301
- uses : actions/checkout@v2
251
302
303
+ - name : Cache
304
+ if : ${{ env.ACT }}
305
+ uses : actions/cache@v2
306
+ with :
307
+ path : |
308
+ ~/.cargo/.crates.toml
309
+ ~/.cargo/.crates2.json
310
+ ~/.cargo/advisory-db
311
+ ~/.cargo/bin
312
+ ~/.cargo/registry
313
+ ~/.rustup
314
+ key : outdated-${{ hashFiles('Cargo.toml') }}
315
+
252
316
- name : Install dependencies
253
317
if : ${{ env.ACT }}
254
318
run : |
@@ -269,6 +333,19 @@ jobs:
269
333
steps :
270
334
- uses : actions/checkout@v2
271
335
336
+ - name : Cache
337
+ if : ${{ env.ACT }}
338
+ uses : actions/cache@v2
339
+ with :
340
+ path : |
341
+ ~/.cargo/.crates.toml
342
+ ~/.cargo/.crates2.json
343
+ ~/.cargo/advisory-db
344
+ ~/.cargo/bin
345
+ ~/.cargo/registry
346
+ ~/.rustup
347
+ key : audit-${{ hashFiles('Cargo.toml') }}
348
+
272
349
- name : Install dependencies
273
350
if : ${{ env.ACT }}
274
351
run : |
@@ -285,7 +362,7 @@ jobs:
285
362
cp -p bazel/cargo/Cargo.Bazel.lock Cargo.lock
286
363
cargo audit
287
364
288
- example :
365
+ examples :
289
366
runs-on : ubuntu-latest
290
367
291
368
strategy :
@@ -308,6 +385,20 @@ jobs:
308
385
steps :
309
386
- uses : actions/checkout@v2
310
387
388
+ - name : Cache
389
+ if : ${{ env.ACT }}
390
+ uses : actions/cache@v2
391
+ with :
392
+ path : |
393
+ ~/.cargo/.crates.toml
394
+ ~/.cargo/.crates2.json
395
+ ~/.cargo/advisory-db
396
+ ~/.cargo/bin
397
+ ~/.cargo/registry
398
+ ~/.rustup
399
+ **/target
400
+ key : example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
401
+
311
402
- name : Install dependencies
312
403
if : ${{ env.ACT }}
313
404
run : |
@@ -320,13 +411,13 @@ jobs:
320
411
- name : Update Rust
321
412
run : |
322
413
rustup toolchain install stable --component clippy --component rustfmt
323
- rustup target add wasm32-wasi
414
+ rustup target add wasm32-wasip1
324
415
325
- - name : Build (wasm32-wasi )
326
- run : cargo build --release --target=wasm32-wasi
416
+ - name : Build (wasm32-wasip1 )
417
+ run : cargo build --release --target=wasm32-wasip1
327
418
328
- - name : Clippy (wasm32-wasi )
329
- run : cargo clippy --release --target=wasm32-wasi
419
+ - name : Clippy (wasm32-wasip1 )
420
+ run : cargo clippy --release --target=wasm32-wasip1
330
421
331
422
- name : Format (rustfmt)
332
423
run : cargo fmt -- --check
@@ -335,21 +426,23 @@ jobs:
335
426
run : cargo verify-project
336
427
337
428
- name : Run cargo audit
429
+ if : ${{ !env.ACT }}
338
430
run : cargo audit
339
431
340
432
- name : Run cargo outdated
433
+ if : ${{ !env.ACT }}
341
434
run : cargo outdated --root-deps-only --exit-code 1
342
435
343
436
- name : Validate Envoy config
344
437
run : |
345
438
docker run --rm \
346
439
-v $(pwd)/envoy.yaml:/envoy.yaml \
347
- -v $(pwd)/target/wasm32-wasi /release:/etc/envoy/proxy-wasm-plugins \
440
+ -v $(pwd)/target/wasm32-wasip1 /release:/etc/envoy/proxy-wasm-plugins \
348
441
envoyproxy/envoy:v1.31-latest \
349
442
--mode validate \
350
443
-c envoy.yaml
351
444
352
- reactor :
445
+ reactors :
353
446
runs-on : ubuntu-latest
354
447
355
448
strategy :
@@ -372,48 +465,66 @@ jobs:
372
465
steps :
373
466
- uses : actions/checkout@v2
374
467
468
+ - name : Cache
469
+ if : ${{ env.ACT }}
470
+ uses : actions/cache@v2
471
+ with :
472
+ path : |
473
+ ~/.cargo/.crates.toml
474
+ ~/.cargo/.crates2.json
475
+ ~/.cargo/advisory-db
476
+ ~/.cargo/bin
477
+ ~/.cargo/registry
478
+ ~/.rustup
479
+ **/target
480
+ key : reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
481
+
375
482
- name : Install dependencies
376
483
if : ${{ env.ACT }}
377
484
run : |
378
485
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
379
486
chmod +x ./rustup-init.sh
380
- ./rustup-init.sh -y
487
+ ./rustup-init.sh -y --default-toolchain nightly
381
488
rm rustup-init.sh
382
489
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
383
490
384
491
- name : Update Rust
385
492
run : |
386
493
rustup toolchain install nightly --component clippy --component rustfmt
387
- rustup +nightly target add wasm32-wasi
388
494
rustup default nightly
495
+ rustup target add wasm32-wasip1
389
496
390
497
- name : Change crate type from library to binary
391
498
run : |
392
499
grep -v '^\[lib\]' Cargo.toml > Cargo.tmp
393
500
grep -v '^crate-type' Cargo.tmp > Cargo.toml
394
501
mv src/lib.rs src/main.rs
395
502
396
- - name : Build (wasm32-wasi )
397
- run : cargo build --release --target=wasm32-wasi
503
+ - name : Build (wasm32-wasip1 )
504
+ run : cargo build --release --target=wasm32-wasip1
398
505
399
- - name : Clippy (wasm32-wasi )
400
- run : cargo clippy --release --target=wasm32-wasi
506
+ - name : Clippy (wasm32-wasip1 )
507
+ run : cargo clippy --release --target=wasm32-wasip1
401
508
402
509
- name : Format (rustfmt)
403
510
run : cargo fmt -- --check
404
511
405
512
- name : Format (manifest)
406
513
run : cargo verify-project
407
514
408
- - name : Run cargo audit
409
- run : cargo audit
515
+ # TODO: Re-enable once cargo audit supports Cargo lockfile v4.
516
+ # - name: Run cargo audit
517
+ # if: ${{ !env.ACT }}
518
+ # run: cargo audit
410
519
411
- - name : Run cargo outdated
412
- run : cargo outdated --root-deps-only --exit-code 1
520
+ # TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
521
+ # - name: Run cargo outdated
522
+ # if: ${{ !env.ACT }}
523
+ # run: cargo outdated --root-deps-only --exit-code 1
413
524
414
525
- name : Rename .wasm to match expected filename
415
526
run : |
416
- cd target/wasm32-wasi /release
527
+ cd target/wasm32-wasip1 /release
417
528
for file in $(ls -1 *.wasm); do \
418
529
mv $file $(echo $file | sed 's/-/_/g'); \
419
530
done
@@ -422,7 +533,7 @@ jobs:
422
533
run : |
423
534
docker run --rm \
424
535
-v $(pwd)/envoy.yaml:/envoy.yaml \
425
- -v $(pwd)/target/wasm32-wasi /release:/etc/envoy/proxy-wasm-plugins \
536
+ -v $(pwd)/target/wasm32-wasip1 /release:/etc/envoy/proxy-wasm-plugins \
426
537
envoyproxy/envoy:v1.31-latest \
427
538
--mode validate \
428
539
-c envoy.yaml
0 commit comments