Skip to content

Commit c1485d3

Browse files
authored
Adjust GitHub Actions for Ubuntu 24.04. (#297)
GitHub migrated `ubuntu-latest` to `ubuntu-24.04`, which comes with a different set of pre-installed software. Most notably, both cargo audit and outdated tools are missing. While there, pin runner image and tools to specific versions. Signed-off-by: Piotr Sikora <[email protected]>
1 parent 1ce09fd commit c1485d3

File tree

2 files changed

+52
-51
lines changed

2 files changed

+52
-51
lines changed

.actrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-P ubuntu-24.04=catthehacker/ubuntu:act-24.04

.github/workflows/rust.yml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ on:
3030
jobs:
3131

3232
licenses:
33-
runs-on: ubuntu-latest
33+
runs-on: ubuntu-24.04
3434

3535
steps:
3636
- uses: actions/checkout@v2
@@ -46,14 +46,17 @@ jobs:
4646
~/go/pkg/mod
4747
key: licenses-${{ hashFiles('.github/workflows/rust.yml') }}
4848

49-
- name: Check licenses
49+
- name: Install dependencies
5050
run: |
51-
go install github.com/google/addlicense@latest
51+
go install github.com/google/addlicense@v1.1.1
5252
export PATH=$PATH:$(go env GOPATH)/bin
53+
54+
- name: Check licenses
55+
run: |
5356
addlicense -check -ignore "bazel/cargo/remote/**" .
5457
5558
bazel:
56-
runs-on: ubuntu-latest
59+
runs-on: ubuntu-24.04
5760

5861
steps:
5962
- uses: actions/checkout@v2
@@ -73,12 +76,13 @@ jobs:
7376
~/.cargo/bin
7477
~/.cargo/registry
7578
~/go/pkg/mod
76-
key: bazel-${{ hashFiles('BUILD', 'WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
79+
key: bazel-${{ hashFiles('.github/workflows/rust.yml', 'BUILD', 'WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
7780

7881
- name: Install dependencies
79-
if: ${{ env.ACT }}
8082
run: |
81-
go install github.com/bazelbuild/[email protected]
83+
go install github.com/bazelbuild/[email protected]
84+
go install github.com/bazelbuild/buildtools/[email protected]
85+
export PATH=$PATH:$(go env GOPATH)/bin
8286
8387
- name: Build (wasm32-unknown-unknown)
8488
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...
@@ -88,8 +92,6 @@ jobs:
8892

8993
- name: Format (buildifier)
9094
run: |
91-
go install github.com/bazelbuild/buildtools/buildifier@latest
92-
export PATH=$PATH:$(go env GOPATH)/bin
9395
buildifier -mode=check -r .
9496
9597
- name: Format (rules_rust)
@@ -98,7 +100,7 @@ jobs:
98100
git diff --exit-code
99101
100102
msrv:
101-
runs-on: ubuntu-latest
103+
runs-on: ubuntu-24.04
102104

103105
env:
104106
RUSTFLAGS: -D warnings
@@ -120,7 +122,7 @@ jobs:
120122
**/target
121123
key: msrv-${{ hashFiles('Cargo.toml') }}
122124

123-
- name: Install dependencies
125+
- name: Install Rustup
124126
if: ${{ env.ACT }}
125127
run: |
126128
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -161,7 +163,7 @@ jobs:
161163
run: cargo publish --dry-run --target=wasm32-unknown-unknown
162164

163165
stable:
164-
runs-on: ubuntu-latest
166+
runs-on: ubuntu-24.04
165167

166168
env:
167169
RUSTFLAGS: -D warnings
@@ -183,7 +185,7 @@ jobs:
183185
**/target
184186
key: stable-${{ hashFiles('Cargo.toml') }}
185187

186-
- name: Install dependencies
188+
- name: Install Rustup
187189
if: ${{ env.ACT }}
188190
run: |
189191
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -223,7 +225,7 @@ jobs:
223225
run: cargo publish --dry-run --target=wasm32-unknown-unknown
224226

225227
nightly:
226-
runs-on: ubuntu-latest
228+
runs-on: ubuntu-24.04
227229

228230
env:
229231
RUSTFLAGS: -D warnings
@@ -245,7 +247,7 @@ jobs:
245247
**/target
246248
key: nightly-${{ hashFiles('Cargo.toml') }}
247249

248-
- name: Install dependencies
250+
- name: Install Rustup
249251
if: ${{ env.ACT }}
250252
run: |
251253
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -286,13 +288,12 @@ jobs:
286288
run: cargo publish --dry-run --target=wasm32-unknown-unknown
287289

288290
outdated:
289-
runs-on: ubuntu-latest
291+
runs-on: ubuntu-24.04
290292

291293
steps:
292294
- uses: actions/checkout@v2
293295

294296
- name: Cache
295-
if: ${{ env.ACT }}
296297
uses: actions/cache@v2
297298
with:
298299
path: |
@@ -302,9 +303,9 @@ jobs:
302303
~/.cargo/bin
303304
~/.cargo/registry
304305
~/.rustup
305-
key: outdated-${{ hashFiles('Cargo.toml') }}
306+
key: outdated-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
306307

307-
- name: Install dependencies
308+
- name: Install Rustup
308309
if: ${{ env.ACT }}
309310
run: |
310311
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -313,20 +314,28 @@ jobs:
313314
rm rustup-init.sh
314315
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
315316
316-
- name: Run cargo outdated
317+
- name: Install dependencies
318+
run: |
319+
cargo install cargo-outdated --version 0.16.0
320+
321+
- name: Run cargo outdated (main)
317322
run: |
318-
# TODO: Switch back to the official version once it supports Cargo lockfile v4.
319-
cargo install --git https://github.com/MonterraByte/cargo-outdated.git --branch cargo-update
320323
cargo outdated --root-deps-only --exit-code 1
321324
325+
- name: Run cargo outdated (examples)
326+
run: |
327+
for example in $(find examples -name Cargo.toml); do \
328+
cd $(dirname $GITHUB_WORKSPACE/$example); \
329+
cargo outdated --root-deps-only --exit-code 1; \
330+
done
331+
322332
audit:
323-
runs-on: ubuntu-latest
333+
runs-on: ubuntu-24.04
324334

325335
steps:
326336
- uses: actions/checkout@v2
327337

328338
- name: Cache
329-
if: ${{ env.ACT }}
330339
uses: actions/cache@v2
331340
with:
332341
path: |
@@ -336,26 +345,35 @@ jobs:
336345
~/.cargo/bin
337346
~/.cargo/registry
338347
~/.rustup
339-
key: audit-${{ hashFiles('Cargo.toml') }}
348+
key: audit-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}
340349

341-
- name: Install dependencies
350+
- name: Install Rustup
342351
if: ${{ env.ACT }}
343352
run: |
344353
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
345354
chmod +x ./rustup-init.sh
346355
./rustup-init.sh -y
347356
rm rustup-init.sh
348357
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
349-
export PATH=$PATH:$HOME/.cargo/bin
350-
cargo install cargo-audit
351358
352-
- name: Run cargo audit
359+
- name: Install dependencies
360+
run: |
361+
cargo install cargo-audit --version 0.21.0
362+
363+
- name: Run cargo audit (main)
353364
run: |
354365
cp -p bazel/cargo/Cargo.Bazel.lock Cargo.lock
355366
cargo audit
356367
368+
- name: Run cargo audit (examples)
369+
run: |
370+
for example in $(find examples -name Cargo.toml); do \
371+
cd $(dirname $GITHUB_WORKSPACE/$example); \
372+
cargo audit; \
373+
done
374+
357375
examples:
358-
runs-on: ubuntu-latest
376+
runs-on: ubuntu-24.04
359377

360378
strategy:
361379
matrix:
@@ -391,7 +409,7 @@ jobs:
391409
**/target
392410
key: example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
393411

394-
- name: Install dependencies
412+
- name: Install Rustup
395413
if: ${{ env.ACT }}
396414
run: |
397415
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -417,15 +435,6 @@ jobs:
417435
- name: Format (manifest)
418436
run: cargo verify-project
419437

420-
- name: Run cargo audit
421-
if: ${{ !env.ACT }}
422-
run: cargo audit
423-
424-
# TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
425-
#- name: Run cargo outdated
426-
# if: ${{ !env.ACT }}
427-
# run: cargo outdated --root-deps-only --exit-code 1
428-
429438
- name: Validate Envoy config
430439
run: |
431440
docker run --rm \
@@ -436,7 +445,7 @@ jobs:
436445
-c envoy.yaml
437446
438447
reactors:
439-
runs-on: ubuntu-latest
448+
runs-on: ubuntu-24.04
440449

441450
strategy:
442451
matrix:
@@ -472,7 +481,7 @@ jobs:
472481
**/target
473482
key: reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}
474483

475-
- name: Install dependencies
484+
- name: Install Rustup
476485
if: ${{ env.ACT }}
477486
run: |
478487
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
@@ -505,15 +514,6 @@ jobs:
505514
- name: Format (manifest)
506515
run: cargo verify-project
507516

508-
- name: Run cargo audit
509-
if: ${{ !env.ACT }}
510-
run: cargo audit
511-
512-
# TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
513-
#- name: Run cargo outdated
514-
# if: ${{ !env.ACT }}
515-
# run: cargo outdated --root-deps-only --exit-code 1
516-
517517
- name: Rename .wasm to match expected filename
518518
run: |
519519
cd target/wasm32-wasip1/release

0 commit comments

Comments
 (0)