|
38 | 38 | - name: Build stm32 |
39 | 39 | working-directory: statime-stm32 |
40 | 40 | run: cargo build |
41 | | - |
| 41 | + |
42 | 42 | # Build std is handled by test job |
43 | 43 |
|
44 | 44 | test: |
@@ -108,24 +108,46 @@ jobs: |
108 | 108 | fuzz: |
109 | 109 | name: Smoke-test fuzzing targets |
110 | 110 | runs-on: ubuntu-latest |
| 111 | + strategy: |
| 112 | + matrix: |
| 113 | + include: |
| 114 | + - fuzz_target: message_sound |
| 115 | + corpus: "" |
| 116 | + features: '' |
111 | 117 | steps: |
112 | 118 | - name: Checkout sources |
113 | | - uses: actions/checkout@v4 |
| 119 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
114 | 120 | with: |
115 | 121 | persist-credentials: false |
116 | | - - name: Install stable toolchain |
117 | | - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af |
| 122 | + - name: Install nightly toolchain |
| 123 | + uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 |
118 | 124 | with: |
119 | 125 | toolchain: nightly |
120 | | - override: true |
121 | | - default: true |
122 | | - - name: Install cargo fuzz |
123 | | - uses: taiki-e/install-action@70233fe3d27d863712ee34eede2087e36bde6b5e |
| 126 | + components: llvm-tools-preview |
| 127 | + - name: Install cargo fuzz & rustfilt |
| 128 | + uses: taiki-e/install-action@d6912b47771be2c443ec90dbb3d28e023987e782 |
124 | 129 | with: |
125 | | - tool: cargo-fuzz |
126 | | - - name: Smoke-test fuzz targets |
| 130 | + tool: cargo-fuzz,rustfilt |
| 131 | + - name: Run `cargo fuzz` |
| 132 | + env: |
| 133 | + RUST_BACKTRACE: "1" |
| 134 | + # prevents `cargo fuzz coverage` from rebuilding everything |
| 135 | + RUSTFLAGS: "-C instrument-coverage" |
| 136 | + run: | |
| 137 | + cargo fuzz run --target $(rustc --print host-tuple) ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}} -- -max_total_time=10 |
| 138 | + - name: Fuzz codecov |
127 | 139 | run: | |
128 | | - cargo fuzz build |
129 | | - for target in $(cargo fuzz list) ; do |
130 | | - cargo fuzz run $target -- -max_total_time=10 |
131 | | - done |
| 140 | + cargo fuzz coverage --target $(rustc --print host-tuple) ${{matrix.features}} ${{matrix.fuzz_target}} ${{matrix.corpus}} |
| 141 | + $(rustc --print sysroot)/lib/rustlib/$(rustc --print host-tuple)/bin/llvm-cov export -Xdemangler=rustfilt \ |
| 142 | + target/x86_64-unknown-linux-musl/coverage/$(rustc --print host-tuple)/release/${{matrix.fuzz_target}} \ |
| 143 | + -instr-profile=fuzz/coverage/${{matrix.fuzz_target}}/coverage.profdata \ |
| 144 | + --format=lcov \ |
| 145 | + -ignore-filename-regex="\.cargo|\.rustup" > lcov.info |
| 146 | + - name: Upload coverage to Codecov |
| 147 | + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 |
| 148 | + with: |
| 149 | + files: ./lcov.info |
| 150 | + fail_ci_if_error: false |
| 151 | + flags: fuzz, fuzz-${{ matrix.fuzz_target }} |
| 152 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 153 | + name: fuzz |
0 commit comments