|
56 | 56 | toolchain: ${{ steps.msrv.outputs.value }} |
57 | 57 | components: rustfmt |
58 | 58 | - run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV |
| 59 | + fuzz: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + env: |
| 63 | + # The number of seconds to run the fuzz target. |
| 64 | + FUZZ_TIME: 60 |
| 65 | + |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + include: |
| 69 | + - fuzz_target: fastpfor_cpp |
| 70 | + - fuzz_target: fastpfor_rust |
| 71 | + |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + |
| 75 | + # Install the nightly Rust channel. |
| 76 | + - run: rustup toolchain install nightly |
| 77 | + - run: rustup default nightly |
59 | 78 |
|
| 79 | + # Install and cache `cargo-fuzz`. |
| 80 | + - uses: taiki-e/install-action@v2 |
| 81 | + with: |
| 82 | + tool: cargo-binstall |
| 83 | + - run: cargo binstall cargo-fuzz@0.13.1 # Pinned to avoid breakage. |
| 84 | + |
| 85 | + # Build and then run the fuzz target. |
| 86 | + - run: cargo fuzz build ${{ matrix.fuzz_target }} |
| 87 | + - run: cargo fuzz run ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }} |
| 88 | + |
| 89 | + # Upload fuzzing artifacts on failure for post-mortem debugging. |
| 90 | + - uses: actions/upload-artifact@v4 |
| 91 | + if: failure() |
| 92 | + with: |
| 93 | + name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }} |
| 94 | + path: fuzz/artifacts |
| 95 | +yxx |
60 | 96 | coverage: |
61 | 97 | name: Code Coverage |
62 | 98 | if: github.event_name != 'release' |
|
78 | 114 | # This job checks if any of the previous jobs failed or were canceled. |
79 | 115 | # This approach also allows some jobs to be skipped if they are not needed. |
80 | 116 | ci-passed: |
81 | | - needs: [ test, test-nightly, test-msrv ] |
| 117 | + needs: [ test, test-nightly, test-msrv, fuzz ] |
82 | 118 | if: always() |
83 | 119 | runs-on: ubuntu-latest |
84 | 120 | steps: |
|
0 commit comments