|
| 1 | +name: Smoke-Test Fuzz Targets |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + |
| 9 | +jobs: |
| 10 | + fuzz: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + env: |
| 14 | + # The version of `cargo-fuzz` to install and use. |
| 15 | + CARGO_FUZZ_VERSION: 0.13.1 |
| 16 | + |
| 17 | + # The number of seconds to run the fuzz target. 300 seconds = 5 minutes. |
| 18 | + FUZZ_TIME: 300 |
| 19 | + |
| 20 | + # Use address sanitizer in the fuzzing. |
| 21 | + RUSTFLAGS: -Zsanitizer=address |
| 22 | + |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: ["ubuntu-24.04-arm", "ubuntu-latest"] |
| 26 | + include: |
| 27 | + - fuzz_target: ecmascript_atomics_api |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + # Install the nightly Rust channel. |
| 33 | + - run: rustup toolchain install nightly |
| 34 | + - run: rustup default nightly |
| 35 | + |
| 36 | + # Install and cache `cargo-fuzz`. |
| 37 | + - uses: actions/cache@v4 |
| 38 | + with: |
| 39 | + path: ${{ runner.tool_cache }}/cargo-fuzz |
| 40 | + key: cargo-fuzz-bin-${{ env.CARGO_FUZZ_VERSION }} |
| 41 | + - run: echo "${{ runner.tool_cache }}/cargo-fuzz/bin" >> $GITHUB_PATH |
| 42 | + - run: cargo install --root "${{ runner.tool_cache }}/cargo-fuzz" --version ${{ env.CARGO_FUZZ_VERSION }} cargo-fuzz --locked |
| 43 | + |
| 44 | + # Build and then run the fuzz target. |
| 45 | + - run: cargo fuzz build ${{ matrix.fuzz_target }} |
| 46 | + - run: cargo fuzz run ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }} |
| 47 | + |
| 48 | + # Upload fuzzing artifacts on failure for post-mortem debugging. |
| 49 | + - uses: actions/upload-artifact@v4 |
| 50 | + if: failure() |
| 51 | + with: |
| 52 | + name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }} |
| 53 | + path: fuzz/artifacts |
0 commit comments