Skip to content

Commit 92eeb77

Browse files
committed
ci(fuzzer): build the Rust runtime in CI
Teach release and test workflows about the Rust-backed backend so the native addon is built, cached, and exercised the way it is shipped.
1 parent 7b0c3f6 commit 92eeb77

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/workflows/release.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
with:
2929
node-version: 22
3030
cache: "npm"
31+
- name: rust
32+
uses: dtolnay/rust-toolchain@stable
33+
- name: rust target (macos x64)
34+
if: ${{ matrix.os == 'macos-latest' && matrix.arch == '--arch x86_64' }}
35+
run: rustup target add x86_64-apple-darwin
3136
- name: MSVC (windows)
3237
uses: ilammy/msvc-dev-cmd@v1
3338
if: contains(matrix.os, 'windows')

.github/workflows/run-all-tests-main.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,25 @@ jobs:
2121
path: |
2222
packages/fuzzer/prebuilds
2323
key:
24-
fuzzer-cache-${{ runner.os }}-${{
25-
hashFiles('packages/fuzzer/CMakeLists.txt',
26-
'packages/fuzzer/**/*.h', 'packages/fuzzer/**/*.cpp') }}
24+
fuzzer-cache-${{ runner.os }}-${{ hashFiles('package-lock.json',
25+
'package.json', 'packages/fuzzer/package.json',
26+
'packages/fuzzer/CMakeLists.txt', 'packages/fuzzer/**/*.h',
27+
'packages/fuzzer/**/*.cpp', 'packages/fuzzer/rust/Cargo.toml',
28+
'packages/fuzzer/rust/Cargo.lock',
29+
'packages/fuzzer/rust/src/**/*.rs') }}
2730
- name: node
2831
uses: actions/setup-node@v6
2932
with:
3033
node-version: 22
3134
cache: "npm"
35+
- name: rust
36+
uses: dtolnay/rust-toolchain@stable
3237
- name: install dependencies
3338
run: npm ci
3439
- name: build project
3540
run: npm run build
41+
- name: test LibAFL runtime
42+
run: cargo test --manifest-path packages/fuzzer/rust/Cargo.toml
3643
- name: build fuzzer
3744
if: ${{ steps.cache-fuzzer.outputs.cache-hit != 'true' }}
3845
run: npm run build --workspace=@jazzer.js/fuzzer

.github/workflows/run-all-tests-pr.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ jobs:
2424
with:
2525
node-version: 22
2626
cache: "npm"
27+
- name: rust
28+
uses: dtolnay/rust-toolchain@stable
2729
- name: install dependencies
2830
run: npm ci
2931
- name: install clang-tidy
3032
run: sudo apt-get install -y clang-tidy
3133
- name: build project
3234
# Build project so that imports can be checked during linting
3335
run: npm run build
36+
- name: test LibAFL runtime
37+
run: cargo test --manifest-path packages/fuzzer/rust/Cargo.toml
3438
- name: build fuzzer
3539
# Build the native addon so that CMake downloads libFuzzer and
3640
# generates compile_commands.json, which are needed by clang-tidy
@@ -59,14 +63,19 @@ jobs:
5963
path: |
6064
packages/fuzzer/prebuilds
6165
key:
62-
fuzzer-cache-${{ matrix.os }}-${{
63-
hashFiles('packages/fuzzer/CMakeLists.txt',
64-
'packages/fuzzer/**/*.h', 'packages/fuzzer/**/*.cpp') }}
66+
fuzzer-cache-${{ matrix.os }}-${{ hashFiles('package-lock.json',
67+
'package.json', 'packages/fuzzer/package.json',
68+
'packages/fuzzer/CMakeLists.txt', 'packages/fuzzer/**/*.h',
69+
'packages/fuzzer/**/*.cpp', 'packages/fuzzer/rust/Cargo.toml',
70+
'packages/fuzzer/rust/Cargo.lock',
71+
'packages/fuzzer/rust/src/**/*.rs') }}
6572
- name: node
6673
uses: actions/setup-node@v6
6774
with:
6875
node-version: ${{ matrix.node }}
6976
cache: "npm"
77+
- name: rust
78+
uses: dtolnay/rust-toolchain@stable
7079
- name: MSVC (windows)
7180
uses: ilammy/msvc-dev-cmd@v1
7281
if: contains(matrix.os, 'windows')
@@ -95,6 +104,8 @@ jobs:
95104
with:
96105
node-version: 22
97106
cache: "npm"
107+
- name: rust
108+
uses: dtolnay/rust-toolchain@stable
98109
- name: MSVC (windows)
99110
uses: ilammy/msvc-dev-cmd@v1
100111
if: contains(matrix.os, 'windows')

0 commit comments

Comments
 (0)