ci(fuzz): discover fuzz targets dynamically#1290
Merged
Merged
Conversation
Mirror the `check features` pattern: expose `cargo xtask fuzz list` (with `--format github-matrix`) that enumerates fuzz targets by scanning `fuzz/fuzz_targets/*.rs`, and have the fuzz workflow build its matrix from that output. New targets dropped into the directory are picked up by CI automatically, with no workflow edits required.
There was a problem hiding this comment.
Pull request overview
This PR updates the xtask fuzz tooling and CI workflow so fuzz targets are discovered dynamically by scanning fuzz/fuzz_targets/*.rs, allowing the GitHub Actions fuzz job matrix to be generated automatically without hardcoding target names in the workflow.
Changes:
- Removed the hardcoded
FUZZ_TARGETSlist and replaced it with filesystem-based discovery (discover_targets). - Added
cargo xtask fuzz list(supports--format humanand--format github-matrix) to expose discovered targets for local use and CI. - Updated the fuzz GitHub Actions workflow to build its job matrix from
cargo xtask fuzz list --format github-matrix.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
xtask/src/prelude.rs |
Removes re-export of the removed FUZZ_TARGETS constant. |
xtask/src/main.rs |
Drops FUZZ_TARGETS, switches to typed ListFormat, and wires up fuzz list. |
xtask/src/fuzz.rs |
Implements dynamic fuzz target discovery and emits GitHub matrix JSON. |
xtask/src/cov.rs |
Uses dynamic fuzz target discovery when generating fuzz coverage. |
xtask/src/cli.rs |
Adds fuzz list subcommand and introduces ListFormat parsing/defaulting. |
.github/workflows/fuzz.yml |
Adds a setup job to generate the fuzz matrix dynamically and uses matrix.include. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
May 20, 2026
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror the
check featurespattern: exposecargo xtask fuzz list(with--format github-matrix) that enumerates fuzz targets by scanningfuzz/fuzz_targets/*.rs, and have the fuzz workflow build its matrix from that output. New targets dropped into the directory are picked up by CI automatically, with no workflow edits required.