AI-native design editor. Open-source Figma alternative.
ci: add a manual build of the Chromium desktop flavor (#1594)
Danila Poyarkov529bf8662d28
diff --git a/.github/workflows/chromium.yml b/.github/workflows/chromium.ymlnew file mode 100644index 000000000..05b734cef--- /dev/null+++ b/.github/workflows/chromium.yml@@ -0,0 +1,159 @@+name: Chromium build++# OpenPencil Chromium: the desktop app on Tauri v3 with the CEF runtime, a+# flavor of each release built by hand from a branch that carries it+# (desktop/tauri.chromium.conf.json). Given a release tag, it adds the macOS+# bundles and latest-chromium.json, the flavor's update feed, to that release+# once the branch has merged exactly that tag; without one it only builds.+# The steps run tools/release/release-packages/src/chromium from this+# workflow's commit, checked out under .pipeline as in build.yml.+on:+ workflow_dispatch:+ inputs:+ ref:+ description: Branch or commit with the Chromium flavor.+ required: true+ default: build/tauri-v3+ type: string+ tag:+ description: Release to add the build to (vX.Y.Z or vX.Y.Z-beta.N); empty only builds.+ required: false+ default: ''+ type: string++permissions:+ contents: read++concurrency:+ group: chromium-build+ cancel-in-progress: false++jobs:+ plan:+ runs-on: ubuntu-latest+ timeout-minutes: 10+ outputs:+ version: ${{ steps.plan.outputs.version }}+ source: ${{ steps.plan.outputs.source }}+ tag-commit: ${{ steps.plan.outputs.tag-commit }}+ matrix: ${{ steps.plan.outputs.matrix }}+ steps:+ - uses: actions/checkout@v7+ with:+ ref: ${{ inputs.ref }}+ fetch-depth: 0+ persist-credentials: false+ - uses: actions/checkout@v7+ with:+ ref: ${{ github.workflow_sha }}+ path: .pipeline+ persist-credentials: false+ - uses: ./.pipeline/.github/actions/setup-bun+ with:+ install-args: --cwd .pipeline --frozen-lockfile+ cache-save: 'false'+ - id: plan+ name: Pin the commit and check it carries the release+ env:+ RELEASE_TAG: ${{ inputs.tag }}+ run: bun .pipeline/tools/release/release-packages/src/chromium/plan.ts++ native:+ needs: plan+ strategy:+ fail-fast: false+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}+ runs-on: macos-latest+ timeout-minutes: 60+ steps:+ - uses: actions/checkout@v7+ with:+ ref: ${{ needs.plan.outputs.source }}+ persist-credentials: false+ - uses: actions/checkout@v7+ with:+ ref: ${{ github.workflow_sha }}+ path: .pipeline+ persist-credentials: false+ - uses: actions/setup-node@v7+ with:+ node-version: 26.x+ - uses: dtolnay/rust-toolchain@stable+ with:+ targets: ${{ matrix.target }}+ - uses: Swatinem/rust-cache@v2+ with:+ workspaces: desktop -> target+ key: chromium-${{ matrix.target }}+ - uses: ./.pipeline/.github/actions/setup-bun+ with:+ cache-scope: desktop+ cache-save: 'false'+ - name: Install pinned workflow tooling+ run: bun install --cwd .pipeline --frozen-lockfile+ - name: Build, sign, and notarize+ id: tauri+ uses: tauri-apps/tauri-action@v0+ env:+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || '' }}+ APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}+ APPLE_ID: ${{ secrets.APPLE_ID }}+ APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}+ with:+ tauriScript: node node_modules/@tauri-apps/cli/tauri.js+ args: >-+ --target ${{ matrix.target }} --features cef+ --config desktop/tauri.chromium.conf.json+ retryAttempts: 0+ - name: Name the bundles for this architecture+ env:+ CHROMIUM_TARGET: ${{ matrix.target }}+ CHROMIUM_VERSION: ${{ needs.plan.outputs.version }}+ TAURI_ARTIFACT_PATHS: ${{ steps.tauri.outputs.artifactPaths }}+ run: bun .pipeline/tools/release/release-packages/src/chromium/collect.ts+ - uses: actions/upload-artifact@v7+ with:+ name: chromium-${{ matrix.arch }}+ path: chromium-output/*+ if-no-files-found: error+ compression-level: 0++ # Runs only once every architecture has built, so a failed build adds+ # nothing to the release, and latest-chromium.json is written once.+ publish:+ if: inputs.tag != ''+ needs: [plan, native]+ runs-on: ubuntu-latest+ timeout-minutes: 15+ permissions:+ contents: write+ steps:+ - uses: actions/checkout@v7+ with:+ ref: ${{ needs.plan.outputs.source }}+ persist-credentials: false+ - uses: actions/checkout@v7+ with:+ ref: ${{ github.workflow_sha }}+ path: .pipeline+ persist-credentials: false+ - uses: ./.pipeline/.github/actions/setup-bun+ with:+ install-args: --cwd .pipeline --frozen-lockfile+ cache-save: 'false'+ - uses: actions/download-artifact@v8+ with:+ pattern: chromium-*+ path: chromium-artifacts+ merge-multiple: true+ - name: Install signature verifier+ run: sudo apt-get update && sudo apt-get install -y minisign+ - name: Verify signatures, write the feed, and add them to the release+ env:+ GH_TOKEN: ${{ github.token }}+ RELEASE_TAG: ${{ inputs.tag }}+ TAG_COMMIT: ${{ needs.plan.outputs.tag-commit }}+ run: bun .pipeline/tools/release/release-packages/src/chromium/publish.tsdiff --git a/packages/docs/.vitepress/theme/landing/download/releases.ts b/packages/docs/.vitepress/theme/landing/download/releases.tsindex 1e5106417..a103bb520 100644--- a/packages/docs/.vitepress/theme/landing/download/releases.ts+++ b/packages/docs/.vitepress/theme/landing/download/releases.ts@@ -61,6 +61,8 @@ export function classifyAsset(asset: {url: stringsize: number}): ReleaseFile | null {+ // OpenPencil Chromium (`OpenPencil-Chromium_…`) shares the release but is not offered here.+ if (asset.name.startsWith('OpenPencil-Chromium_')) return nullconst match = FILE_PATTERNS.find(({ pattern }) => pattern.test(asset.name))if (!match) return nullconst { platform, arch, format } = matchdiff --git a/tools/AGENTS.md b/tools/AGENTS.mdindex 83de76ad5..927494526 100644--- a/tools/AGENTS.md+++ b/tools/AGENTS.md@@ -33,6 +33,7 @@ Private tooling lives under `tools/<role>/<domain>/{src,tests}`; Steiger enforce- Update versions in the root and publishable package manifests plus `desktop/tauri.conf.json` and `desktop/Cargo.toml`; run `bun run changelog:assemble`, curate `Unreleased` (`bun run check:changelog --release`), and move it into `## x.y.z — YYYY-MM-DD`; commit `Release vX.Y.Z`; tag and push `vX.Y.Z`. A pre-release uses `X.Y.Z-beta.N` throughout.- `.github/workflows/build.yml` is the source of truth: `v*` tags (or dispatches for an immutable stable tag) build shared frontend/package outputs once, build signed desktop artifacts in parallel, verify and attest one complete same-run artifact set, publish npm packages, and replace the draft release assets using the exact changelog section. Policy, provenance, and recovery: `tools/release/release-packages/README.md`.+- `.github/workflows/chromium.yml` builds OpenPencil Chromium (Tauri v3 with CEF), a flavor of a release, by hand from `build/tauri-v3` once that branch has merged exactly the release tag, and adds its macOS bundles and `latest-chromium.json`, its update feed, to that release after every macOS build succeeds; stable tooling and the download page skip those files (`isChromiumAsset`). Its steps live in `tools/release/release-packages/src/chromium`, beside the stable release scripts they reuse.- Public workspace packages are discovered by the package-artifacts catalog. Bun source exports require the complete `src` directory in package contents; Node exports use `dist`. Release preparation must preserve resolution maps. Prepared publish directories receive the root `LICENSE` when a package has none of its own, and every package needs a `README.md` because npm renders it. Publishing uses prepared npm tarballs verified through the shared Node/Bun consumer checks; never publish package directories manually. `test:packages` first runs the packaging guards in `tools/checks/package-quality/src/smoke/guards.ts`: fixture manifests packed with the real `npm pack` that must trip the tarball inspector and the Node/Bun consumer checks before those checks vouch for real packages.- Pre-releases are only `vX.Y.Z-beta.N`: they publish to npm's `next` dist-tag, draft as a GitHub pre-release that is never latest, install on Windows as MSI `X.Y.Z.N`, and skip the app and docs deploys (`tools/release/release-packages/src/version.ts`).- A beta's changelog section opens with the pre-release note and lists changes since the previous beta. The final `X.Y.Z` replaces its beta sections with one section written against the previous stable release, opened by a short highlights paragraph, with fixes to new features folded into their bullets; the GitHub pre-releases keep the beta notes (`CHANGELOG.md`).diff --git a/tools/release/release-packages/src/chromium/catalog.ts b/tools/release/release-packages/src/chromium/catalog.tsnew file mode 100644index 000000000..854ce609f--- /dev/null+++ b/tools/release/release-packages/src/chromium/catalog.ts@@ -0,0 +1,49 @@+import type { DesktopAsset } from '../native/catalog.ts'+import { releaseVersion } from '../native/context.ts'++/** OpenPencil Chromium's update feed, published on each release beside the stable `latest.json`. */+export const CHROMIUM_FEED = 'latest-chromium.json'++const CHROMIUM_PREFIX = 'OpenPencil-Chromium_'++/**+ * Whether a release asset belongs to OpenPencil Chromium, which the Chromium workflow adds to a+ * release after its stable build, so the stable tooling leaves it in place.+ */+export function isChromiumAsset(name: string): boolean {+ return name.startsWith(CHROMIUM_PREFIX) || name === CHROMIUM_FEED+}++export const chromiumBuilds = [+ { target: 'aarch64-apple-darwin', arch: 'aarch64', platform: 'darwin-aarch64' },+ { target: 'x86_64-apple-darwin', arch: 'x64', platform: 'darwin-x86_64' }+] as const++export const chromiumTargets = chromiumBuilds.map((build) => build.target)++export type ChromiumTarget = (typeof chromiumTargets)[number]++/**+ * Bundles the Tauri CLI writes for OpenPencil Chromium. They carry the release's version, named+ * apart from the stable bundles and per architecture.+ */+export function chromiumAssets(target: ChromiumTarget, version: string): DesktopAsset[] {+ releaseVersion(`v${version}`)+ const build = chromiumBuilds.find((entry) => entry.target === target)+ if (!build) throw new Error(`Not a Chromium target: ${target}`)++ return [+ {+ source: `OpenPencil Chromium_${version}_${build.arch}.dmg`,+ name: `${CHROMIUM_PREFIX}${version}_${build.arch}.dmg`,+ updaterKeys: [],+ signed: false+ },+ {+ source: 'OpenPencil Chromium.app.tar.gz',+ name: `${CHROMIUM_PREFIX}${build.arch}.app.tar.gz`,+ updaterKeys: [build.platform, `${build.platform}-app`],+ signed: true+ }+ ]+}diff --git a/tools/release/release-packages/src/chromium/collect.ts b/tools/release/release-packages/src/chromium/collect.tsnew file mode 100644index 000000000..7daa4816c--- /dev/null+++ b/tools/release/release-packages/src/chromium/collect.ts@@ -0,0 +1,25 @@+import { copyFile, mkdir } from 'node:fs/promises'+import { join } from 'node:path'++import { releaseVersionSchema } from '#release/version'+import * as v from 'valibot'++import { resolveReportedAssets } from '../native/artifacts.ts'+import { chromiumAssets, chromiumTargets } from './catalog.ts'++const target = v.parse(v.picklist(chromiumTargets), process.env.CHROMIUM_TARGET)+const version = v.parse(releaseVersionSchema, process.env.CHROMIUM_VERSION)+const reported = v.parse(+ v.pipe(v.string(), v.parseJson(), v.array(v.string())),+ process.env.TAURI_ARTIFACT_PATHS+)+const assets = await resolveReportedAssets(reported, chromiumAssets(target, version), process.cwd())++const output = join(process.cwd(), 'chromium-output')+await mkdir(output, { recursive: true })++for (const asset of assets) {+ await copyFile(asset.source, join(output, asset.name))+}++console.log(`Collected ${assets.length} files for ${target}`)diff --git a/tools/release/release-packages/src/chromium/plan.ts b/tools/release/release-packages/src/chromium/plan.tsnew file mode 100644index 000000000..909699dc5--- /dev/null+++ b/tools/release/release-packages/src/chromium/plan.ts@@ -0,0 +1,55 @@+import { appendFile, readFile } from 'node:fs/promises'++import { releaseTagSchema, releaseVersionSchema } from '#release/version'+import * as v from 'valibot'++import { releaseCommands } from '../native/commands.ts'+import { commitSchema } from '../native/context.ts'+import { chromiumBuilds } from './catalog.ts'+import { assertChromiumSource } from './source.ts'++// Without a tag the run only builds, for testing; with one it publishes onto that release.+const tag = v.parse(v.optional(releaseTagSchema), process.env.RELEASE_TAG || undefined)+const { git } = releaseCommands(process.cwd())++const config = v.parse(+ v.pipe(v.string(), v.parseJson(), v.object({ version: releaseVersionSchema })),+ await readFile('desktop/tauri.conf.json', 'utf8')+)+const source = v.parse(commitSchema, await git('rev-parse', 'HEAD'))++let tagCommit = ''+if (tag) {+ await git(+ 'fetch',+ '--no-tags',+ 'origin',+ `+refs/tags/${tag}:refs/tags/${tag}`,+ '+refs/heads/master:refs/remotes/origin/master'+ )+ tagCommit = v.parse(commitSchema, await git('rev-parse', `refs/tags/${tag}^{commit}`))+ assertChromiumSource({+ configVersion: config.version,+ tag,+ tagCommit,+ masterBase: await git('merge-base', 'HEAD', 'refs/remotes/origin/master')+ })+}++const output = process.env.GITHUB_OUTPUT+if (!output) throw new Error('Missing GITHUB_OUTPUT')++await appendFile(+ output,+ [+ `version=${config.version}`,+ `source=${source}`,+ `tag-commit=${tagCommit}`,+ `matrix=${JSON.stringify({ include: chromiumBuilds })}`,+ ''+ ].join('\n')+)++console.log(+ `OpenPencil Chromium ${config.version} from ${source}${tag ? `, for ${tag}` : ', build only'}`+)diff --git a/tools/release/release-packages/src/chromium/publish.ts b/tools/release/release-packages/src/chromium/publish.tsnew file mode 100644index 000000000..2010befe6--- /dev/null+++ b/tools/release/release-packages/src/chromium/publish.ts@@ -0,0 +1,125 @@+import { mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { join } from 'node:path'++import { releaseTagSchema } from '#release/version'+import { decode, toUint8Array } from 'js-base64'+import * as v from 'valibot'++import { ARTIFACT_TRANSFER_TIMEOUT_MS, releaseCommands } from '../native/commands.ts'+import { commitSchema, releaseVersion } from '../native/context.ts'+import { digestFile } from '../native/manifest.ts'+import { assertSignedVersion } from '../native/signature.ts'+import { CHROMIUM_FEED, chromiumAssets, chromiumTargets } from './catalog.ts'++const root = process.cwd()+const tag = v.parse(releaseTagSchema, process.env.RELEASE_TAG)+const version = releaseVersion(tag)+const tagCommit = v.parse(commitSchema, process.env.TAG_COMMIT)+const repository = v.parse(+ v.pipe(v.string(), v.regex(/^[\w.-]+\/[\w.-]+$/)),+ process.env.GITHUB_REPOSITORY+)+const { git, github, verifySignature } = releaseCommands(root)++// The release must exist, draft or published, and its tag must not have moved since the plan.+v.parse(+ v.pipe(v.string(), v.parseJson(), v.object({ tagName: v.literal(tag) })),+ await github(['release', 'view', tag, '--repo', repository, '--json', 'tagName'])+)+await git('fetch', '--no-tags', 'origin', `refs/tags/${tag}`)+if ((await git('rev-parse', 'FETCH_HEAD^{commit}')) !== tagCommit) {+ throw new Error(`Release tag ${tag} moved during the build`)+}++const artifacts = join(root, 'chromium-artifacts')+const config = v.parse(+ v.pipe(+ v.string(),+ v.parseJson(),+ v.object({ plugins: v.object({ updater: v.object({ pubkey: v.string() }) }) })+ ),+ await readFile(join(root, 'desktop', 'tauri.conf.json'), 'utf8')+)++// Every architecture must be present and signed for this version before anything is uploaded.+const platforms: Record<string, { signature: string; url: string }> = {}+const temporary = await mkdtemp(join(tmpdir(), 'open-pencil-chromium-'))++try {+ const publicKey = join(temporary, 'key.pub')+ await writeFile(publicKey, toUint8Array(config.plugins.updater.pubkey))++ for (const target of chromiumTargets) {+ for (const asset of chromiumAssets(target, version)) {+ if (!asset.signed) continue++ const path = join(artifacts, asset.name)+ const signature = (await readFile(`${path}.sig`, 'utf8')).trim()+ const decoded = join(temporary, `${asset.name}.minisig`)+ await writeFile(decoded, toUint8Array(signature))+ await verifySignature(path, publicKey, decoded)+ assertSignedVersion(decode(signature), version, asset.name)++ for (const platform of asset.updaterKeys) {+ platforms[platform] = {+ signature,+ url: `https://github.com/${repository}/releases/download/${tag}/${asset.name}`+ }+ }+ }+ }+} finally {+ await rm(temporary, { recursive: true, force: true })+}++await writeFile(+ join(artifacts, CHROMIUM_FEED),+ JSON.stringify({ version, pub_date: new Date().toISOString(), platforms }, null, 2)+)++// Same names on every run of a release, so a rerun replaces them; the stable assets stay.+const names = (await readdir(artifacts)).sort()+await github(+ [+ 'release',+ 'upload',+ tag,+ ...names.map((name) => join(artifacts, name)),+ '--repo',+ repository,+ '--clobber'+ ],+ ARTIFACT_TRANSFER_TIMEOUT_MS+)++const downloaded = await mkdtemp(join(tmpdir(), 'open-pencil-chromium-verify-'))++try {+ await github(+ [+ 'release',+ 'download',+ tag,+ '--repo',+ repository,+ '--dir',+ downloaded,+ ...names.flatMap((name) => ['--pattern', name])+ ],+ ARTIFACT_TRANSFER_TIMEOUT_MS+ )++ for (const name of names) {+ if (+ (await digestFile(join(downloaded, name))).sha256 !==+ (await digestFile(join(artifacts, name))).sha256+ ) {+ throw new Error(`Uploaded digest mismatch: ${name}`)+ }+ }+} finally {+ await rm(downloaded, { recursive: true, force: true })+}++console.log(`Added OpenPencil Chromium ${version} to ${tag} with ${names.length} files`)diff --git a/tools/release/release-packages/src/chromium/source.ts b/tools/release/release-packages/src/chromium/source.tsnew file mode 100644index 000000000..843908b02--- /dev/null+++ b/tools/release/release-packages/src/chromium/source.ts@@ -0,0 +1,37 @@+import { releaseVersion } from '../native/context.ts'++export interface ChromiumSource {+ /** The version in the Chromium branch's `desktop/tauri.conf.json`. */+ configVersion: string+ tag: string+ tagCommit: string+ /** Where the Chromium branch last merged master. */+ masterBase: string+}++/**+ * A Chromium build of a release ships that release's code under its version, so the branch must+ * have merged exactly the release tag from master: no earlier master, and nothing master added+ * after the tag. Returns the release version.+ */+export function assertChromiumSource({+ configVersion,+ tag,+ tagCommit,+ masterBase+}: ChromiumSource): string {+ const version = releaseVersion(tag)++ if (configVersion !== version) {+ throw new Error(+ `The Chromium branch is at ${configVersion}, not ${version}; merge ${tag} into it`+ )+ }+ if (masterBase !== tagCommit) {+ throw new Error(+ `The Chromium branch last merged master at ${masterBase}, not ${tag} (${tagCommit}); merge exactly ${tag} into it`+ )+ }++ return version+}diff --git a/tools/release/release-packages/src/native/draft.ts b/tools/release/release-packages/src/native/draft.tsindex a82dbd117..1f4d1fa7d 100644--- a/tools/release/release-packages/src/native/draft.ts+++ b/tools/release/release-packages/src/native/draft.ts@@ -1,6 +1,7 @@import { isPrerelease } from '#release/version'import * as v from 'valibot'+import { isChromiumAsset } from '../chromium/catalog.ts'import type { ReleaseIdentity } from './context.ts'export const releaseSchema = v.object({@@ -24,7 +25,11 @@ export function assertDraftReplacement(throw new Error('Missing release manifest')}- const unexpected = release?.assets.filter((asset) => !names.includes(asset.name)) ?? []+ // OpenPencil Chromium's files arrive from their own workflow and stay when the stable set is replaced.+ const unexpected =+ release?.assets.filter(+ (asset) => !names.includes(asset.name) && !isChromiumAsset(asset.name)+ ) ?? []if (unexpected.length > 0) {throw new Error(`Refusing to remove unexpected draft assets: ${unexpected.map((asset) => asset.name).join(', ')}`diff --git a/tools/release/release-packages/src/native/publish.ts b/tools/release/release-packages/src/native/publish.tsindex a4a95a753..7a5ca5290 100644--- a/tools/release/release-packages/src/native/publish.ts+++ b/tools/release/release-packages/src/native/publish.ts@@ -7,6 +7,7 @@ import { createPublicationPlan } from '#release/workflow'import { isEqual } from 'es-toolkit'import * as v from 'valibot'+import { isChromiumAsset } from '../chromium/catalog.ts'import { ARTIFACT_TRANSFER_TIMEOUT_MS, releaseCommands } from './commands.ts'import { createReleaseContext } from './context.ts'import { assertDraftReplacement, releaseChannelArgs, releaseSchema } from './draft.ts'@@ -105,7 +106,10 @@ const remote = v.parse(])))-const remoteNames = remote.assets.map((asset) => asset.name).sort()+const remoteNames = remote.assets+ .map((asset) => asset.name)+ .filter((name) => !isChromiumAsset(name))+ .sort()if (!remote.isDraft || !isEqual(remoteNames, names)) {throw new Error('Uploaded asset set mismatch')@@ -118,7 +122,16 @@ const temporary = await mkdtemp(join(tmpdir(), 'open-pencil-release-verify-'))try {await github(- ['release', 'download', identity.tag, '--repo', repository, '--dir', temporary],+ [+ 'release',+ 'download',+ identity.tag,+ '--repo',+ repository,+ '--dir',+ temporary,+ ...names.flatMap((name) => ['--pattern', name])+ ],ARTIFACT_TRANSFER_TIMEOUT_MS)diff --git a/tools/release/release-packages/tests/chromium/catalog.test.ts b/tools/release/release-packages/tests/chromium/catalog.test.tsnew file mode 100644index 000000000..8ea38131a--- /dev/null+++ b/tools/release/release-packages/tests/chromium/catalog.test.ts@@ -0,0 +1,65 @@+import { expect, test } from 'bun:test'+import { mkdtemp, rm, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { join } from 'node:path'++import { chromiumAssets, isChromiumAsset } from '#release/chromium/catalog'+import { resolveReportedAssets } from '#release/native/artifacts'+import { desktopAssets, desktopTargets } from '#release/native/catalog'++const VERSION = '0.17.0-beta.1'++test('carries the release version and names each architecture apart', async () => {+ const root = await mkdtemp(join(tmpdir(), 'chromium-artifacts-'))++ try {+ const reported = await Promise.all(+ [+ `OpenPencil Chromium_${VERSION}_x64.dmg`,+ 'OpenPencil Chromium.app.tar.gz',+ 'OpenPencil Chromium.app.tar.gz.sig'+ ].map(async (name) => {+ await writeFile(join(root, name), 'fixture')+ return join(root, name)+ })+ )+ const assets = await resolveReportedAssets(+ reported,+ chromiumAssets('x86_64-apple-darwin', VERSION),+ root+ )++ expect(assets.map((asset) => asset.name).sort()).toEqual([+ 'OpenPencil-Chromium_0.17.0-beta.1_x64.dmg',+ 'OpenPencil-Chromium_x64.app.tar.gz',+ 'OpenPencil-Chromium_x64.app.tar.gz.sig'+ ])+ } finally {+ await rm(root, { recursive: true, force: true })+ }+})++test('feeds each architecture to its updater platform', () => {+ expect(+ chromiumAssets('aarch64-apple-darwin', VERSION).map((asset) => [asset.name, asset.updaterKeys])+ ).toEqual([+ ['OpenPencil-Chromium_0.17.0-beta.1_aarch64.dmg', []],+ ['OpenPencil-Chromium_aarch64.app.tar.gz', ['darwin-aarch64', 'darwin-aarch64-app']]+ ])+ expect(+ chromiumAssets('x86_64-apple-darwin', VERSION).flatMap((asset) => asset.updaterKeys)+ ).toEqual(['darwin-x86_64', 'darwin-x86_64-app'])+})++test('rejects versions that are not releases', () => {+ expect(() => chromiumAssets('aarch64-apple-darwin', '0.17.0-chromium.3')).toThrow()+})++test('tells its files apart from every stable release file', () => {+ const stable = desktopTargets.flatMap((target) => desktopAssets(target, VERSION))+ for (const asset of stable) expect(isChromiumAsset(asset.name)).toBeFalse()+ for (const name of ['latest.json', 'SHA256SUMS', 'release-manifest.json']) {+ expect(isChromiumAsset(name)).toBeFalse()+ }+ expect(isChromiumAsset('latest-chromium.json')).toBeTrue()+})diff --git a/tools/release/release-packages/tests/chromium/source.test.ts b/tools/release/release-packages/tests/chromium/source.test.tsnew file mode 100644index 000000000..f78804b33--- /dev/null+++ b/tools/release/release-packages/tests/chromium/source.test.ts@@ -0,0 +1,29 @@+import { expect, test } from 'bun:test'++import { assertChromiumSource } from '#release/chromium/source'++const tagCommit = 'a'.repeat(40)+const source = { configVersion: '0.17.0', tag: 'v0.17.0', tagCommit, masterBase: tagCommit }++test('builds a release from a branch that merged exactly its tag', () => {+ expect(assertChromiumSource(source)).toBe('0.17.0')+ expect(+ assertChromiumSource({ ...source, configVersion: '0.17.0-beta.1', tag: 'v0.17.0-beta.1' })+ ).toBe('0.17.0-beta.1')+})++test('refuses a branch at another version', () => {+ expect(() => assertChromiumSource({ ...source, configVersion: '0.16.0' })).toThrow(+ 'merge v0.17.0 into it'+ )+})++test('refuses a branch based on other master commits than the tag', () => {+ expect(() => assertChromiumSource({ ...source, masterBase: 'b'.repeat(40) })).toThrow(+ 'merge exactly v0.17.0'+ )+})++test('refuses tags that are not releases', () => {+ expect(() => assertChromiumSource({ ...source, tag: 'chromium' })).toThrow()+})diff --git a/tools/release/release-packages/tests/native/download-page.test.ts b/tools/release/release-packages/tests/native/download-page.test.tsindex 2598a65c8..9d137ca78 100644--- a/tools/release/release-packages/tests/native/download-page.test.ts+++ b/tools/release/release-packages/tests/native/download-page.test.ts@@ -1,6 +1,7 @@import { expect, test } from 'bun:test'import { classifyAsset, filesFor } from '#docs-config/theme/landing/download/releases'+import { chromiumAssets, chromiumTargets } from '#release/chromium/catalog'import { desktopAssets, desktopTargets } from '#release/native/catalog'const VERSION = '0.15.0'@@ -38,6 +39,12 @@ test('the download page leaves out updater payloads and signatures', () => {expect(classifyAsset(asset('latest.json'))).toBeNull()})+test('the download page leaves out OpenPencil Chromium', () => {+ const chromium = chromiumTargets.flatMap((target) => chromiumAssets(target, VERSION))+ for (const file of chromium) expect(classifyAsset(asset(file.name))).toBeNull()+ expect(classifyAsset(asset('latest-chromium.json'))).toBeNull()+})+test('a platform lists Apple Silicon or x64 first, then installers in format order', () => {const files = published.flatMap((file) => classifyAsset(asset(file.name)) ?? [])const release = { version: VERSION, date: '', url: '', files, checksums: null, notes: '' }diff --git a/tools/release/release-packages/tests/native/draft.test.ts b/tools/release/release-packages/tests/native/draft.test.tsindex 2bf21f89e..b7144e474 100644--- a/tools/release/release-packages/tests/native/draft.test.ts+++ b/tools/release/release-packages/tests/native/draft.test.ts@@ -40,6 +40,20 @@ test('refuses to silently delete unexpected draft assets', () => {)})+test('keeps the OpenPencil Chromium files added to the release', () => {+ const chromium = {+ ...draft,+ assets: [+ ...draft.assets,+ { name: 'OpenPencil-Chromium_0.15.0_aarch64.dmg' },+ { name: 'latest-chromium.json' }+ ]+ }+ expect(() =>+ assertDraftReplacement(chromium, names, identity.sourceCommit, identity)+ ).not.toThrow()+})+test.each(['release-manifest.json', 'SHA256SUMS'])('requires %s before publication', (missing) => {expect(() =>assertDraftReplacement(