Run Playwright validation in a supported container
Some checks failed
Validate Sokko G / validate (push) Failing after 13m41s
Some checks failed
Validate Sokko G / validate (push) Failing after 13m41s
This commit is contained in:
parent
daef542474
commit
a767616db4
4 changed files with 27 additions and 6 deletions
|
|
@ -6,6 +6,7 @@ import { test } from "node:test";
|
|||
import { promisify } from "node:util";
|
||||
|
||||
const deployWorkflowPath = ".forgejo/workflows/deploy-prod.yml";
|
||||
const packageLockPath = "package-lock.json";
|
||||
const remoteScriptPath = "scripts/deploy-sokko-g.sh";
|
||||
const servicePath = "ops/systemd/sokko-g.service";
|
||||
const validationWorkflowPath = ".forgejo/workflows/validate-main.yml";
|
||||
|
|
@ -16,6 +17,7 @@ test("main pushes run the complete gate without access to deployment secrets", a
|
|||
|
||||
assert.match(workflow, /push:\s+[\s\S]*branches:\s+[\s\S]*- main/);
|
||||
assert.match(workflow, /ref: \$\{\{ gitea\.sha \}\}/);
|
||||
assert.match(workflow, /container: "mcr\.microsoft\.com\/playwright:v1\.62\.1-noble@sha256:[0-9a-f]{64}"/);
|
||||
assert.match(workflow, /npm ci/);
|
||||
assert.match(workflow, /npm run check:full/);
|
||||
assert.doesNotMatch(workflow, /workflow_dispatch:/);
|
||||
|
|
@ -30,6 +32,7 @@ test("production deployment requires a validated exact commit and pinned SSH hos
|
|||
assert.doesNotMatch(workflow, /push:/);
|
||||
assert.match(workflow, /REQUESTED_COMMIT[\s\S]*\^\[0-9a-f\]\{40\}\$/);
|
||||
assert.match(workflow, /deploy:\s+[\s\S]*needs: validate/);
|
||||
assert.match(workflow, /validate:\s+[\s\S]*container: "mcr\.microsoft\.com\/playwright:v1\.62\.1-noble@sha256:[0-9a-f]{64}"/);
|
||||
assert.match(workflow, /npm ci/);
|
||||
assert.match(workflow, /npm run check:full/);
|
||||
assert.match(workflow, /git merge-base --is-ancestor "\$commit" origin\/main/);
|
||||
|
|
@ -45,6 +48,22 @@ test("production deployment requires a validated exact commit and pinned SSH hos
|
|||
assert.doesNotMatch(workflow, /\$\{\{\s*forgejo\./);
|
||||
});
|
||||
|
||||
test("validation containers match the locked Playwright release", async () => {
|
||||
const [lockContents, validationWorkflow, deployWorkflow] = await Promise.all([
|
||||
readFile(packageLockPath, "utf8"),
|
||||
readFile(validationWorkflowPath, "utf8"),
|
||||
readFile(deployWorkflowPath, "utf8")
|
||||
]);
|
||||
const lock = JSON.parse(lockContents);
|
||||
const playwrightVersion = lock.packages["node_modules/@playwright/test"].version;
|
||||
const expectedImage = `mcr.microsoft.com/playwright:v${playwrightVersion}-noble@sha256:`;
|
||||
|
||||
assert.ok(validationWorkflow.includes(expectedImage));
|
||||
assert.ok(deployWorkflow.includes(expectedImage));
|
||||
assert.doesNotMatch(validationWorkflow, /playwright install --with-deps/);
|
||||
assert.doesNotMatch(deployWorkflow, /playwright install --with-deps/);
|
||||
});
|
||||
|
||||
test("the versioned remote script builds and activates only the requested commit", async () => {
|
||||
await execFileAsync("bash", ["-n", remoteScriptPath]);
|
||||
const script = await readFile(remoteScriptPath, "utf8");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue