Files
wekan/tests/workflowRunnerLabels.test.cjs
T
Lauri Ojansivu 7b8c377099 Release: the retired Mac runner, the jobs a cancel skipped, and the armv6 userland.
Three failures from the v10.80 run, which reported four snap arches red, one
bundle red, and three jobs that never ran at all.

build-mac-x64 asked for macos-13, and GitHub has RETIRED that image:
actions/runner-images publishes macos-14, macos-15 and macos-26 only, and
macos-13 is gone from the hosted-runner table. A retired label does not fail -
that is the whole problem. The job QUEUES, waiting for a runner that is never
coming. It sat there for nearly two hours and had to be cancelled by hand, and
this has been happening every release: NO WeKan release has ever carried a
wekan-<version>-mac-x64.zip. Intel macOS did not go away, it was renamed, and
.tools/TSC already builds its Intel Mac on the new label: macos-15-intel.

Cancelling it is what skipped charts, ucs and nextcloud. A cancelled job cancels
the RUN, and a cancelling run skips every job that has not started yet - so all
three were skipped in the same second the docker job they wait on succeeded,
after the tag, the release, every bundle and the multi-arch image had shipped.
The Helm chart for a published WeKan was never pushed and nothing said why. A job
whose if is always() still runs while a run is cancelling, so the three now say
always() && <each need>.result == 'success': explicit about the one condition
that ever mattered, instead of relying on a default a cancellation overrides.

The armv6 bundle died on

    qemu-arm: Could not open '/lib/ld-linux-armhf.so.3': No such file or directory

400 lines in, after the whole apt install. DEBIAN HAS NO ARMv6 PORT.
debian:trixie publishes arm/v5 and arm/v7 and nothing between them, and because
containerd treats a lower ARM variant as compatible, --platform linux/arm/v6
quietly resolved to arm/v5: Debian armel, ARMv5 SOFT-float, which contains no
hard-float loader at all. node-armv6 is hard-float, so it could not start.

Two things were wrong. The preflight matched on "architecture": "arm" and ignored
the VARIANT, so "debian:trixie has no linux/arm/v6" was never the answer it gave;
it compares architecture and variant now, and an unrequested variant still
matches anything so linux/arm64 (recorded as arm64/v8) keeps working. And armv6
is built in Debian's arm/v7 container instead, which IS armhf - the same
hard-float ABI and the same loader, so node-armv6 runs in it.

