From 44b6541522cf0b2ba292540ed5b8f6a7a7809a85 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Fri, 4 Sep 2026 00:30:55 +0800 Subject: [PATCH] fix(ci): stop evaluating `pantry env`, which re-installs JS deps mid-job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `integration` kept failing at "Build TypeScript SDK" with error: Cannot find package 'typescript' from '…/packages/typescript/scripts' while `typescript-sdk` — same commit, same runner, same `bun run build`, same shim — passed. The difference is one step earlier: `integration` runs `eval "$(pantry env | sed -n '/^export /,$p')" && zig build`, and the log inside that step reads: + typescript@7.1.0-dev.20260708.3 + better-dx@0.2.20 Linked 11 workspace package(s) Installing JS deps via bun 683 packages installed ✗ Patch failed for ts-maps ⚡ pantry env activated → craft `pantry env` does not just print exports. It runs a workspace setup: it installs its own typescript and better-dx — neither the version the lockfile names — then runs its own `bun install` with an explicit `--linker` flag (`js_delegate.zig:208`), which overrides `bunfig.toml`'s `hoisted` and re-links the whole tree. The explicit install step had put 351 packages in place; this put 683, and root `node_modules/typescript` was gone. The eval contributed nothing a step used. `pantry env` exports only `PANTRY_*` variables (0.10.3 exports nothing at all), and no workflow reads them. `zig` was found because the pantry action already puts every installed bin on PATH — `packages/action/src/index.ts:852–912` — which is why `bun install` runs without any eval. zig-js's CI uses the same action and runs bare `zig build`. Removed from all 16 sites across five workflows. The Apple signing gate in release.yml is untouched; the only lines changed there are three build prefixes and one bare eval inside the cross-compile loop. This was also the origin of the `integration` break #104 set out to fix: the dev-build `tsc` that could not find its linux-x64 binary was the one `pantry env` had just installed and put on PATH. --- .github/CONTRIBUTING.md | 2 +- .github/workflows/benchmarks.yml | 2 +- .github/workflows/binary-size.yml | 4 ++-- .github/workflows/ci.yml | 10 +++++----- .github/workflows/mobile-e2e.yml | 8 ++++---- .github/workflows/release.yml | 7 +++---- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 22ce06a3..fc308fda 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,7 +6,7 @@ Thank you for your interest in contributing to Craft! This document provides gui ### Prerequisites -- **Pantry-managed stable Zig**: run `eval "$(pantry env | sed -n '/^export /,$p')"`, then invoke `zig` +- **Pantry-managed stable Zig**: run `eval "$(pantry env | sed -n '/^export /,$p')"`, then invoke `zig` (locally only — CI does not: the pantry action already puts `zig` on PATH, and `pantry env` runs a workspace setup that re-installs JS deps with its own `--linker`, rewriting `node_modules` mid-job) - **Bun**: Install from [bun.sh](https://bun.sh) #### Platform-specific Dependencies diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 5d1846b0..ca996420 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -82,7 +82,7 @@ jobs: - name: Build binary working-directory: packages/zig run: | - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseFast + zig build -Doptimize=ReleaseFast mkdir -p "$RUNNER_TEMP/bench" cp zig-out/bin/craft "$RUNNER_TEMP/bench/craft-head" diff --git a/.github/workflows/binary-size.yml b/.github/workflows/binary-size.yml index 73779e31..7ca5e32c 100644 --- a/.github/workflows/binary-size.yml +++ b/.github/workflows/binary-size.yml @@ -71,7 +71,7 @@ jobs: - name: Build release binary working-directory: packages/zig run: | - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe + zig build -Doptimize=ReleaseSafe - name: Measure binary size id: size @@ -123,7 +123,7 @@ jobs: git checkout origin/main -- packages/zig cd packages/zig - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe + zig build -Doptimize=ReleaseSafe if [ -f "zig-out/bin/craft" ]; then BASELINE=$(wc -c < "zig-out/bin/craft" | tr -d ' ') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d809eed5..d011bd2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64 - name: Verify Zig installation - run: eval "$(pantry env | sed -n '/^export /,$p')" && zig version + run: zig version - name: Cache Zig artifacts uses: actions/cache@v5 @@ -58,14 +58,14 @@ jobs: - name: Build Zig core working-directory: packages/zig - run: eval "$(pantry env | sed -n '/^export /,$p')" && zig build + run: zig build - name: First-party Zig dependencies uses: ./.github/actions/first-party-zig-deps - name: Test Zig core working-directory: packages/zig - run: eval "$(pantry env | sed -n '/^export /,$p')" && zig build test + run: zig build test - name: Check binary size if: runner.os == 'Linux' @@ -163,7 +163,7 @@ jobs: - name: Check Zig formatting working-directory: packages/zig - run: eval "$(pantry env | sed -n '/^export /,$p')" && zig fmt --check src/ build.zig + run: zig fmt --check src/ build.zig - name: Audit Zig C imports run: bun run verify:cimports @@ -194,7 +194,7 @@ jobs: - name: Build Zig core working-directory: packages/zig - run: eval "$(pantry env | sed -n '/^export /,$p')" && zig build + run: zig build - name: Build TypeScript SDK working-directory: packages/typescript diff --git a/.github/workflows/mobile-e2e.yml b/.github/workflows/mobile-e2e.yml index 09dc504b..deb967d0 100644 --- a/.github/workflows/mobile-e2e.yml +++ b/.github/workflows/mobile-e2e.yml @@ -74,7 +74,7 @@ jobs: run: | # Build iOS simulator static libraries using dedicated build step # (not the default target which builds macOS executables) - eval "$(pantry env | sed -n '/^export /,$p')" && zig build build-ios-simulator -Doptimize=ReleaseSafe -Dmacos-sdk="$(xcrun --sdk iphonesimulator --show-sdk-path)" + zig build build-ios-simulator -Doptimize=ReleaseSafe -Dmacos-sdk="$(xcrun --sdk iphonesimulator --show-sdk-path)" - name: First-party Zig dependencies uses: ./.github/actions/first-party-zig-deps @@ -85,7 +85,7 @@ jobs: # `zig build test` reports through its exit code. The old form piped # it to a file and grepped for "mobile"/"ios", which fails under # `set -e` whenever the run is clean and the file is therefore empty. - eval "$(pantry env | sed -n '/^export /,$p')" && zig build test + zig build test - name: Build iOS test app if: hashFiles('packages/ios/TestApp/TestApp.xcodeproj') != '' @@ -176,7 +176,7 @@ jobs: # builds the desktop binaries — and since an android triple reports # os_tag == .linux, that links GTK3/WebKit2GTK against a sysroot that # does not exist for Android. - eval "$(pantry env | sed -n '/^export /,$p')" && zig build build-android -Doptimize=ReleaseSafe + zig build build-android -Doptimize=ReleaseSafe - name: First-party Zig dependencies uses: ./.github/actions/first-party-zig-deps @@ -187,7 +187,7 @@ jobs: # `zig build test` reports through its exit code. The old form piped # it to a file and grepped for "mobile"/"android", which fails under # `set -e` whenever the run is clean and the file is therefore empty. - eval "$(pantry env | sed -n '/^export /,$p')" && zig build test + zig build test - name: Enable KVM run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06c7050f..7e3562d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,7 @@ jobs: mkdir -p zig-out/cross echo "::group::Cross-compile darwin-x64" - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget="$X64_TARGET" -Dmacos-sdk="$SDK_PATH" + zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget="$X64_TARGET" -Dmacos-sdk="$SDK_PATH" mkdir -p zig-out/cross/darwin-x64 && cp zig-out/bin/craft zig-out/cross/darwin-x64/craft echo "::endgroup::" @@ -87,7 +87,7 @@ jobs: # cross-compilation mode, where it stops looking for the system SDK # on its own and every `-framework Cocoa` fails to resolve. rm -rf zig-out/bin - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget="$ARM64_TARGET" -Dmacos-sdk="$SDK_PATH" + zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget="$ARM64_TARGET" -Dmacos-sdk="$SDK_PATH" # AppKit decides how it draws a window's controls from the SDK recorded # in LC_BUILD_VERSION, so that it can restyle them without restyling @@ -144,7 +144,6 @@ jobs: "x86_64-windows:windows-x64:craft.exe"; do IFS=: read -r zig_target dir_name bin_name <<< "$target_spec" echo "::group::Cross-compile $dir_name" - eval "$(pantry env | sed -n '/^export /,$p')" zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget="$zig_target" mkdir -p "zig-out/cross/$dir_name" && cp "zig-out/bin/$bin_name" "zig-out/cross/$dir_name/$bin_name" echo "Built $dir_name" @@ -157,7 +156,7 @@ jobs: # so craft-linux-x64.zip shipped a Windows PE binary alongside the # Linux one. rm -rf zig-out/bin - eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" + zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" # ── macOS Code Signing & Notarization ────────────────────────── # The signing credentials live encrypted in `.env.production`, not as