mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 08:02:21 +00:00
Separate staged runtime tests from built artifact qualification
This commit is contained in:
@@ -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,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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user