Nothing ARMv7 reaches the bundle. The container's npm install compiles nothing:
it is npm-rebuild over pure-JavaScript packages, with no node-gyp and no CXX in
the log. node-armv6, ferretdb-armv6 and the armv6 MongoDB tools are all
downloaded already built for ARMv6. The single exception is the bundled qemu-user
(#6458), which is copied OUT of the container, and an ARMv7 qemu-armv7l in an
ARMv6 bundle is a binary a Raspberry Pi 1 cannot execute - under a name its
cpu-exec, which looks for qemu-armv6l, would never ask for. So the matrix marks
armv6 same_arch_container: false and install-node-for-arch.sh ships without one,
letting cpu-exec fall back, which is what it is written to do.

Three guards, because each of these was invisible until a release ran:
tests/workflowRunnerLabels.test.cjs checks every runs-on in every workflow
against the labels GitHub currently offers and names the replacement for a
retired one; tests/releaseCancelSafeJobs.test.cjs pins the always() guards and
that they still require every need to have SUCCEEDED;
tests/releaseArmv6Container.test.cjs pins the armv6 container and runs the
preflight's own platform match against the manifest shapes it meets, including
that debian:trixie answers NO to linux/arm/v6.

Thanks to xet7 !
2026-08-11 01:52:41 +03:00

132 lines
6.1 KiB
JavaScript

'use strict';
// Guard: every runner label any workflow asks for is one GitHub still offers.
// Run: node tests/workflowRunnerLabels.test.cjs
//
// A retired label does not fail the job - that is the whole problem. The job
// QUEUES, waiting for a runner that is never coming, and sits there until
// somebody cancels it by hand. In the v10.80 release run, build-mac-x64 asked
// for `macos-13`, which GitHub had retired; it queued for nearly two hours, was
// cancelled, and cancelling it cancelled the RUN - which SKIPPED the charts, ucs
// and nextcloud jobs, because a cancelled run skips every job that has not
// started yet. The chart for a released, published WeKan was never pushed, and
// nothing in the log said "macos-13 no longer exists". No release has ever
// carried a wekan-<version>-mac-x64.zip.
//
// So the label is checked here, where it costs a second, instead of being
// discovered as a two-hour queue during a release. Intel macOS did not go away -
// it was RENAMED: macos-15-intel and macos-26-intel. macos-14/15/26 without the
// suffix are Apple Silicon.
//
// This list is GitHub's hosted-runner set (docs.github.com "GitHub-hosted
// runners"). When GitHub adds an image, add the label here too - a label this
// file does not know is reported, because an unknown label and a retired one
// look exactly the same from the outside, and both queue forever.
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const repoRoot = path.resolve(__dirname, '..');
const workflowDir = path.join(repoRoot, '.github/workflows');
// Currently offered GitHub-hosted labels.
const CURRENT = new Set([
// Ubuntu x64 / arm64
'ubuntu-latest', 'ubuntu-26.04', 'ubuntu-24.04', 'ubuntu-22.04', 'ubuntu-slim',
'ubuntu-26.04-arm', 'ubuntu-24.04-arm', 'ubuntu-22.04-arm',
// Windows x64 / arm64
'windows-latest', 'windows-2025', 'windows-2025-vs2026', 'windows-2022',
'windows-11-arm', 'windows-11-vs2026-arm',
// macOS arm64, then macOS Intel
'macos-latest', 'macos-26', 'macos-15', 'macos-14',
'macos-26-intel', 'macos-15-intel',
]);
// Labels GitHub has REMOVED. Kept by name so the failure can say what replaced
// them rather than only "unknown label".
const RETIRED = new Map([
['macos-15-large', 'a larger-runner label, not available here'],
['macos-13', 'retired - Intel macOS is now macos-15-intel / macos-26-intel'],
['macos-13-xl', 'retired - Intel macOS is now macos-15-intel / macos-26-intel'],
['macos-12', 'retired - Intel macOS is now macos-15-intel / macos-26-intel'],
['macos-11', 'retired - Intel macOS is now macos-15-intel / macos-26-intel'],
['ubuntu-20.04', 'retired - use ubuntu-22.04 or newer'],
['ubuntu-18.04', 'retired - use ubuntu-22.04 or newer'],
['windows-2019', 'retired - use windows-2022 or newer'],
['windows-2016', 'retired - use windows-2022 or newer'],
]);
let passed = 0;
function test(name, fn) { fn(); passed += 1; console.log(' ok -', name); }
// Every `runs-on:` in every workflow, and every matrix value one can expand to.
// A `runs-on: ${{ matrix.foo }}` is followed to the `foo:` entries of the matrix,
// which is where the real labels are - checking only the literal `runs-on:`
// lines would miss the arm64 and Intel-Mac legs entirely.
function collectLabels() {
const found = [];
for (const file of fs.readdirSync(workflowDir).filter(f => /\.ya?ml$/.test(f))) {
const text = fs.readFileSync(path.join(workflowDir, file), 'utf8');
text.split('\n').forEach((line, i) => {
const where = `${file}:${i + 1}`;
const direct = line.match(/^\s*runs-on:\s*(.+?)\s*$/);
if (direct) {
// Strip a trailing comment, and skip the expression forms - their real
// values come from the matrix keys matched below.
const value = direct[1].replace(/\s+#.*$/, '').replace(/^['"]|['"]$/g, '');
if (!value.includes('${{') && value !== '' && !value.startsWith('[')) {
found.push({ where, label: value });
}
return;
}
// Matrix entries that feed a runs-on, e.g. `runs_on: ubuntu-24.04-arm`
// or `- runs_on: macos-15-intel`.
const matrix = line.match(/^\s*-?\s*(?:runs_on|runner|runs-on-label):\s*(.+?)\s*$/);
if (matrix) {
const value = matrix[1].replace(/\s+#.*$/, '').replace(/^['"]|['"]$/g, '');
if (!value.includes('${{') && value !== '') found.push({ where, label: value });
}
});
}
return found;
}
const labels = collectLabels();
test('workflows declare at least one runner label (the scan is not silently empty)', () => {
assert.ok(labels.length >= 10,
`expected to find runner labels across .github/workflows, found ${labels.length}`);
});
test('no workflow asks for a runner label GitHub has retired', () => {
const dead = labels.filter(l => RETIRED.has(l.label));
assert.deepStrictEqual(dead, [],
'these runner labels are retired and will QUEUE FOREVER instead of failing:\n' +
dead.map(d => ` ${d.where}: ${d.label} - ${RETIRED.get(d.label)}`).join('\n'));
});
test('every runner label is one GitHub currently offers', () => {
const unknown = labels.filter(l => !CURRENT.has(l.label) && !RETIRED.has(l.label));
assert.deepStrictEqual(unknown, [],
'unknown runner label(s) - either GitHub added an image and CURRENT needs it, ' +
'or this is a typo that will queue forever:\n' +
unknown.map(u => ` ${u.where}: ${u.label}`).join('\n'));
});
test('build-mac-x64 asks for an Intel macOS runner, not an Apple Silicon one', () => {
const workflow = fs.readFileSync(path.join(workflowDir, 'release-all.yml'), 'utf8');
const start = workflow.indexOf('\n build-mac-x64:\n');
assert.notStrictEqual(start, -1, 'release-all.yml has no build-mac-x64 job');
const rest = workflow.slice(start + 1);
const next = rest.search(/\n [a-z0-9-]+:\n/);
const body = next === -1 ? rest : rest.slice(0, next);
const m = body.match(/^\s*runs-on:\s*(\S+)/m);
assert.ok(m, 'build-mac-x64 has no runs-on');
assert.ok(/-intel$/.test(m[1]),
`build-mac-x64 builds the x86_64 macOS bundle, so it needs an Intel runner ` +
`(macos-15-intel / macos-26-intel); it asks for "${m[1]}", which is Apple Silicon`);
});
console.log(`\n${passed} passed`);