Separate staged runtime tests from built artifact qualification

This commit is contained in:
m4air
2026-09-28 05:55:55 -07:00
parent 403fec69de
commit 65f71dbcd9
6 changed files with 47 additions and 18 deletions
+4 -1
View File
@@ -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
@@ -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')
@@ -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 <socket>"); 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' } }
})
+14 -9
View File
@@ -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')
@@ -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 {
+6 -1
View File
@@ -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,