Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ build:macos --macos_minimum_os=10.15
# bazel run //bazel:setup_configs > fuzztest.bazelrc
#
try-import %workspace%/fuzztest.bazelrc

# Configure rules_rust to use the nightly channel toolchain by default.
build --@rules_rust//rust/toolchain/channel:channel=nightly
81 changes: 81 additions & 0 deletions .github/workflows/cargo_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Cargo Test

on:
push:
branches:
- main
pull_request:
schedule:
# Triggered nightly at 8:00 AM UTC to reset the Bazel & Cargo caches.
- cron: '0 8 * * *'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

permissions:
contents: read

jobs:
run_cargo_tests:
name: Run Cargo tests
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Disable core dumping and piping due to slowness
run: |
sudo sysctl -w kernel.core_pattern=""

- name: Checkout repository
uses: actions/checkout@v4

Check failure on line 44 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 44 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

cargo_test.yml:44: unpinned action reference: action is not pinned to a hash (required by blanket policy)

- name: Install system dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
clang

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

Check failure on line 52 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 52 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

cargo_test.yml:52: unpinned action reference: action is not pinned to a hash (required by blanket policy)
with:
toolchain: nightly

- name: Restore Bazel cache
uses: actions/cache/restore@v4

Check failure on line 57 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 57 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

cargo_test.yml:57: unpinned action reference: action is not pinned to a hash (required by blanket policy)
with:
path: "~/.cache/bazel"
key: bazel-centipede-cache-cargo-test-${{ github.run_id }}
restore-keys: |
bazel-centipede-cache-cargo-test-
bazel-centipede-cache-default-

- name: Build Centipede static library and binary with Bazel
run: |
bazel build -c opt //centipede:centipede_engine_static //centipede:centipede

- name: Run Cargo workspace tests
env:
FUZZTEST_LIB_PATH: ${{ github.workspace }}/bazel-bin/centipede
CENTIPEDE_BINARY_PATH: ${{ github.workspace }}/bazel-bin/centipede/centipede
run: |
cargo test --locked --workspace --no-fail-fast -- --test-threads=1

- name: Save Bazel cache based on main
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4

Check failure on line 78 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 78 in .github/workflows/cargo_test.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

cargo_test.yml:78: unpinned action reference: action is not pinned to a hash (required by blanket policy)
with:
path: "~/.cache/bazel"
key: bazel-centipede-cache-cargo-test-${{ github.run_id }}
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports_files(["MODULE.bazel"])
Loading
Loading