Files
houseplan-card/test/release-workflow.test.mjs
T
Codexandclaude[bot] c50458a098 ci: a stable release waits for a green E2E run on a real Home Assistant
The stable gate proved Validate and Full Performance on the exact SHA but
never ran the release in Home Assistant itself. houseplan-e2e installs
the release's houseplan.zip — the bytes HACS ships — into HA in docker
and walks the sidebar page, dashboards, roles, PDF, restart and the
stable→tag upgrade. release.yml now dispatches e2e.yml on the tag for
`!prerelease` releases and waits for it (scripts/e2e-gate.mjs, modelled
on validate-gate.mjs): the gate recognises its own run by `HP <tag>` in
the job names, ignores foreign dispatches, and reports red / missing /
cancelled / token error with the run link. Betas are untouched.

Mutants: release-ships-on-red-e2e, release-trusts-foreign-e2e-run.

Issue: #514
User-Visible: no
2026-09-09 21:18:51 +00:00

26 lines
1.5 KiB
JavaScript

// #514: release.yml holds the assets of a stable release until E2E on a real HA is green.
import assert from 'node:assert/strict';
import test from 'node:test';
import { readFileSync } from 'node:fs';
const workflow = readFileSync(new URL('../.github/workflows/release.yml', import.meta.url), 'utf8');
const at = (marker) => { const i = workflow.indexOf(marker); assert.ok(i > 0, `нет «${marker}»`); return i; };
test('#514 AC1/AC3: the E2E gate step exists in job gate, after Full Performance, for stable releases only', () => {
const gate = at(' gate:\n');
const build = at(' build:\n');
const perf = at(' - name: Require full performance for a stable release\n');
const e2e = at(' - name: Require green E2E on a real Home Assistant for a stable release\n');
assert.ok(gate < perf && perf < e2e && e2e < build, 'E2E stands after Full Performance inside job gate');
const step = workflow.slice(e2e, build);
assert.match(step, /if: \$\{\{ !github\.event\.release\.prerelease \}\}/, 'prereleases skip the step');
assert.match(step, /node scripts\/e2e-gate\.mjs --tag="\$TAG"/);
assert.match(step, /TAG: \$\{\{ github\.event\.release\.tag_name \}\}/);
});
test('#514: the gate dispatches with a token that can reach houseplan-e2e, with the process token as fallback', () => {
const e2e = at(' - name: Require green E2E on a real Home Assistant for a stable release\n');
const step = workflow.slice(e2e, at(' build:\n'));
assert.match(step, /GH_TOKEN: \$\{\{ secrets\.E2E_DISPATCH_TOKEN \|\| secrets\.HP_PROCESS_TOKEN \}\}/);
});