mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
perf(ci): skip unused main source maps in PR build fixtures (#29512)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -106,6 +106,7 @@ jobs:
|
||||
- name: Build E2E outputs
|
||||
env:
|
||||
VITE_EXPOSE_STORE: 'true'
|
||||
ORCA_CI_MAIN_SOURCEMAPS: '0'
|
||||
run: pnpm run build:electron-vite:parallel --mode e2e
|
||||
|
||||
# The CLI emits into out/main too; start only after Electron finishes clearing that tree.
|
||||
|
||||
@@ -1154,6 +1154,8 @@ jobs:
|
||||
timeout 300 sudo apt-get install -y cpio rpm
|
||||
|
||||
- name: Build package inputs
|
||||
env:
|
||||
ORCA_CI_MAIN_SOURCEMAPS: '0'
|
||||
run: |
|
||||
status=0
|
||||
pnpm run build:cli || status=1
|
||||
@@ -1420,6 +1422,8 @@ jobs:
|
||||
# electron-vite targets overlap instead of running back to back. The Linux package
|
||||
# job already packages and smoke-tests an AppImage built that way.
|
||||
- name: Build package inputs
|
||||
env:
|
||||
ORCA_CI_MAIN_SOURCEMAPS: '0'
|
||||
run: pnpm run build:release:parallel
|
||||
|
||||
- name: Prepare Electron native runtime
|
||||
|
||||
@@ -79,6 +79,34 @@ const electronBuilderConfig = require('../electron-builder.config.cjs')
|
||||
const { FileMatcher } = require('app-builder-lib/out/fileMatcher')
|
||||
|
||||
describe('Electron Vite output contract', () => {
|
||||
it('skips main maps only for explicit check builds and always keeps official release maps', async () => {
|
||||
try {
|
||||
for (const [setting, identity, expected] of [
|
||||
[undefined, undefined, 'hidden'],
|
||||
['false', undefined, 'hidden'],
|
||||
['1', undefined, 'hidden'],
|
||||
['0', undefined, false],
|
||||
['0', 'stable', 'hidden'],
|
||||
['0', 'rc', 'hidden']
|
||||
] as const) {
|
||||
vi.stubEnv('ORCA_CI_MAIN_SOURCEMAPS', setting)
|
||||
vi.stubEnv('ORCA_BUILD_IDENTITY', identity)
|
||||
vi.resetModules()
|
||||
const { electronViteConfig: configured } = await import('../../electron.vite.config')
|
||||
expect(configured.main?.build?.sourcemap).toBe(expected)
|
||||
expect(configured.main?.build?.minify).toBe(electronViteConfig.main?.build?.minify)
|
||||
expect(configured.main?.build?.rollupOptions?.input).toEqual(
|
||||
electronViteConfig.main?.build?.rollupOptions?.input
|
||||
)
|
||||
expect(configured.renderer?.build).toEqual(electronViteConfig.renderer?.build)
|
||||
expect(configured.preload?.build).toEqual(electronViteConfig.preload?.build)
|
||||
}
|
||||
} finally {
|
||||
vi.unstubAllEnvs()
|
||||
vi.resetModules()
|
||||
}
|
||||
})
|
||||
|
||||
it('can skip main source maps during development without changing build output settings', () => {
|
||||
try {
|
||||
vi.stubEnv('ORCA_DEV_MAIN_SOURCEMAPS', undefined)
|
||||
|
||||
@@ -233,6 +233,12 @@ export const electronViteConfig: UserConfig = {
|
||||
// bundle never references maps that packaging strips out. Release CI
|
||||
// uploads them so minified crash traces stay decodable.
|
||||
sourcemap: 'hidden',
|
||||
// PR fixtures discard maps; official releases must always retain them.
|
||||
...(process.env.ORCA_CI_MAIN_SOURCEMAPS === '0' &&
|
||||
orcaBuildIdentity !== 'stable' &&
|
||||
orcaBuildIdentity !== 'rc'
|
||||
? { sourcemap: false }
|
||||
: {}),
|
||||
// Why: daemon-entry.js is asar-unpacked so child_process.fork() can
|
||||
// execute it from disk. Node's module resolution from the unpacked
|
||||
// directory cannot reach into app.asar; startup-critical pure JS must
|
||||
|
||||
Reference in New Issue
Block a user