test(build): follow the validate-step archiving and the channel-aware gates
archive-inputs became a validate step (b1aa63b918) and the build gates grew
inputs.channel with channel builds; publication now reaches build-<platform>
through assemble-win32-bundle. The desktop-builder fixture also needs the
msix-shared helper product-identity.cjs requires and the preview-guest preload
entry the electron bundler compiles.
This commit is contained in:
@@ -35,7 +35,13 @@ function fixture() {
|
||||
put(join(app, 'src/index.js'), 'document.getElementById("app").textContent = "built renderer"')
|
||||
put(join(app, 'electron/main.ts'), 'console.log(JSON.stringify({ stamp: __HERMES_INSTALL_STAMP__, identity: __HERMES_PRODUCT_IDENTITY__ }))')
|
||||
put(join(app, 'electron/preload.ts'), 'globalThis.fixturePreload = "compiled preload"')
|
||||
put(join(app, 'electron/preview-guest-preload-entry.ts'), 'globalThis.fixtureGuestPreload = "compiled guest preload"')
|
||||
cpSync(join(repo, 'apps/desktop/product-identity.cjs'), join(app, 'product-identity.cjs'))
|
||||
// product-identity.cjs resolves the channel request through the in-tree
|
||||
// packaging helper (and its content-types table) by relative path.
|
||||
for (const helper of ['scripts/msix-shared.mjs', 'scripts/release-content-types.json']) {
|
||||
cpSync(join(repo, helper), join(source, helper))
|
||||
}
|
||||
symlinkSync(join(repo, 'node_modules'), join(app, 'node_modules'), 'junction')
|
||||
const icons = join(root, 'icons')
|
||||
put(join(icons, 'apps/desktop/public/apple-touch-icon.png'), 'fresh icon')
|
||||
|
||||
@@ -68,7 +68,7 @@ it('explicit npm snapshots remain replaceable and isolated from toolchain-only p
|
||||
// the caller seam: a cache hit never replaces preparation.
|
||||
const desktop = action('../.github/workflows/desktop-bundled-release.yml')
|
||||
const payload = action('../.github/workflows/pm-bundle.yml')
|
||||
const desktopSaveGate = "${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' }}"
|
||||
const desktopSaveGate = "${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel == '' }}"
|
||||
const payloadSaveGate = "${{ !cancelled() && steps.prepare.outcome == 'success' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && (inputs.ref == '' || inputs.ref == github.sha) }}"
|
||||
|
||||
it.each([
|
||||
@@ -82,7 +82,7 @@ it.each([
|
||||
expect(job).toBeDefined()
|
||||
if (cacheMode) {
|
||||
expect(job['cache-mode']).toBe(cacheMode)
|
||||
expect(job.needs).toEqual(['validate', 'archive-inputs'])
|
||||
expect(job.needs).toEqual(['validate'])
|
||||
expect(job.if).toContain(`inputs.build_commit ${cacheMode === 'read' ? '!=' : '=='} ''`)
|
||||
}
|
||||
const cacheSteps = job.steps.filter(step => step.uses === './.github/actions/desktop-build-cache')
|
||||
@@ -120,10 +120,15 @@ it.each([
|
||||
|
||||
it.each(['win32', 'darwin'])('%s publication requires the selected build to succeed, not merely skip', platform => {
|
||||
const gate = desktop.jobs[`build-${platform}`]
|
||||
expect(gate.needs).toEqual(['validate', 'archive-inputs', `build-${platform}-release`, `build-${platform}-commit`])
|
||||
expect(gate.if).toContain("needs.validate.result == 'success' && needs.archive-inputs.result == 'success'")
|
||||
expect(gate.needs).toEqual(['validate', `build-${platform}-release`, `build-${platform}-commit`])
|
||||
expect(gate.if).toContain("needs.validate.result == 'success'")
|
||||
expect(gate.env.SELECTED_BUILD_SUCCEEDED.replace(/\s+/g, ' ').trim()).toBe(
|
||||
`\${{ (inputs.build_commit == '' && needs.build-${platform}-release.result == 'success' && needs.build-${platform}-commit.result == 'skipped') || (inputs.build_commit != '' && needs.build-${platform}-commit.result == 'success' && needs.build-${platform}-release.result == 'skipped') }}`,
|
||||
`\${{ (inputs.build_commit == '' && inputs.channel == '' && needs.build-${platform}-release.result == 'success' && needs.build-${platform}-commit.result == 'skipped') || ((inputs.build_commit != '' || inputs.channel != '') && needs.build-${platform}-commit.result == 'success' && needs.build-${platform}-release.result == 'skipped') }}`,
|
||||
)
|
||||
expect(desktop.jobs[`publish-${platform}-updater`].needs).toContain(`build-${platform}`)
|
||||
// Publication sits downstream of the gate, directly or through the bundle
|
||||
// assembly job.
|
||||
const upstream = new Set()
|
||||
const walk = id => { for (const need of desktop.jobs[id].needs ?? []) { if (!upstream.has(need)) { upstream.add(need); walk(need) } } }
|
||||
walk(`publish-${platform}-updater`)
|
||||
expect(upstream).toContain(`build-${platform}`)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user