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 : |
@@ -146,6 +169,20 @@ jobs:
146
169
steps :
147
170
- uses : actions/checkout@v2
148
171
172
+ - name : Cache
173
+ if : ${{ env.ACT }}
174
+ uses : actions/cache@v2
175
+ with :
176
+ path : |
177
+ ~/.cargo/.crates.toml
178
+ ~/.cargo/.crates2.json
179
+ ~/.cargo/advisory-db
180
+ ~/.cargo/bin
181
+ ~/.cargo/registry
182
+ ~/.rustup
183
+ **/target
184
+ key : stable-${{ hashFiles('Cargo.toml') }}
185
+
149
186
- name : Install dependencies
150
187
if : ${{ env.ACT }}
151
188
run : |
@@ -159,19 +196,19 @@ jobs:
159
196
run : |
160
197
rustup toolchain install stable --component clippy --component rustfmt
161
198
rustup target add wasm32-unknown-unknown
162
- rustup target add wasm32-wasi
199
+ rustup target add wasm32-wasip1
163
200
164
201
- name : Build (wasm32-unknown-unknown)
165
202
run : cargo build --release --all-targets --target=wasm32-unknown-unknown
166
203
167
204
- name : Clippy (wasm32-unknown-unknown)
168
205
run : cargo clippy --release --all-targets --target=wasm32-unknown-unknown
169
206
170
- - name : Build (wasm32-wasi )
171
- run : cargo build --release --all-targets --target=wasm32-wasi
207
+ - name : Build (wasm32-wasip1 )
208
+ run : cargo build --release --all-targets --target=wasm32-wasip1
172
209
173
- - name : Clippy (wasm32-wasi )
174
- run : cargo clippy --release --all-targets --target=wasm32-wasi
210
+ - name : Clippy (wasm32-wasip1 )
211
+ run : cargo clippy --release --all-targets --target=wasm32-wasip1
175
212
176
213
- name : Format (rustfmt)
177
214
run : cargo fmt -- --check
@@ -194,6 +231,20 @@ jobs:
194
231
steps :
195
232
- uses : actions/checkout@v2
196
233
234
+ - name : Cache
235
+ if : ${{ env.ACT }}
236
+ uses : actions/cache@v2
237
+ with :
238
+ path : |
239
+ ~/.cargo/.crates.toml
240
+ ~/.cargo/.crates2.json
241
+ ~/.cargo/advisory-db
242
+ ~/.cargo/bin
243
+ ~/.cargo/registry
244
+ ~/.rustup
245
+ **/target
246
+ key : nightly-${{ hashFiles('Cargo.toml') }}
247
+
197
248
- name : Install dependencies
198
249
if : ${{ env.ACT }}
199
250
run : |
@@ -208,19 +259,19 @@ jobs:
208
259
rustup toolchain install nightly --component clippy --component rustfmt
209
260
rustup default nightly
210
261
rustup target add wasm32-unknown-unknown
211
- rustup target add wasm32-wasi
262
+ rustup target add wasm32-wasip1
212
263
213
264
- name : Build (wasm32-unknown-unknown)
214
265
run : cargo build --release --all-targets --target=wasm32-unknown-unknown
215
266
216
267
- name : Clippy (wasm32-unknown-unknown)
217
268
run : cargo clippy --release --all-targets --target=wasm32-unknown-unknown
218
269
219
- - name : Build (wasm32-wasi )
220
- run : cargo build --release --all-targets --target=wasm32-wasi
270
+ - name : Build (wasm32-wasip1 )
271
+ run : cargo build --release --all-targets --target=wasm32-wasip1
221
272
222
- - name : Clippy (wasm32-wasi )
223
- run : cargo clippy --release --all-targets --target=wasm32-wasi
273
+ - name : Clippy (wasm32-wasip1 )
274
+ run : cargo clippy --release --all-targets --target=wasm32-wasip1
224
275
225
276
- name : Format (rustfmt)
226
277
run : cargo fmt -- --check
@@ -240,6 +291,19 @@ jobs:
240
291
steps :
241
292
- uses : actions/checkout@v2
242
293
294
+ - name : Cache
295
+ if : ${{ env.ACT }}
296
+ uses : actions/cache@v2
297
+ with :
298
+ path : |
299
+ ~/.cargo/.crates.toml
300
+ ~/.cargo/.crates2.json
301
+ ~/.cargo/advisory-db
302
+ ~/.cargo/bin
303
+ ~/.cargo/registry
304
+ ~/.rustup
305
+ key : outdated-${{ hashFiles('Cargo.toml') }}
306
+
243
307
- name : Install dependencies
244
308
if : ${{ env.ACT }}
245
309
run : |
@@ -260,6 +324,19 @@ jobs:
260
324
steps :
261
325
- uses : actions/checkout@v2
262
326
327
+ - name : Cache
328
+ if : ${{ env.ACT }}
329
+ uses : actions/cache@v2
330
+ with :
331
+ path : |
332
+ ~/.cargo/.crates.toml
333
+ ~/.cargo/.crates2.json
334
+ ~/.cargo/advisory-db
335
+ ~/.cargo/bin
336
+ ~/.cargo/registry
337
+ ~/.rustup
338
+ key : audit-${{ hashFiles('Cargo.toml') }}
339
+
263
340
- name : Install dependencies
264
341
if : ${{ env.ACT }}
265
342
run : |
@@ -276,7 +353,7 @@ jobs:
276
353
cp -p bazel/cargo/Cargo.Bazel.lock Cargo.lock
277
354
cargo audit
278
355
279
- example :
356
+ examples :
280
357
runs-on : ubuntu-latest
281
358
282
359
strategy :
@@ -300,6 +377,20 @@ jobs:
300
377
steps :
301
378
- uses : actions/checkout@v2
302
379
380
+ - name : Cache
381
+ if : ${{ env.ACT }}
382
+ uses : actions/cache@v2
383
+ with :
384
+ path : |
385
+ ~/.cargo/.crates.toml
386
+ ~/.cargo/.crates2.json
387
+ ~/.cargo/advisory-db
388
+ ~/.cargo/bin
389
+ ~/.cargo/registry
390
+ ~/.rustup
391
+ **/target
392
+ key : example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
393
+
303
394
- name : Install dependencies
304
395
if : ${{ env.ACT }}
305
396
run : |
@@ -312,13 +403,13 @@ jobs:
312
403
- name : Update Rust
313
404
run : |
314
405
rustup toolchain install stable --component clippy --component rustfmt
315
- rustup target add wasm32-wasi
406
+ rustup target add wasm32-wasip1
316
407
317
- - name : Build (wasm32-wasi )
318
- run : cargo build --release --target=wasm32-wasi
408
+ - name : Build (wasm32-wasip1 )
409
+ run : cargo build --release --target=wasm32-wasip1
319
410
320
- - name : Clippy (wasm32-wasi )
321
- run : cargo clippy --release --target=wasm32-wasi
411
+ - name : Clippy (wasm32-wasip1 )
412
+ run : cargo clippy --release --target=wasm32-wasip1
322
413
323
414
- name : Format (rustfmt)
324
415
run : cargo fmt -- --check
@@ -327,21 +418,23 @@ jobs:
327
418
run : cargo verify-project
328
419
329
420
- name : Run cargo audit
421
+ if : ${{ !env.ACT }}
330
422
run : cargo audit
331
423
332
424
- name : Run cargo outdated
425
+ if : ${{ !env.ACT }}
333
426
run : cargo outdated --root-deps-only --exit-code 1
334
427
335
428
- name : Validate Envoy config
336
429
run : |
337
430
docker run --rm \
338
431
-v $(pwd)/envoy.yaml:/envoy.yaml \
339
- -v $(pwd)/target/wasm32-wasi /release:/etc/envoy/proxy-wasm-plugins \
432
+ -v $(pwd)/target/wasm32-wasip1 /release:/etc/envoy/proxy-wasm-plugins \
340
433
envoyproxy/envoy:v1.31-latest \
341
434
--mode validate \
342
435
-c envoy.yaml
343
436
344
- reactor :
437
+ reactors :
345
438
runs-on : ubuntu-latest
346
439
347
440
strategy :
@@ -365,48 +458,66 @@ jobs:
365
458
steps :
366
459
- uses : actions/checkout@v2
367
460
461
+ - name : Cache
462
+ if : ${{ env.ACT }}
463
+ uses : actions/cache@v2
464
+ with :
465
+ path : |
466
+ ~/.cargo/.crates.toml
467
+ ~/.cargo/.crates2.json
468
+ ~/.cargo/advisory-db
469
+ ~/.cargo/bin
470
+ ~/.cargo/registry
471
+ ~/.rustup
472
+ **/target
473
+ key : reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
474
+
368
475
- name : Install dependencies
369
476
if : ${{ env.ACT }}
370
477
run : |
371
478
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
372
479
chmod +x ./rustup-init.sh
373
- ./rustup-init.sh -y
480
+ ./rustup-init.sh -y --default-toolchain nightly
374
481
rm rustup-init.sh
375
482
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
376
483
377
484
- name : Update Rust
378
485
run : |
379
486
rustup toolchain install nightly --component clippy --component rustfmt
380
- rustup +nightly target add wasm32-wasi
381
487
rustup default nightly
488
+ rustup target add wasm32-wasip1
382
489
383
490
- name : Change crate type from library to binary
384
491
run : |
385
492
grep -v '^\[lib\]' Cargo.toml > Cargo.tmp
386
493
grep -v '^crate-type' Cargo.tmp > Cargo.toml
387
494
mv src/lib.rs src/main.rs
388
495
389
- - name : Build (wasm32-wasi )
390
- run : cargo build --release --target=wasm32-wasi
496
+ - name : Build (wasm32-wasip1 )
497
+ run : cargo build --release --target=wasm32-wasip1
391
498
392
- - name : Clippy (wasm32-wasi )
393
- run : cargo clippy --release --target=wasm32-wasi
499
+ - name : Clippy (wasm32-wasip1 )
500
+ run : cargo clippy --release --target=wasm32-wasip1
394
501
395
502
- name : Format (rustfmt)
396
503
run : cargo fmt -- --check
397
504
398
505
- name : Format (manifest)
399
506
run : cargo verify-project
400
507
401
- - name : Run cargo audit
402
- run : cargo audit
508
+ # TODO: Re-enable once cargo audit supports Cargo lockfile v4.
509
+ # - name: Run cargo audit
510
+ # if: ${{ !env.ACT }}
511
+ # run: cargo audit
403
512
404
- - name : Run cargo outdated
405
- run : cargo outdated --root-deps-only --exit-code 1
513
+ # TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
514
+ # - name: Run cargo outdated
515
+ # if: ${{ !env.ACT }}
516
+ # run: cargo outdated --root-deps-only --exit-code 1
406
517
407
518
- name : Rename .wasm to match expected filename
408
519
run : |
409
- cd target/wasm32-wasi /release
520
+ cd target/wasm32-wasip1 /release
410
521
for file in $(ls -1 *.wasm); do \
411
522
mv $file $(echo $file | sed 's/-/_/g'); \
412
523
done
@@ -415,7 +526,7 @@ jobs:
415
526
run : |
416
527
docker run --rm \
417
528
-v $(pwd)/envoy.yaml:/envoy.yaml \
418
- -v $(pwd)/target/wasm32-wasi /release:/etc/envoy/proxy-wasm-plugins \
529
+ -v $(pwd)/target/wasm32-wasip1 /release:/etc/envoy/proxy-wasm-plugins \
419
530
envoyproxy/envoy:v1.31-latest \
420
531
--mode validate \
421
532
-c envoy.yaml
0 commit comments