mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 20:17:20 +00:00
ci: speed up zuey beta deploy (#127)
* ci: speed up zuey beta deploy * ci: mark issue 88 plan complete
This commit is contained in:
1 parent
94cbaa9f0f
commit
64c02ea5a6
9 files changed
+460
-15
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = resolve(here, "../..");
|
||||
const workflow = readFileSync(join(repoRoot, ".github/workflows/dev-beta-release.yaml"), "utf8");
|
||||
|
||||
function jobBlock(name) {
|
||||
const lines = workflow.split("\n");
|
||||
const start = lines.findIndex((line) => line === ` ${name}:`);
|
||||
assert.notEqual(start, -1, `missing job ${name}`);
|
||||
|
||||
let end = lines.length;
|
||||
for (let index = start + 1; index < lines.length; index += 1) {
|
||||
if (/^ [A-Za-z0-9_]+:$/.test(lines[index])) {
|
||||
end = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lines.slice(start + 1, end).join("\n");
|
||||
}
|
||||
|
||||
test("dev beta workflow does not serialize fast deploy behind full artifact completion", () => {
|
||||
assert.doesNotMatch(workflow, /^concurrency:\n/m);
|
||||
|
||||
const publishRelease = jobBlock("publish_release");
|
||||
assert.match(publishRelease, /needs: \[beta_version, build_zuey_binary\]/);
|
||||
assert.doesNotMatch(publishRelease, /promote_beta_aliases|docker_images|build_remaining_binaries/);
|
||||
|
||||
const deployZuey = jobBlock("deploy_zuey_beta");
|
||||
assert.match(deployZuey, /needs: \[beta_version, publish_release\]/);
|
||||
assert.doesNotMatch(deployZuey, /promote_beta_aliases|docker_images|complete_release_artifacts/);
|
||||
});
|
||||
|
||||
test("dev beta workflow publishes zuey amd64 asset before completing all release assets", () => {
|
||||
const buildZuey = jobBlock("build_zuey_binary");
|
||||
assert.match(buildZuey, /GOARCH: amd64/);
|
||||
assert.match(buildZuey, /name: binary-linux-amd64/);
|
||||
|
||||
const remainingBinaries = jobBlock("build_remaining_binaries");
|
||||
assert.match(remainingBinaries, /goarch: arm64/);
|
||||
assert.match(remainingBinaries, /name: binary-\$\{\{ matrix\.goos \}\}-\$\{\{ matrix\.goarch \}\}/);
|
||||
|
||||
const completion = jobBlock("complete_release_artifacts");
|
||||
assert.match(completion, /needs: \[beta_version, publish_release, build_zuey_binary, build_remaining_binaries\]/);
|
||||
assert.match(completion, /pattern: binary-\*/);
|
||||
assert.match(completion, /sha256sum goclaw-\*\.tar\.gz > CHECKSUMS\.sha256/);
|
||||
});
|
||||
|
||||
test("dev beta workflow skips stale deploy and alias mutations", () => {
|
||||
for (const name of ["deploy_zuey_beta", "promote_beta_aliases"]) {
|
||||
const block = jobBlock(name);
|
||||
assert.match(block, /id: beta_freshness/);
|
||||
assert.match(block, /latest_beta/);
|
||||
assert.match(block, /Skipping stale/);
|
||||
assert.match(block, /steps\.beta_freshness\.outputs\.current == 'true'/);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user