Skip to content

Commit 4f3ff0c

Browse files
test an integration with our CI
1 parent 18cc64b commit 4f3ff0c

2 files changed

Lines changed: 38 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,43 @@ jobs:
5656
toolchain: ${{ steps.msrv.outputs.value }}
5757
components: rustfmt
5858
- 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
5978

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
6096
coverage:
6197
name: Code Coverage
6298
if: github.event_name != 'release'
@@ -78,7 +114,7 @@ jobs:
78114
# This job checks if any of the previous jobs failed or were canceled.
79115
# This approach also allows some jobs to be skipped if they are not needed.
80116
ci-passed:
81-
needs: [ test, test-nightly, test-msrv ]
117+
needs: [ test, test-nightly, test-msrv, fuzz ]
82118
if: always()
83119
runs-on: ubuntu-latest
84120
steps:

fuzz/Cargo.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,20 @@ cargo-fuzz = true
1010
[dependencies]
1111
libfuzzer-sys = "0.4"
1212
arbitrary = { version = "1", features = ["derive"] }
13-
fastpfor = { path = "..", default-features = false }
14-
15-
[features]
16-
cpp = ["fastpfor/cpp"]
17-
rust = ["fastpfor/rust"]
13+
fastpfor = { path = "..", features = ["cpp", "rust"] }
1814

1915
# Prevent this from interfering with workspaces
2016
[workspace]
2117
members = ["."]
2218

2319
[[bin]]
2420
name = "fastpfor_rust"
25-
required-features = ["rust"]
2621
path = "fuzz_targets/fastpfor_rust.rs"
2722
test = false
2823
doc = false
2924

3025
[[bin]]
3126
name = "fastpfor_cpp"
32-
required-features = ["cpp"]
3327
path = "fuzz_targets/fastpfor_cpp.rs"
3428
test = false
3529
doc = false

0 commit comments

Comments
 (0)