Skip to content

Fuzzing

Fuzzing #98

Workflow file for this run

name: Fuzzing
on:
workflow_dispatch:
schedule:
# Weekly on Sunday
- cron: "0 0 * * 0"
permissions:
contents: read
jobs:
should-run:
runs-on: ubuntu-latest
outputs:
no-changes: ${{ steps.check-commits.outputs.no-changes }}
steps:
- uses: actions/checkout@v4
- name: Get latest workflow run
id: latest-run
run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
${{ github.api_url }}/repos/${{ github.repository }}/actions/workflows \
-o workflows.json
WORKFLOW_ID=$(jq '.workflows[] | select( .name | contains("${{ github.workflow }}")) | .id' workflows.json)
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
${{ github.api_url }}/repos/${{ github.repository }}/actions/workflows/${WORKFLOW_ID}/runs \
-o runs.json
# workflow_runs[0] is the current run
echo "datetime=$(jq -r '.workflow_runs[1].created_at' runs.json)" >> "$GITHUB_OUTPUT"
- name: Detect commits since last workflow run
id: check-commits
run: |
COMMITS=$(git log --since="${{ steps.latest-run.outputs.datetime }}" --oneline)
if [ -z "$COMMITS" ]; then
echo "no-changes=true" >> "$GITHUB_OUTPUT"
fi
fuzz:
name: Fuzz
runs-on: ubuntu-latest
needs: should-run
if: needs.should-run.outputs.no-changes != 'true'
strategy:
fail-fast: false
matrix:
target:
- adj_list_undirected
- adj_list_directed
- adj_matrix_undirected
- adj_matrix_directed
- edge_list_undirected
- edge_list_directed
- stable_undirected
- stable_directed
- storages_isomorphic_undirected
- storages_isomorphic_directed
defaults:
run:
working-directory: fuzz
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
workspaces: fuzz
key: ${{ matrix.target }}
- run: cargo install cargo-fuzz
- name: cargo fuzz run
run: |
cargo fuzz build
timeout 5m cargo fuzz run ${{ matrix.target }} || EXIT_CODE=$?
test $EXIT_CODE -eq 124 # 124 indicates cancellation