refactor: remove --compile-only flag, consolidate into --ci (#646)

The --compile-only and --ci flags served overlapping purposes for CI
builds. Remove --compile-only entirely since --ci already handles the
CI use case (skip R2, skip prod env validation, local zip packaging)
and --no-upload covers the upload-skipping use case for full builds.
This commit is contained in:
Nikhil
2026-04-03 14:58:52 -07:00
committed by GitHub
parent ff5386a24a
commit 91be726381
5 changed files with 6 additions and 54 deletions

View File

@@ -156,28 +156,6 @@ describe('server build', () => {
assert.strictEqual(versionOutput.trim(), expectedVersion) assert.strictEqual(versionOutput.trim(), expectedVersion)
}, 300_000) }, 300_000)
it('keeps compile-only on the strict production validation path', async () => {
resetProdEnvToTemplate()
const build = Bun.spawn(
['bun', buildScript, `--target=${target.id}`, '--compile-only'],
{
cwd: rootDir,
stdout: 'pipe',
stderr: 'pipe',
env: buildEnv({}, PROD_SECRET_KEYS),
},
)
const buildExit = await build.exited
const stderr = await new Response(build.stderr).text()
assert.notStrictEqual(buildExit, 0, 'Compile-only build should fail')
assert.match(stderr, /Production build requires variables:/)
assert.match(stderr, /CODEGEN_SERVICE_URL/)
assert.match(stderr, /POSTHOG_API_KEY/)
assert.match(stderr, /SENTRY_DSN/)
}, 300_000)
it('archives CI builds without R2 config or production env secrets', async () => { it('archives CI builds without R2 config or production env secrets', async () => {
resetProdEnvToTemplate() resetProdEnvToTemplate()
rmSync(zipPath, { force: true }) rmSync(zipPath, { force: true })

View File

@@ -21,10 +21,6 @@ export function parseBuildArgs(argv: string[]): BuildArgs {
) )
.option('--upload', 'Upload artifact zips to R2') .option('--upload', 'Upload artifact zips to R2')
.option('--no-upload', 'Skip zip upload to R2') .option('--no-upload', 'Skip zip upload to R2')
.option(
'--compile-only',
'Compile binaries only (skip artifact packaging, R2 staging, and upload)',
)
.option( .option(
'--ci', '--ci',
'Build local release zip artifacts for CI without R2 and without requiring production env secrets', 'Build local release zip artifacts for CI without R2 and without requiring production env secrets',
@@ -34,15 +30,10 @@ export function parseBuildArgs(argv: string[]): BuildArgs {
target: string target: string
manifest: string manifest: string
upload: boolean upload: boolean
compileOnly: boolean
ci: boolean ci: boolean
}>() }>()
const compileOnly = options.compileOnly ?? false
const ci = options.ci ?? false const ci = options.ci ?? false
if (ci && compileOnly) {
throw new Error('--ci cannot be combined with --compile-only')
}
if (ci && options.upload) { if (ci && options.upload) {
throw new Error('--ci cannot be combined with --upload') throw new Error('--ci cannot be combined with --upload')
} }
@@ -50,8 +41,7 @@ export function parseBuildArgs(argv: string[]): BuildArgs {
return { return {
targets: resolveTargets(options.target), targets: resolveTargets(options.target),
manifestPath: options.manifest, manifestPath: options.manifest,
upload: ci || compileOnly ? false : (options.upload ?? true), upload: ci ? false : (options.upload ?? true),
compileOnly,
ci, ci,
} }
} }

View File

@@ -75,7 +75,6 @@ function validateProductionEnv(envVars: Record<string, string>): void {
} }
export interface LoadBuildConfigOptions { export interface LoadBuildConfigOptions {
compileOnly?: boolean
ci?: boolean ci?: boolean
} }
@@ -95,7 +94,7 @@ export function loadBuildConfig(
...process.env, ...process.env,
} }
if (options.compileOnly || options.ci) { if (options.ci) {
return { version: readServerVersion(rootDir), envVars, processEnv } return { version: readServerVersion(rootDir), envVars, processEnv }
} }

View File

@@ -10,11 +10,8 @@ import { getTargetRules, loadManifest } from './manifest'
import { createR2Client } from './r2' import { createR2Client } from './r2'
import { stageCompiledArtifact, stageTargetArtifact } from './stage' import { stageCompiledArtifact, stageTargetArtifact } from './stage'
function buildModeLabel(argv: { compileOnly: boolean; ci: boolean }): string { function buildModeLabel(ci: boolean): string {
if (argv.ci) { return ci ? 'ci' : 'full'
return 'ci'
}
return argv.compileOnly ? 'compile-only' : 'full'
} }
export async function runProdResourceBuild(argv: string[]): Promise<void> { export async function runProdResourceBuild(argv: string[]): Promise<void> {
@@ -23,14 +20,11 @@ export async function runProdResourceBuild(argv: string[]): Promise<void> {
const args = parseBuildArgs(argv) const args = parseBuildArgs(argv)
const buildConfig = loadBuildConfig(rootDir, { const buildConfig = loadBuildConfig(rootDir, { ci: args.ci })
compileOnly: args.compileOnly,
ci: args.ci,
})
log.header(`Building BrowserOS server artifacts v${buildConfig.version}`) log.header(`Building BrowserOS server artifacts v${buildConfig.version}`)
log.info(`Targets: ${args.targets.map((target) => target.id).join(', ')}`) log.info(`Targets: ${args.targets.map((target) => target.id).join(', ')}`)
log.info(`Mode: ${buildModeLabel(args)}`) log.info(`Mode: ${buildModeLabel(args.ci)}`)
const compiled = await compileServerBinaries( const compiled = await compileServerBinaries(
args.targets, args.targets,
@@ -64,14 +58,6 @@ export async function runProdResourceBuild(argv: string[]): Promise<void> {
return return
} }
if (args.compileOnly) {
log.done('Compile-only build completed')
for (const binary of compiled) {
log.info(`${binary.target.id}: ${binary.binaryPath}`)
}
return
}
const manifestPath = resolve(rootDir, args.manifestPath) const manifestPath = resolve(rootDir, args.manifestPath)
if (!existsSync(manifestPath)) { if (!existsSync(manifestPath)) {
throw new Error(`Manifest not found: ${manifestPath}`) throw new Error(`Manifest not found: ${manifestPath}`)

View File

@@ -21,7 +21,6 @@ export interface BuildArgs {
targets: BuildTarget[] targets: BuildTarget[]
manifestPath: string manifestPath: string
upload: boolean upload: boolean
compileOnly: boolean
ci: boolean ci: boolean
} }