mirror of
https://github.com/Zakkaus/doona.git
synced 2026-12-06 16:01:00 +00:00
nfpm's apk output is rejected by apk-tools, so Alpine and OpenWrt 25.12 users had no package. Two new jobs build them from the existing recipes against the archives of the same run: tools/package-alpine.sh runs abuild in a pinned Alpine 3.24 container and tools/package-openwrt.sh runs the pinned OpenWrt 25.12 SDK. Each run generates its own signing key and the release attaches the public half; OpenWrt signs only its index, which is attached as doona-openwrt.adb. The nfpm packaging moves out of the build job and runs next to the two apk jobs; it also builds doona-precompressed. A sums job collects every package and writes SHA256SUMS, so the release job still only uploads. workflow_dispatch packages package.json's version from a branch and keeps the files as run artifacts, skipping the Check wait and the release.
47 lines
2.5 KiB
JavaScript
47 lines
2.5 KiB
JavaScript
import {readFileSync} from 'node:fs';
|
|
import {expect, it} from 'vitest';
|
|
import {parse} from 'yaml';
|
|
|
|
const load = name => parse(readFileSync(new URL(`../.github/workflows/${name}.yml`, import.meta.url), 'utf8'));
|
|
const release = load('release');
|
|
const check = load('check');
|
|
const uses = (job, name) => job.steps.find(step => step.uses?.startsWith(`${name}@`));
|
|
|
|
it('keeps the release write token away from dependency and build steps', () => {
|
|
expect(release.permissions).toEqual({});
|
|
const writers = Object.entries(release.jobs).filter(([, job]) => job.permissions?.contents === 'write');
|
|
expect(writers.map(([name]) => name)).toEqual(['release']);
|
|
const {build, release: publish} = release.jobs;
|
|
expect(build.permissions).toEqual({contents: 'read'});
|
|
expect(publish.needs).toEqual(expect.arrayContaining(['build', 'nfpm', 'alpine', 'openwrt-apk', 'sums']));
|
|
expect(publish.steps.some(step => step.run || step.uses?.startsWith('actions/checkout@'))).toBe(false);
|
|
expect(uses(publish, 'actions/download-artifact').with.name).toBe(uses(release.jobs.sums, 'actions/upload-artifact').with.name);
|
|
});
|
|
|
|
it('publishes and waits for Check only on a tag push', () => {
|
|
expect(release.on.push.tags).toEqual(['v*']);
|
|
expect(release.on).toHaveProperty('workflow_dispatch');
|
|
expect(release.jobs.verified.if).toBe("github.event_name == 'push'");
|
|
expect(release.jobs.release.if).toBe("github.event_name == 'push'");
|
|
});
|
|
|
|
it('builds the release once, after the Check run on the tagged commit passed', () => {
|
|
const commands = release.jobs.build.steps.map(step => step.run);
|
|
expect(commands.filter(command => command === 'pnpm build')).toHaveLength(1);
|
|
expect(commands.some(command => /playwright|pnpm e2e/.test(command ?? ''))).toBe(false);
|
|
expect(release.jobs.build.needs).toContain('verified');
|
|
expect(release.jobs.verified.permissions).toEqual({actions: 'read'});
|
|
expect(release.jobs.verified.steps.map(step => step.run ?? '').join('\n')).toMatch(/check\.yml/);
|
|
});
|
|
|
|
it.each(['VERSION', 'PRERELEASE', 'ARCH_PRERELEASE', 'NPM', 'PACKAGE_RELEASE'])('hands %s from the build job to the release job', key => {
|
|
expect(release.jobs.build.outputs[key]).toBe(`\${{ steps.version.outputs.${key} }}`);
|
|
expect(release.jobs.release.env[key]).toBe(`\${{ needs.build.outputs.${key} }}`);
|
|
});
|
|
|
|
it('runs every browser test in every shard', () => {
|
|
const shard = check.jobs.e2e.steps.find(step => step.name === 'Run the browser shard');
|
|
expect(shard.run).not.toMatch(/grep/);
|
|
expect(check.jobs.changes.outputs).toEqual({lane: '${{ steps.route.outputs.lane }}'});
|
|
});
|