mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
The v10.89 run failed four more jobs, the same two mistakes one step further along. THE WINDOWS JOBS check this repository out to path: src, so the scripts were addressed as src/releases/... - correct until the bcrypt step does pushd "$TMP", after which a relative path resolves against a temp directory: bash: src/releases/npm-retry.sh: No such file or directory The location is now fixed before anything moves - SRC="$PWD/src" at the top of the step, then "$SRC/releases/..." - in the eighteen blocks that need it, and the same for the ucs job's univention/. THE DOWNLOADS THAT ARE NOT IN A WORKFLOW. snapcraft.yaml builds the snap in its own container and sandstorm-src/build-deps.sh runs on the runner; both still used a bare curl, and github.com's 503s took them out: :: curl: (56) Connection died, tried 5 times before giving up :: caddy: no linux/arm64 archive in Caddy 2.11.4 - nothing left to try. ==> [4/7] FerretDB v1 (amd64) at deps root curl: (56) Connection died, tried 5 times before giving up Both go through releases/fetch.sh now - the snap parts reach it through CRAFT_PROJECT_DIR, since snapcraft mounts the project into the build - so the caddy, MongoDB, mongod 4.2/5.0 and OpenSSL downloads, the meteor-spk and Node.js tarballs and the FerretDB binary all wait an outage out. The Caddy version LOOKUP stays a plain curl: when it fails the pinned version is used, which is what it is for. curl https://install.sandstorm.io | sudo bash became a download and a run, because a pipe cannot be retried. tests/workflowRepoScripts.test.cjs grew the two checks that would have caught these, and releaseBuildJobsCheckout accepts $SRC/releases as the same statement as src/releases, made absolute. Thanks to xet7 !
109 lines
4.3 KiB
JavaScript
109 lines
4.3 KiB
JavaScript
'use strict';
|
|
|
|
// Plain-Node guard for release-all.yml: every build job that runs a repo script
|
|
// (releases/require-binaries.sh) must first check the repo out where the call
|
|
// looks for it. Run: node tests/releaseBuildJobsCheckout.test.cjs
|
|
//
|
|
// The bundle-embed jobs download a prebuilt bundle artifact rather than building
|
|
// from a checkout, so it is easy to add a `bash releases/...` step to one and
|
|
// forget it has no repo on disk. That is exactly what happened when
|
|
// require-binaries.sh was wired in: build-arm64 and build-mac-arm64 had NO
|
|
// checkout at all and died with exit 127 ("releases/require-binaries.sh: No such
|
|
// file or directory"), and build-win64 checked the repo out into src/ but called
|
|
// the script at the workspace root. All three failed before building a bundle.
|
|
//
|
|
// This pins, for each job that runs require-binaries.sh:
|
|
// * the job checks the repo out (actions/checkout), and
|
|
// * the checkout LOCATION matches the path the call uses - `path: src` when the
|
|
// call is `bash src/releases/...`, the workspace root otherwise, and
|
|
// * a root checkout precedes download-artifact, since checkout cleans the
|
|
// workspace and would otherwise wipe the downloaded bundle.
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const repoRoot = path.resolve(__dirname, '..');
|
|
const workflow = fs.readFileSync(
|
|
path.join(repoRoot, '.github/workflows/release-all.yml'), 'utf8',
|
|
);
|
|
|
|
// Slice out one job's text block: from its ` name:` line to the next job.
|
|
function job(name) {
|
|
const start = workflow.indexOf(`\n ${name}:\n`);
|
|
assert.notStrictEqual(start, -1, `release-all.yml has no ${name} job`);
|
|
const rest = workflow.slice(start + 1);
|
|
const next = rest.search(/\n [a-z0-9-]+:\n/);
|
|
return next === -1 ? rest : rest.slice(0, next);
|
|
}
|
|
|
|
let passed = 0;
|
|
function test(name, fn) {
|
|
fn();
|
|
passed += 1;
|
|
console.log(' ok -', name);
|
|
}
|
|
|
|
// Every build job that runs require-binaries.sh. If a new one is added it should
|
|
// be listed here so this guard covers it too.
|
|
const JOBS = ['build-amd64', 'build-arm64', 'build-win64', 'build-mac-arm64'];
|
|
|
|
test('every build job actually runs the binary pre-check', () => {
|
|
for (const name of JOBS) {
|
|
assert.ok(
|
|
// The Windows jobs check out to src/ and name it through $SRC, fixed at
|
|
// the top of the step - a relative path stops resolving as soon as the
|
|
// step pushd's (tests/workflowRepoScripts.test.cjs).
|
|
/bash\s+"?(?:\$SRC\/|src\/)?releases\/require-binaries\.sh/.test(job(name)),
|
|
`${name} should run require-binaries.sh`,
|
|
);
|
|
}
|
|
});
|
|
|
|
for (const name of JOBS) {
|
|
test(`${name} checks the repo out where its require-binaries.sh call looks`, () => {
|
|
const body = job(name);
|
|
|
|
// `$SRC/` is the same statement as `src/`, made absolute at the top of the
|
|
// step so it survives a pushd - see tests/workflowRepoScripts.test.cjs.
|
|
const call = body.match(/bash\s+"?(\$SRC\/|src\/)?releases\/require-binaries\.sh/);
|
|
assert.ok(call, `${name} runs require-binaries.sh`);
|
|
const callAtSrc = Boolean(call[1]);
|
|
|
|
const checkoutIdx = body.indexOf('actions/checkout@');
|
|
assert.notStrictEqual(
|
|
checkoutIdx, -1,
|
|
`${name} must check the repo out, or require-binaries.sh is absent (exit 127)`,
|
|
);
|
|
|
|
// The `with:` of that checkout - enough to see whether it sets `path: src`.
|
|
const checkoutBlock = body.slice(checkoutIdx, checkoutIdx + 220);
|
|
const checkoutAtSrc = /path:\s*src\b/.test(checkoutBlock);
|
|
assert.strictEqual(
|
|
checkoutAtSrc, callAtSrc,
|
|
callAtSrc
|
|
? `${name} calls src/releases/... so its checkout must set 'path: src'`
|
|
: `${name} calls releases/... at the root, so its checkout must land at the root (no 'path: src')`,
|
|
);
|
|
|
|
assert.ok(
|
|
checkoutIdx < body.indexOf(call[0]),
|
|
`${name}: the checkout must precede the require-binaries.sh call`,
|
|
);
|
|
|
|
// A root checkout cleans the workspace, so it has to run before the bundle is
|
|
// downloaded into that same workspace; otherwise it wipes it.
|
|
if (!callAtSrc) {
|
|
const dlIdx = body.indexOf('download-artifact@');
|
|
if (dlIdx !== -1) {
|
|
assert.ok(
|
|
checkoutIdx < dlIdx,
|
|
`${name}: a root checkout must precede download-artifact, or it wipes the downloaded bundle`,
|
|
);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
console.log(`\nreleaseBuildJobsCheckout: all ${passed} tests passed`);
|