Skip to content

fix(ci): per-PR cargo-test link-OOM — serialize fast-path links + skip zero-unit-test crates#5413

Merged
proggeramlug merged 1 commit into
mainfrom
fix/fast-test-link-oom
Jun 18, 2026
Merged

fix(ci): per-PR cargo-test link-OOM — serialize fast-path links + skip zero-unit-test crates#5413
proggeramlug merged 1 commit into
mainfrom
fix/fast-test-link-oom

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Hotfix for #5411's fast per-PR path. It built every affected crate's unit-test binary in one unbounded-parallel cargo test --lib --bins -p ... invocation; each statically links the whole runtime, so a wide diff (a perry-runtime change → ~50 crates) linked ~50 huge binaries at once and the runner OOMed (linking with cc failed) — exactly what the FULL path avoids via CARGO_BUILD_JOBS=1. Surfaced on #5402.

  • Fast path now sets CARGO_BUILD_JOBS=1 (serialize the heavy links, no OOM) and filters scope through ci_test_scope.py --with-tests (drops crates with no src/ unit tests — ~13 zero-test FFI shims in the wide case).
  • New --with-tests mode validated locally; serial unit-only run for the wide perry-runtime fan-out = 37 test-bearing crates.

Validated locally: scope/has-lib/with-tests modes, and the per-crate unit tests pass (perry/perry-hir/perry-codegen/perry-runtime). The OOM was parallel-only; serial links each succeed.

Summary by CodeRabbit

  • Chores
    • Version bumped to 0.5.1186
    • Optimized continuous integration workflow to prevent out-of-memory errors during per-PR test runs by serializing build steps and focusing tests only on crates with unit tests

…p zero-unit-test crates

The #5411 fast per-PR path built every affected crate's unit-test binary in one
unbounded-parallel invocation. Each links the whole runtime statically, so a
wide diff (~50 crates for a perry-runtime change) OOMed the runner at link
('linking with cc failed') — the failure the FULL path avoids via
CARGO_BUILD_JOBS=1. Surfaced on #5402.

Fast path now: CARGO_BUILD_JOBS=1 (serialize heavy links) + filter scope through
ci_test_scope.py --with-tests (drop crates with no src/ unit tests, whose lib
test binary links the runtime for zero tests).
@proggeramlug proggeramlug merged commit 72c9618 into main Jun 18, 2026
13 of 15 checks passed
@proggeramlug proggeramlug deleted the fix/fast-test-link-oom branch June 18, 2026 16:52
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bae4f08-fe56-4a34-a6b7-d4079d1ae64b

📥 Commits

Reviewing files that changed from the base of the PR and between 22d18d2 and c51a385.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/test.yml
  • CHANGELOG.md
  • CLAUDE.md
  • Cargo.toml
  • scripts/ci_test_scope.py

📝 Walkthrough

Walkthrough

Adds a --with-tests mode to scripts/ci_test_scope.py that scans each candidate crate's src/ directory for #[test]/#[tokio::test] attributes and prints only matching crates. The GitHub Actions cargo-test per-PR fast path is updated to use this filter and sets CARGO_BUILD_JOBS=1 to serialize link steps. Workspace version is bumped to 0.5.1186.

Changes

CI Test Scope Filter and Workflow Serialization

Layer / File(s) Summary
ci_test_scope.py --with-tests implementation
scripts/ci_test_scope.py
Adds os and re imports, compiles _TEST_ATTR regex for #[test]/#[tokio::test], implements _with_tests_mode() that loads Cargo metadata and walks each crate's src/ tree printing only crates with matching source files, and extends main() to dispatch on --with-tests.
Workflow fast-path update
.github/workflows/test.yml
Sets CARGO_BUILD_JOBS=1 on the per-PR fast path to serialize linking, replaces the prior grep-only crate selection with a ci_test_scope.py --with-tests pipe, and updates surrounding comments to reflect the narrowed scope.
Version bump and changelog
Cargo.toml, CLAUDE.md, CHANGELOG.md
Increments workspace package version to 0.5.1186, updates CLAUDE.md current-version metadata, and adds a CHANGELOG.md entry documenting the CARGO_BUILD_JOBS=1 and --with-tests CI changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PerryTS/perry#5411: Modifies the same .github/workflows/test.yml and scripts/ci_test_scope.py files to introduce the change-based per-PR scoping mechanism that this PR extends with the --with-tests unit-test-only filter.

Poem

🐇 Hoppity-hop through the crate garden bright,
I sniff out the #[test]s hidden from sight,
No integration tests fooling my nose —
Only src/ unit tests get to compile, goodness knows!
CARGO_BUILD_JOBS=1 keeps the linker in line,
OOM be gone — this CI path is fine! 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fast-test-link-oom

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant