From 7b9be937f7ec0adfd2eb766af777ba24ea75a632 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Fri, 23 May 2025 19:22:15 +0200 Subject: [PATCH] Use nightly for miri (#3268) * miri nightly * actually add miri * ?? * clp cache new --- .github/workflows/build_and_test.yml | 11 ++++-- .github/workflows/ubuntu-prepare/action.yml | 43 +++++++++++++++++---- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0b7b34f948..42bf2a40e7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -104,11 +104,15 @@ jobs: runs-on: ubuntu-24.04 if: contains( github.event.pull_request.labels.*.name, 'pre-release') steps: - - name: Add miri - run: rustup toolchain install --component miri --allow-downgrade - uses: actions/checkout@v4 - uses: ./.github/workflows/ubuntu-prepare + with: + use_nightly: 'true' + - name: Add miri + run: rustup +nightly component add miri - uses: Swatinem/rust-cache@v2 + with: + shared-key: ubuntu-miri # --- miri undefined behavior test -- - name: Run miri tests run: RUST_BACKTRACE=1 MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test @@ -145,7 +149,8 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/workflows/ubuntu-prepare - uses: Swatinem/rust-cache@v2 - with: { shared-key: "ubuntu" } + with: + shared-key: "ubuntu-clippy" - name: Run clippy run: LLVM_CONFIG=llvm-config-${{env.MAIN_LLVM_VERSION}} ./scripts/clippy.sh # --- test embedding the libafl_libfuzzer_runtime library diff --git a/.github/workflows/ubuntu-prepare/action.yml b/.github/workflows/ubuntu-prepare/action.yml index e0e23daf60..0f26dadfcf 100644 --- a/.github/workflows/ubuntu-prepare/action.yml +++ b/.github/workflows/ubuntu-prepare/action.yml @@ -1,32 +1,59 @@ name: Setup Rust Environment -description: Sets up the Rust environment for the CI workflow +description: Sets up the Rust environment for the CI workflow and optionally installs nightly + +# ---------- new section ---------- +inputs: + use_nightly: + description: "If true, install the Rust nightly toolchain instead of stable" + required: false + default: "false" +# --------------------------------- + runs: using: composite steps: - - name: Uninstall all currently installed rust + - name: Uninstall all currently installed Rust shell: bash run: | sudo apt purge -y 'cargo*' 'rust*' + - name: Install and cache deps shell: bash run: | sudo apt-get update - sudo apt-get install -y curl lsb-release wget software-properties-common gnupg shellcheck pax-utils libsqlite3-dev libpixman-1-dev libc6-dev gcc g++ build-essential libglib2.0-dev - - uses: dtolnay/rust-toolchain@stable + sudo apt-get install -y \ + curl lsb-release wget software-properties-common gnupg shellcheck pax-utils \ + libsqlite3-dev libpixman-1-dev libc6-dev gcc g++ build-essential libglib2.0-dev + + # ---------- toolchain selection ---------- + - name: Install Rust (stable) + if: ${{ inputs.use_nightly == 'false' }} + uses: dtolnay/rust-toolchain@stable with: components: clippy, rustfmt - - name: install just + + - name: Install Rust (nightly) + if: ${{ inputs.use_nightly == 'true' }} + uses: dtolnay/rust-toolchain@nightly + with: + components: clippy, rustfmt + # ----------------------------------------- + + - name: Install just uses: extractions/setup-just@v2 with: just-version: '1.40.0' + - uses: taiki-e/install-action@cargo-hack + - name: Install LLVM shell: bash run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh ${{env.MAIN_LLVM_VERSION}} all - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{env.MAIN_LLVM_VERSION}} 200 - - name: Symlink Headers + sudo ./llvm.sh ${{ env.MAIN_LLVM_VERSION }} all + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.MAIN_LLVM_VERSION }} 200 + + - name: Symlink headers shell: bash run: sudo ln -s /usr/include/asm-generic /usr/include/asm