diff --git a/.github/workflows/bun-profile-tests.yml b/.github/workflows/bun-profile-tests.yml index 39eb8d42b7a..3b26806454f 100644 --- a/.github/workflows/bun-profile-tests.yml +++ b/.github/workflows/bun-profile-tests.yml @@ -25,6 +25,9 @@ on: type: boolean default: false +env: + ORCA_TEST_REQUIRE_ORCAD_ARTIFACTS: '1' + permissions: contents: read @@ -183,7 +186,7 @@ jobs: - name: Verify native Alpine artifact and persistence run: | docker run --rm --init -i \ - -e ORCA_BACKGROUND_LAUNCH=1 \ + -e ORCA_BACKGROUND_LAUNCH=1 -e ORCA_TEST_REQUIRE_ORCAD_ARTIFACTS=1 \ -v "$GITHUB_WORKSPACE:/work" -w /work \ node:24-alpine3.23 sh -s <<'BUN_QUALIFICATION' set -eu diff --git a/config/scripts/bundled-cli-runtime-fixture.mjs b/config/scripts/bundled-cli-runtime-fixture.mjs index af36933dc06..848199aa86c 100644 --- a/config/scripts/bundled-cli-runtime-fixture.mjs +++ b/config/scripts/bundled-cli-runtime-fixture.mjs @@ -6,10 +6,14 @@ import { copyFile, mkdir, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { cliRuntimeTarget, cliRuntimeFilename } from '../bundled-cli-runtime.cjs' -export async function writeBundledCliRuntimeFixture(directory, platform, arch) { - const bytes = 'runtime fixture' +export async function writeBundledCliRuntimeFixture( + directory, + platform, + arch, + bytes = 'runtime fixture' +) { await mkdir(directory, { recursive: true }) - await writeFile(join(directory, cliRuntimeFilename(platform)), bytes) + await writeFile(join(directory, cliRuntimeFilename(platform)), bytes, { mode: 0o755 }) await copyFile( join(import.meta.dirname, '../../resources/licenses/bun/LICENSE.md'), join(directory, 'LICENSE.md') diff --git a/config/scripts/electron-builder-runtime-resources.test.mjs b/config/scripts/electron-builder-runtime-resources.test.mjs index e5fa704aeec..b7a181dcb5e 100644 --- a/config/scripts/electron-builder-runtime-resources.test.mjs +++ b/config/scripts/electron-builder-runtime-resources.test.mjs @@ -466,14 +466,23 @@ describe('packaged runtime resources', () => { ) await writeFile(join(unpackedCliDir, 'cli-bin.js'), "require('./index.js')\n", 'utf8') await mkdir(join(resourcesDir, 'terminal-daemon'), { recursive: true }) - await writeFile(join(resourcesDir, 'terminal-daemon', 'daemon-entry.js'), '') - await writeBundledCliRuntimeFixture(join(resourcesDir, 'cli-runtime'), 'linux', 'x64') + await writeFile( + join(resourcesDir, 'terminal-daemon', 'daemon-entry.js'), + 'console.error("Usage: daemon-entry "); process.exit(1)\n' + ) + const quotedNode = `'${process.execPath.replaceAll("'", "'\\''")}'` + await writeBundledCliRuntimeFixture( + join(resourcesDir, 'cli-runtime'), + 'linux', + process.arch, + `#!/bin/sh\nexec ${quotedNode} "$@"\n` + ) await writeFile(launcherPath, '#!/usr/bin/env bash\n', { encoding: 'utf8', mode: 0o644 }) await electronBuilderConfig.afterPack({ appOutDir: join(root, 'linux-unpacked'), electronPlatformName: 'linux', - arch: 1, + arch: process.arch === 'arm64' ? 3 : 1, packager: { appInfo: { version: '9.9.9' } } }) diff --git a/config/scripts/orca-dev-bin.test.mjs b/config/scripts/orca-dev-bin.test.mjs index 5d7120f1cd5..abecdd3f27d 100644 --- a/config/scripts/orca-dev-bin.test.mjs +++ b/config/scripts/orca-dev-bin.test.mjs @@ -14,16 +14,21 @@ describe('orca-dev package bin', () => { expect(readFileSync(wrapperPath, 'utf8')).toMatch(/^#!\/usr\/bin\/env node\n/) }) + const launcherBuilt = existsSync(path.join(projectDir, 'out', 'cli', 'cli-bun-launcher.js')) + const required = process.env.ORCA_TEST_REQUIRE_CLI_ARTIFACTS === '1' + it.skipIf( - !existsSync( - path.join( - projectDir, - 'out', - 'cli-runtime', - `${process.platform}-${process.arch}`, - process.platform === 'win32' ? 'bun-runtime.exe' : 'bun-runtime' - ) - ) + !required && + (!launcherBuilt || + !existsSync( + path.join( + projectDir, + 'out', + 'cli-runtime', + `${process.platform}-${process.arch}`, + process.platform === 'win32' ? 'bun-runtime.exe' : 'bun-runtime' + ) + )) )('hands the dev CLI to staged Bun without requiring Bash', () => { const root = mkdtempSync(path.join(tmpdir(), 'orca-dev-bin-')) const cliEntry = path.join(root, 'cli-entry.cjs') diff --git a/config/scripts/orcad-companion-artifacts.test.mjs b/config/scripts/orcad-companion-artifacts.test.mjs index aec23038886..d00348d80c3 100644 --- a/config/scripts/orcad-companion-artifacts.test.mjs +++ b/config/scripts/orcad-companion-artifacts.test.mjs @@ -19,7 +19,10 @@ const entries = [ 'port-scan-command-worker-entry.js' ] -describe.skipIf(!existsSync(runtime))('packaged orcad companion processes', () => { +const built = existsSync(join(directory, '.version')) +const required = process.env.ORCA_TEST_REQUIRE_ORCAD_ARTIFACTS === '1' + +describe.skipIf(!built && !required)('packaged orcad companion processes', () => { it('reads a transcript and executes a probe without checkout dependencies', async () => { const root = await mkdtemp(join(tmpdir(), 'orca companion artifacts ')) try { diff --git a/config/scripts/run-bundled-runtime-tests.mjs b/config/scripts/run-bundled-runtime-tests.mjs index 9b91d69cd57..772cf503d0d 100644 --- a/config/scripts/run-bundled-runtime-tests.mjs +++ b/config/scripts/run-bundled-runtime-tests.mjs @@ -13,7 +13,12 @@ const runtime = join( `${process.platform}-${process.arch}`, cliRuntimeFilename(process.platform) ) -const env = { ...process.env, ORCA_BACKGROUND_LAUNCH: '1', BUN_EXECUTABLE: runtime } +const env = { + ...process.env, + ORCA_BACKGROUND_LAUNCH: '1', + BUN_EXECUTABLE: runtime, + ORCA_TEST_REQUIRE_CLI_ARTIFACTS: '1' +} function run(args, environment = env) { const result = runProcessSync({ program: process.execPath,