From d72b199645ead66781f886e48c052423b4f70d11 Mon Sep 17 00:00:00 2001 From: CRT Date: Thu, 15 Oct 2026 06:33:01 +0800 Subject: [PATCH] ci: the acceptance jobs run bun install before packing (prepack builds the package's declarations with the pinned TypeScript; without node_modules npm pack failed and every acceptance cell went red on 5ed787a); build-node names the missing install instead of a bare ENOENT --- .forgejo/workflows/acceptance.yml | 3 +++ .forgejo/workflows/ci.yml | 5 +++++ tools/build-node.ts | 1 + 3 files changed, 9 insertions(+) diff --git a/.forgejo/workflows/acceptance.yml b/.forgejo/workflows/acceptance.yml index 73e0d32..cc5cbb2 100644 --- a/.forgejo/workflows/acceptance.yml +++ b/.forgejo/workflows/acceptance.yml @@ -40,12 +40,15 @@ jobs: shell: bash run: | node --version && bun --version + bun install --frozen-lockfile bun tools/acceptance.ts run --runtime ${{ matrix.runtime }} --platform Linux --jobs 4 --out acceptance/Linux-${{ matrix.name }}.json - name: Acceptance matrix (Windows) if: ${{ matrix.platform == 'Windows' }} shell: pwsh run: | node --version; bun --version + bun install --frozen-lockfile + if ($LASTEXITCODE -ne 0) { throw "bun install failed" } bun tools/acceptance.ts run --runtime ${{ matrix.runtime }} --platform Windows --jobs 3 --out acceptance/Windows-${{ matrix.name }}.json if ($LASTEXITCODE -ne 0) { throw "acceptance matrix: red cells" } - uses: actions/upload-artifact@v3 diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 71bbfd7..e37e533 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -106,12 +106,17 @@ jobs: shell: bash run: | node --version && bun --version + # npm pack runs prepack, which builds the package's declarations with the pinned TypeScript + bun install --frozen-lockfile bun tools/acceptance.ts run --runtime ${{ matrix.runtime }} --platform Linux --jobs 4 --out acceptance/Linux-${{ matrix.name }}.json - name: Acceptance matrix (Windows) if: ${{ matrix.platform == 'Windows' }} shell: pwsh run: | node --version; bun --version + # npm pack runs prepack, which builds the package's declarations with the pinned TypeScript + bun install --frozen-lockfile + if ($LASTEXITCODE -ne 0) { throw "bun install failed" } bun tools/acceptance.ts run --runtime ${{ matrix.runtime }} --platform Windows --jobs 3 --out acceptance/Windows-${{ matrix.name }}.json if ($LASTEXITCODE -ne 0) { throw "acceptance matrix: red cells" } - uses: actions/upload-artifact@v3 diff --git a/tools/build-node.ts b/tools/build-node.ts index 996e32f..586d863 100644 --- a/tools/build-node.ts +++ b/tools/build-node.ts @@ -41,6 +41,7 @@ export function buildNode(out = NODE_BUNDLE): { path: string; bytes: number } { export function buildEntry(dir = join(ROOT, 'dist')): void { const types = join(dir, 'types'); rmSync(types, { recursive: true, force: true }); + if (!statSync(join(ROOT, 'node_modules', '.bin', 'tsc'), { throwIfNoEntry: false })) throw new Error('no TypeScript in node_modules: run `bun install` first (npm pack builds the declarations with it)'); const tsc = Bun.spawnSync([join(ROOT, 'node_modules', '.bin', 'tsc'), '-p', 'tsconfig.types.json', '--outDir', types], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' }); if (tsc.exitCode !== 0) throw new Error(`tsc (declarations) failed\n${tsc.stdout.toString()}${tsc.stderr.toString()}`); if (!statSync(join(types, 'lib', 'config.d.ts'), { throwIfNoEntry: false })) throw new Error('no dist/types/lib/config.d.ts');