From 806783c0fcece545476ffbb3f7e66bb601d99318 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 26 Nov 2024 16:09:13 -0500 Subject: [PATCH] Remove integration-ebp/rust-toolchain Centralize the knowledge in build.rs instead. --- .github/workflows/ci.yml | 31 +++++++++++++---------- test/integration-ebpf/rust-toolchain.toml | 2 -- test/integration-test/build.rs | 8 +++--- 3 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 test/integration-ebpf/rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a0e5e99..868d1f67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly - components: rustfmt, clippy, miri, rust-src + components: clippy,miri,rustfmt,rust-src + + # Installed *after* nightly so it is the default. + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 @@ -43,7 +45,7 @@ jobs: run: taplo fmt --check - name: Check formatting - run: cargo fmt --all -- --check + run: cargo +nightly fmt --all -- --check - name: Run clippy run: ./clippy.sh @@ -62,7 +64,7 @@ jobs: - name: Run miri run: | set -euxo pipefail - cargo hack miri test --all-targets --feature-powerset \ + cargo +nightly hack miri test --all-targets --feature-powerset \ --exclude aya-ebpf \ --exclude aya-ebpf-bindings \ --exclude aya-log-ebpf \ @@ -85,9 +87,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 @@ -149,11 +149,13 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly components: rust-src + # Installed *after* nightly so it is the default. + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 - name: bpf-linker @@ -165,7 +167,7 @@ jobs: CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.bpf_target_arch }} run: | set -euxo pipefail - cargo hack build \ + cargo +nightly hack build \ --target ${{ matrix.target }} \ -Z build-std=core \ --package aya-ebpf \ @@ -239,10 +241,13 @@ jobs: echo $(brew --prefix)/opt/gnu-tar/libexec/gnubin >> $GITHUB_PATH echo $(brew --prefix)/opt/llvm/bin >> $GITHUB_PATH - - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly components: rust-src + + # Installed *after* nightly so it is the default. + - uses: dtolnay/rust-toolchain@stable + with: targets: aarch64-unknown-linux-musl,x86_64-unknown-linux-musl - uses: Swatinem/rust-cache@v2 diff --git a/test/integration-ebpf/rust-toolchain.toml b/test/integration-ebpf/rust-toolchain.toml deleted file mode 100644 index 5d56faf9..00000000 --- a/test/integration-ebpf/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly" diff --git a/test/integration-test/build.rs b/test/integration-test/build.rs index c019b4fc..f4578509 100644 --- a/test/integration-test/build.rs +++ b/test/integration-test/build.rs @@ -191,7 +191,10 @@ fn main() { let mut cmd = Command::new("cargo"); cmd.args([ + "+nightly", "build", + "--package", + "integration-ebpf", "-Z", "build-std=core", "--bins", @@ -203,11 +206,10 @@ fn main() { cmd.env("CARGO_CFG_BPF_TARGET_ARCH", arch); - // Workaround to make sure that the rust-toolchain.toml is respected. - for key in ["RUSTUP_TOOLCHAIN", "RUSTC"] { + // Workaround to make sure that the correct toolchain is used. + for key in ["RUSTC", "RUSTC_WORKSPACE_WRAPPER"] { cmd.env_remove(key); } - cmd.current_dir(integration_ebpf_dir); // Workaround for https://github.com/rust-lang/cargo/issues/6412 where cargo flocks itself. let ebpf_target_dir = out_dir.join("integration-ebpf");