Skip to content
Merged
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
34 changes: 19 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,16 @@ jobs:
# via the `run-extended-tests` label. No staticlib dependency to
# build (no integration tests).
#
# Each crate's test binary statically links the whole runtime, so
# building many at once OOMs the runner (same reason the FULL path
# uses CARGO_BUILD_JOBS=1). Serialize here too, and drop crates with
# no `src/` unit tests (their lib test binary has zero tests yet
# still pays the heavy link).
# Run each crate in its OWN `cargo test` invocation — NOT one
# multi-package invocation. Building several crates together unifies
# perry-runtime's cargo features, which turns on optional impls (e.g.
# `fetch`) whose extern symbols (`js_fetch_with_options`) live in a
# separate crate the other test binaries don't link → `undefined
# reference` at link. Per-package builds keep each crate's
# perry-runtime feature set isolated. CARGO_BUILD_JOBS=1 also bounds
# the heavy per-binary runtime link so the runner doesn't OOM.
# `--with-tests` drops crates whose `src/` has no unit tests (their
# lib test binary would link the runtime for zero tests).
export CARGO_BUILD_JOBS=1
# perry-runtime first, single-threaded (process-global state); it is
# a lib-only crate, so filter to --lib.
Expand All @@ -385,20 +390,19 @@ jobs:
rest="$(printf '%s\n' "$scope" | grep -vx 'perry-runtime' \
| python3 scripts/ci_test_scope.py --with-tests || true)"
echo "Crates with unit tests in scope:"; printf '%s\n' "$rest"
if [ -n "$rest" ]; then
# One invocation across the rest of the scope. `cargo test --lib`
# errors if NO selected package has a library (a perry-only diff →
# just the bin-only `perry` crate), so include --lib only when some
# selected crate has one; --bins is always safe.
pkg_args="$(printf '%s\n' "$rest" | sed 's/^/-p /' | tr '\n' ' ')"
if printf '%s\n' "$rest" | python3 scripts/ci_test_scope.py --has-lib; then
for package in $rest; do
# `cargo test --lib` errors on a bin-only crate (perry), so pick
# the target filter per package: --lib --bins when it has a lib
# (lenient if it has no bins), else --bins.
if printf '%s\n' "$package" | python3 scripts/ci_test_scope.py --has-lib; then
target_filter="--lib --bins"
else
target_filter="--bins"
fi
echo "Running: cargo test $target_filter $pkg_args"
cargo test $target_filter $pkg_args
fi
echo "::group::cargo test $target_filter -p $package"
cargo test $target_filter -p "$package"
echo "::endgroup::"
done
fi

# ---------------------------------------------------------------------------
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## v0.5.1187 — fix(ci): per-PR cargo-test — per-package runs + don't fan into FFI shims (feature-unification link errors)

Follow-up to #5411/#5413. Two more issues made the fast per-PR path fail on
foundational diffs (#5402):

1. **Feature-unification link errors.** Testing several crates in ONE
`cargo test --lib --bins -p A -p B ...` invocation unifies perry-runtime's
cargo features across them. A crate that enables an optional impl (e.g.
`fetch`) turns on perry-runtime's reference to `js_fetch_with_options`, whose
definition lives in a *separate* crate (perry-ext-fetch / perry-stdlib) that
the other test binaries don't link → `undefined reference` at link. Fix: run
**each crate in its own `cargo test` invocation** so feature sets stay isolated
(mirrors how the pre-#5411 job looped per-package).
2. **Over-broad fan-out.** A perry-runtime change reverse-dep-closured into ~40
FFI-shim crates (`perry-ext-*`, perry-stdlib), each triggering a perry-runtime
feature rebuild. Those crates' UNIT tests are self-contained pure-Rust logic
that don't exercise runtime internals (the nightly full run + perry's
integration tests cover that interaction). Fix: `ci_test_scope.py` no longer
fans *into* `perry-ext-*` / perry-stdlib (`_is_fanout_leaf`); a direct change
to one still selects it. A perry-runtime change now selects 4 crates (perry,
perry-ffi, perry-runtime, perry-updater) instead of ~50.

Net: per-PR cargo-test on a perry-runtime/codegen/hir change runs ~12 core-crate
unit-test suites per-package, validated locally green in ~2 min warm.

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

The #5411 fast per-PR path built every affected crate's unit-test binary in one
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

Perry is a native TypeScript compiler written in Rust that compiles TypeScript source code directly to native executables. It uses SWC for TypeScript parsing and LLVM for code generation.

**Current Version:** 0.5.1186
**Current Version:** 0.5.1187


## TypeScript Parity Status
Expand Down
Loading
Loading