Root cause: de job-container (docker mode) heeft GEEN outbound internet naar GitHub, waardoor actions/checkout@v4 faalde met 'Unable to clone ... i/o timeout'. Oplossing: zowel check als deploy draaien nu op self-hosted (host) waar Node 26.8.1 + pnpm 11.25.0 geïnstalleerd zijn en internet beschikbaar is. Dit is de enige betrouwbare setup in deze omgeving. Runner is tevens hernoemd naar 'Epic runner'.
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const workflow = readFileSync(
|
|
resolve(process.cwd(), ".gitea/workflows/ci.yaml"),
|
|
"utf8",
|
|
);
|
|
const deployStart = workflow.indexOf("\n deploy:");
|
|
const deployJob = deployStart > -1 ? workflow.slice(deployStart) : "";
|
|
|
|
describe("deploy job", () => {
|
|
it("runs on self-hosted for Docker access", () => {
|
|
expect(deployJob).toContain("runs-on: self-hosted");
|
|
});
|
|
|
|
it("has checkout step", () => {
|
|
expect(deployJob).toContain("actions/checkout@v4");
|
|
});
|
|
|
|
it("builds Docker image with BuildKit", () => {
|
|
expect(deployJob).toContain("DOCKER_BUILDKIT=1");
|
|
expect(deployJob).toContain("docker build");
|
|
expect(deployJob).toContain("-t epicnext-cms:latest");
|
|
});
|
|
|
|
it("stops old container before starting new one", () => {
|
|
expect(deployJob).toContain("docker stop epicnext-cms-app");
|
|
expect(deployJob).toContain("docker rm epicnext-cms-app");
|
|
});
|
|
|
|
it("starts container with correct settings", () => {
|
|
expect(deployJob).toContain("--restart always");
|
|
expect(deployJob).toContain("--net=host");
|
|
expect(deployJob).toContain("--name epicnext-cms-app");
|
|
});
|
|
|
|
it("runs health check", () => {
|
|
expect(deployJob).toContain("/api/health");
|
|
expect(deployJob).toContain('"database":true');
|
|
});
|
|
|
|
it("cleans up old images", () => {
|
|
expect(deployJob).toContain("docker image prune -f");
|
|
});
|
|
|
|
it("does not run pnpm test in deploy", () => {
|
|
expect(deployJob).not.toContain("pnpm test");
|
|
});
|
|
|
|
it("shows docker logs on failure", () => {
|
|
expect(deployJob).toContain("docker logs epicnext-cms-app");
|
|
});
|
|
|
|
it("exits with error on health check failure", () => {
|
|
expect(deployJob).toContain("exit 1");
|
|
});
|
|
});
|