diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml index 4b5ac5e3561..ef71f5fa925 100644 --- a/.github/workflows/fuzzing.yml +++ b/.github/workflows/fuzzing.yml @@ -1,6 +1,7 @@ name: Fuzzing -# spell-checker:ignore fuzzer dtolnay Swatinem +# spell-checker:ignore (people) dtolnay Swatinem taiki-e +# spell-checker:ignore (misc) fuzzer on: pull_request: @@ -19,16 +20,17 @@ concurrency: jobs: uufuzz-examples: name: Build and test uufuzz examples + env: + CARGO_INCREMENTAL: 0 runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: persist-credentials: false - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - shared-key: "uufuzz-cache-key" - cache-directories: "fuzz/target" + #- uses: Swatinem/rust-cache@v2 + #with: + #shared-key: "uufuzz-cache-key" + #cache-directories: "fuzz/target" - name: Build uufuzz library run: | cd fuzz/uufuzz @@ -59,15 +61,20 @@ jobs: with: persist-credentials: false - name: Install `cargo-fuzz` - run: | - echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" # Use -Z - cargo install cargo-fuzz --locked - - uses: Swatinem/rust-cache@v2 + uses: taiki-e/install-action@v2 with: - shared-key: "cargo-fuzz-cache-key" - cache-directories: "fuzz/target" + tool: cargo-fuzz + - name: Emulate a nightly toolchain + run: | + echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" + #- uses: Swatinem/rust-cache@v2 + #with: + #shared-key: "cargo-fuzz-cache-key" + #cache-directories: "fuzz/target" - name: Run `cargo-fuzz build` - run: cargo fuzz build + # Force the correct target + # https://github.com/rust-fuzz/cargo-fuzz/issues/398 + run: cargo fuzz build --target $(rustc --print host-tuple) fuzz-run: needs: fuzz-build @@ -76,6 +83,7 @@ jobs: timeout-minutes: 5 env: RUN_FOR: 60 + CARGO_INCREMENTAL: 0 strategy: matrix: test-target: @@ -104,19 +112,22 @@ jobs: with: persist-credentials: false - name: Install `cargo-fuzz` - run: | - echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" # Use nightly - cargo install cargo-fuzz --locked - - uses: Swatinem/rust-cache@v2 + uses: taiki-e/install-action@v2 with: - shared-key: "cargo-fuzz-cache-key" - cache-directories: "fuzz/target" - - name: Restore Cached Corpus - uses: actions/cache/restore@v5 - with: - key: corpus-cache-${{ matrix.test-target.name }} - path: | - fuzz/corpus/${{ matrix.test-target.name }} + tool: cargo-fuzz + - name: Emulate a nightly toolchain + run: | + echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" + #- uses: Swatinem/rust-cache@v2 + #with: + #shared-key: "cargo-fuzz-cache-key" + #cache-directories: "fuzz/target" + #- name: Restore Cached Corpus + #uses: actions/cache/restore@v5 + #with: + #key: corpus-cache-${{ matrix.test-target.name }} + #path: | + #fuzz/corpus/${{ matrix.test-target.name }} - name: Run ${{ matrix.test-target.name }} for XX seconds id: run_fuzzer shell: bash @@ -124,7 +135,9 @@ jobs: run: | mkdir -p fuzz/stats STATS_FILE="fuzz/stats/${{ matrix.test-target.name }}.txt" - cargo fuzz run ${{ matrix.test-target.name }} -- -max_total_time=${{ env.RUN_FOR }} -timeout=${{ env.RUN_FOR }} -detect_leaks=0 -print_final_stats=1 2>&1 | tee "$STATS_FILE" + # Force the correct target + # https://github.com/rust-fuzz/cargo-fuzz/issues/398 + cargo fuzz run --target $(rustc --print host-tuple) ${{ matrix.test-target.name }} -- -max_total_time=${{ env.RUN_FOR }} -timeout=${{ env.RUN_FOR }} -detect_leaks=0 -print_final_stats=1 2>&1 | tee "$STATS_FILE" # Extract key stats from the output if grep -q "stat::number_of_executed_units" "$STATS_FILE"; then @@ -193,12 +206,12 @@ jobs: fi echo "" >> $GITHUB_STEP_SUMMARY - - name: Save Corpus Cache - uses: actions/cache/save@v5 - with: - key: corpus-cache-${{ matrix.test-target.name }} - path: | - fuzz/corpus/${{ matrix.test-target.name }} + #- name: Save Corpus Cache + #uses: actions/cache/save@v5 + #with: + #key: corpus-cache-${{ matrix.test-target.name }} + #path: | + #fuzz/corpus/${{ matrix.test-target.name }} - name: Upload Stats uses: actions/upload-artifact@v6 with: