Skip to content

ci: add affected-crate detection to skip unchanged tests#14106

Closed
Rani367 wants to merge 1 commit intofoundry-rs:masterfrom
Rani367:ci/affected-test
Closed

ci: add affected-crate detection to skip unchanged tests#14106
Rani367 wants to merge 1 commit intofoundry-rs:masterfrom
Rani367:ci/affected-test

Conversation

@Rani367
Copy link
Copy Markdown

@Rani367 Rani367 commented Apr 2, 2026

Problem

This repo has 36 crates in its Cargo workspace. The current CI uses a custom matrices.py to partition tests, but it doesn't filter which crates need testing based on what changed.

I analyzed the last 15 commits on master:

Commit Message Affected Total Reduction
e2b2529 feat(evm): make Executor generic 9 36 75%
f4a6885 clippy: warn on redundant_else 25 36 31%
179b8f7 feat(evm): add Tempo precompile 29 36 19%

Example — an EVM change affects 9 of 36 crates with full dependency chains:

9 affected package(s) (base: HEAD~1, 1 files changed):

  ● foundry-evm      (directly changed)
  ● forge             (depends on: forge → foundry-evm)
  ● anvil             (depends on: anvil → foundry-evm)
  ● cast              (depends on: cast → foundry-evm)
  ...
  (27 crates NOT affected)

What this PR adds

  • .affected.toml — config file (ignores docs/markdown/CI/testdata files)
  • .github/workflows/affected-test.yml — experimental workflow that:
    1. Detects affected crates via affected ci
    2. Creates a dynamic GitHub Actions matrix
    3. Runs cargo nextest run -p <crate> per affected crate

This complements matrices.py by narrowing which crates enter the matrix, rather than partitioning all 36.

This runs alongside existing CI — it does NOT replace anything.

What affected is

affected — single 5MB Rust binary, zero config, MIT licensed. Auto-detects Cargo workspaces. Has a GitHub Action and PR comment bot.

Add affected CLI integration to detect which crates are impacted by a
PR and run tests only for those crates. This runs alongside existing CI
workflows without replacing them.
@Rani367 Rani367 force-pushed the ci/affected-test branch from 6e504b2 to daf70fb Compare April 2, 2026 23:39
@zerosnacks
Copy link
Copy Markdown
Member

Thanks for your suggestion, I'll reconsider this but for now decided against it.

@zerosnacks zerosnacks closed this Apr 3, 2026
@github-project-automation github-project-automation Bot moved this to Done in Foundry Apr 3, 2026
@Rani367
Copy link
Copy Markdown
Author

Rani367 commented Apr 4, 2026

No worries, thanks for considering it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants