From 2f746bd55ff9ff6210f2e74f00d234703f46b71d Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 14:58:17 -0800 Subject: [PATCH 1/8] chore: replace pnpm with bun for performance test. --- .github/workflows/presubmit.yaml | 4 +--- .github/workflows/windows-presubmit.yaml | 4 +--- ci/run_single_test.sh | 16 +++++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/presubmit.yaml b/.github/workflows/presubmit.yaml index 9c37deef21d..a908025cdc5 100644 --- a/.github/workflows/presubmit.yaml +++ b/.github/workflows/presubmit.yaml @@ -15,9 +15,7 @@ jobs: uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v4 - with: - version: ^10.0.0 + - uses: oven-sh/setup-bun@v2 - run: node --version - run: ci/run_conditional_tests.sh name: Run unit tests diff --git a/.github/workflows/windows-presubmit.yaml b/.github/workflows/windows-presubmit.yaml index 624c0f32a7c..24de01bf176 100644 --- a/.github/workflows/windows-presubmit.yaml +++ b/.github/workflows/windows-presubmit.yaml @@ -15,9 +15,7 @@ jobs: uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v4 - with: - version: ^10.0.0 + - uses: oven-sh/setup-bun@v2 - run: node --version - run: bash ci/run_conditional_tests.sh name: Run windows unit tests diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 31ce0206111..72c3a714e3c 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -40,29 +40,31 @@ if [ ${BUILD_TYPE} != "presubmit" ]; then fi # Install dependencies -echo "pnpm install --ignore-scripts --engine-strict --prod; pnpm install" -pnpm install --ignore-scripts --engine-strict --prod; pnpm install +echo "bun install --ignore-scripts --prod; bun install" +bun install --ignore-scripts --prod; bun install retval=0 +# We use `npm run` here so that the test run respects the Node version +# configured for this test run. set +e case ${TEST_TYPE} in lint) - pnpm prelint - pnpm lint + npm run prelint + npm run lint retval=$? ;; samples) - pnpm samples-test + npm run samples-test retval=$? ;; system) - pnpm system-test + npm run system-test retval=$? ;; units) - pnpm test + npm run test retval=$? ;; *) From 65cd11f7b49860a1ca70b25296fb5ffafc1f85c0 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 15:49:38 -0800 Subject: [PATCH 2/8] chore: specific git bash as windows unit test shell for compatibility --- .github/workflows/windows-presubmit.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-presubmit.yaml b/.github/workflows/windows-presubmit.yaml index 24de01bf176..7c8dc468bde 100644 --- a/.github/workflows/windows-presubmit.yaml +++ b/.github/workflows/windows-presubmit.yaml @@ -23,3 +23,4 @@ jobs: env: BUILD_TYPE: presubmit TEST_TYPE: units + SHELL: C:\Program Files\Git\bin\bash.exe From 36aa158826a2c7d1da3fe4656b1ef979e8739845 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 16:14:14 -0800 Subject: [PATCH 3/8] chore: add bun install filter to prevent root package inspection --- ci/run_single_test.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 72c3a714e3c..3ba06ee8f94 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -40,8 +40,13 @@ if [ ${BUILD_TYPE} != "presubmit" ]; then fi # Install dependencies -echo "bun install --ignore-scripts --prod; bun install" -bun install --ignore-scripts --prod; bun install +# +# The filter is needed to prevent bun from installing all packages in the repo +# from the root. By default it prefers to analyze, install, and at the root +# so dependencies can be deduplicated. We will try that in a separate PR for +# comparison. +echo "bun install --ignore-scripts --prod --filter .; bun install --filter ." +bun install --ignore-scripts --prod --filter . ; bun install --filter . retval=0 From ccf078baecc6d8bf23ba0d0a8f244775d8eccf89 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 16:30:53 -0800 Subject: [PATCH 4/8] chore: create an optimized bun install prototype --- ci/run_conditional_tests.sh | 4 ++++ ci/run_single_test.sh | 13 ++++++------- package.json | 6 +++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ci/run_conditional_tests.sh b/ci/run_conditional_tests.sh index 573a74e2c04..4862dcf3a02 100755 --- a/ci/run_conditional_tests.sh +++ b/ci/run_conditional_tests.sh @@ -30,6 +30,10 @@ fi # A script file for running the test in a sub project. test_script="${PROJECT_ROOT}/ci/run_single_test.sh" +# Install all dependencies globally to give Bun the opportunity to deduplicate +# dependencies. +bun install --ignore-scripts + if [ ${BUILD_TYPE} == "presubmit" ]; then # For presubmit build, we want to know the difference from the diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 3ba06ee8f94..0ae73323505 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -39,14 +39,13 @@ if [ ${BUILD_TYPE} != "presubmit" ]; then export MOCHA_REPORTER=xunit fi -# Install dependencies +# Run install one more time (without --ignore-scripts) to handle per-package +# post install scripts. Bun will check the lock file and see nothing needs +# to be updated, meaning this adds very little overhead. # -# The filter is needed to prevent bun from installing all packages in the repo -# from the root. By default it prefers to analyze, install, and at the root -# so dependencies can be deduplicated. We will try that in a separate PR for -# comparison. -echo "bun install --ignore-scripts --prod --filter .; bun install --filter ." -bun install --ignore-scripts --prod --filter . ; bun install --filter . +# The filter is required to limit this action to just the current package. +echo "bun install --filter ." +bun install --filter . retval=0 diff --git a/package.json b/package.json index 9fe35bf5b43..9683dec83d8 100644 --- a/package.json +++ b/package.json @@ -44,5 +44,9 @@ }, "engines": { "node": ">=18" - } + }, + "workspaces": [ + "packages", + "handwritten" + ] } \ No newline at end of file From 5a53f2b8af066debb02925745548b67178345f34 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 16:38:58 -0800 Subject: [PATCH 5/8] chore: fix windows presubmits by forcing npm to use git bash as the shell --- .github/workflows/windows-presubmit.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-presubmit.yaml b/.github/workflows/windows-presubmit.yaml index 7c8dc468bde..a24c82a14e7 100644 --- a/.github/workflows/windows-presubmit.yaml +++ b/.github/workflows/windows-presubmit.yaml @@ -24,3 +24,4 @@ jobs: BUILD_TYPE: presubmit TEST_TYPE: units SHELL: C:\Program Files\Git\bin\bash.exe + npm_config_script_shell: bash From c367ed956a0e6240ba5666dc9290f8fe025d5d49 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 16:45:52 -0800 Subject: [PATCH 6/8] chore: fix workspace configuration --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9683dec83d8..c8f9b0c591b 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "node": ">=18" }, "workspaces": [ - "packages", - "handwritten" + "packages/*", + "handwritten/*", + ".github/scripts/*" ] } \ No newline at end of file From c622950bd38ddac7d3c955833a9519abae331024 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 17:00:04 -0800 Subject: [PATCH 7/8] chore: freeze lock file on secondary install to avoid uncessary computation --- ci/run_single_test.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 0ae73323505..7ec5fa9b00b 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -44,9 +44,8 @@ fi # to be updated, meaning this adds very little overhead. # # The filter is required to limit this action to just the current package. -echo "bun install --filter ." -bun install --filter . - +echo "bun install --frozen-lockfile --filter ." +bun install --frozen-lockfile --filter . retval=0 From 22288ec96ef30fa6b37ba333d6a3f38da6880ea1 Mon Sep 17 00:00:00 2001 From: Gabe Pearhill Date: Fri, 6 Mar 2026 20:08:58 -0800 Subject: [PATCH 8/8] chore: update run_single_test.sh to run postinstall "prepare" script directly --- ci/run_single_test.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 7ec5fa9b00b..10c66258930 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -39,13 +39,11 @@ if [ ${BUILD_TYPE} != "presubmit" ]; then export MOCHA_REPORTER=xunit fi -# Run install one more time (without --ignore-scripts) to handle per-package -# post install scripts. Bun will check the lock file and see nothing needs -# to be updated, meaning this adds very little overhead. -# -# The filter is required to limit this action to just the current package. -echo "bun install --frozen-lockfile --filter ." -bun install --frozen-lockfile --filter . +# Run post install scripts. +# Of the available post-install scripts, our repo only uses "prepare". +echo "run post install scripts . . ." +# Run script only if its defined. +jq -e '.scripts.prepare' package.json > /dev/null && npm run prepare retval=0