Skip to content

Commit

Permalink
Adjust GitHub Actions for Ubuntu 24.04. (#297)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
PiotrSikora authored Jan 15, 2025
1 parent 1ce09fd commit c1485d3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 51 deletions.
1 change: 1 addition & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-P ubuntu-24.04=catthehacker/ubuntu:act-24.04
102 changes: 51 additions & 51 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
jobs:

licenses:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

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

- name: Check licenses
- name: Install dependencies
run: |
go install github.com/google/addlicense@latest
go install github.com/google/addlicense@v1.1.1
export PATH=$PATH:$(go env GOPATH)/bin
- name: Check licenses
run: |
addlicense -check -ignore "bazel/cargo/remote/**" .
bazel:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

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

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

- name: Format (buildifier)
run: |
go install github.com/bazelbuild/buildtools/buildifier@latest
export PATH=$PATH:$(go env GOPATH)/bin
buildifier -mode=check -r .
- name: Format (rules_rust)
Expand All @@ -98,7 +100,7 @@ jobs:
git diff --exit-code
msrv:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

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

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

stable:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

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

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

nightly:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

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

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

outdated:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
Expand All @@ -302,9 +303,9 @@ jobs:
~/.cargo/bin
~/.cargo/registry
~/.rustup
key: outdated-${{ hashFiles('Cargo.toml') }}
key: outdated-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}

- name: Install dependencies
- name: Install Rustup
if: ${{ env.ACT }}
run: |
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
Expand All @@ -313,20 +314,28 @@ jobs:
rm rustup-init.sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Run cargo outdated
- name: Install dependencies
run: |
cargo install cargo-outdated --version 0.16.0
- name: Run cargo outdated (main)
run: |
# TODO: Switch back to the official version once it supports Cargo lockfile v4.
cargo install --git https://github.com/MonterraByte/cargo-outdated.git --branch cargo-update
cargo outdated --root-deps-only --exit-code 1
- name: Run cargo outdated (examples)
run: |
for example in $(find examples -name Cargo.toml); do \
cd $(dirname $GITHUB_WORKSPACE/$example); \
cargo outdated --root-deps-only --exit-code 1; \
done
audit:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
Expand All @@ -336,26 +345,35 @@ jobs:
~/.cargo/bin
~/.cargo/registry
~/.rustup
key: audit-${{ hashFiles('Cargo.toml') }}
key: audit-${{ hashFiles('.github/workflows/rust.yml', 'Cargo.toml') }}

- name: Install dependencies
- name: Install Rustup
if: ${{ env.ACT }}
run: |
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
chmod +x ./rustup-init.sh
./rustup-init.sh -y
rm rustup-init.sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
export PATH=$PATH:$HOME/.cargo/bin
cargo install cargo-audit
- name: Run cargo audit
- name: Install dependencies
run: |
cargo install cargo-audit --version 0.21.0
- name: Run cargo audit (main)
run: |
cp -p bazel/cargo/Cargo.Bazel.lock Cargo.lock
cargo audit
- name: Run cargo audit (examples)
run: |
for example in $(find examples -name Cargo.toml); do \
cd $(dirname $GITHUB_WORKSPACE/$example); \
cargo audit; \
done
examples:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
Expand Down Expand Up @@ -391,7 +409,7 @@ jobs:
**/target
key: example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}

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

- name: Run cargo audit
if: ${{ !env.ACT }}
run: cargo audit

# TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
#- name: Run cargo outdated
# if: ${{ !env.ACT }}
# run: cargo outdated --root-deps-only --exit-code 1

- name: Validate Envoy config
run: |
docker run --rm \
Expand All @@ -436,7 +445,7 @@ jobs:
-c envoy.yaml
reactors:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
Expand Down Expand Up @@ -472,7 +481,7 @@ jobs:
**/target
key: reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
- name: Install Rustup
if: ${{ env.ACT }}
run: |
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
Expand Down Expand Up @@ -505,15 +514,6 @@ jobs:
- name: Format (manifest)
run: cargo verify-project

- name: Run cargo audit
if: ${{ !env.ACT }}
run: cargo audit

# TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
#- name: Run cargo outdated
# if: ${{ !env.ACT }}
# run: cargo outdated --root-deps-only --exit-code 1

- name: Rename .wasm to match expected filename
run: |
cd target/wasm32-wasip1/release
Expand Down

0 comments on commit c1485d3

Please sign in to comment.