refactor(ci): volledig opnieuw geschreven CI workflow
- Check job: lint, typecheck, test in node:26 container - Deploy job: Docker build + deploy + health check op host - Corepack pnpm installatie - BuildKit caching - Contract tests herschreven (18 tests)
This commit is contained in:
1 parent
a52cbead8a
commit
3c0acc3fcf
3 files changed
+91
-83
No files matched your search
@@ -2,32 +2,50 @@ import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("CI workflow", () => {
|
||||
const workflow = readFileSync(
|
||||
resolve(process.cwd(), ".gitea/workflows/ci.yaml"),
|
||||
"utf8",
|
||||
).replace(/\r\n/g, "\n");
|
||||
const workflow = readFileSync(
|
||||
resolve(process.cwd(), ".gitea/workflows/ci.yaml"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
it("runs check then production deploy on push to main", () => {
|
||||
describe("CI workflow", () => {
|
||||
it("has check and deploy jobs", () => {
|
||||
expect(workflow).toContain("check:");
|
||||
expect(workflow).toContain("deploy:");
|
||||
});
|
||||
|
||||
it("deploy depends on check", () => {
|
||||
expect(workflow).toContain("needs: check");
|
||||
});
|
||||
|
||||
it("deploy only runs on push to main/master", () => {
|
||||
expect(workflow).toContain("gitea.event_name == 'push'");
|
||||
expect(workflow).toContain("gitea.ref_name == 'main'");
|
||||
});
|
||||
|
||||
it("check runs lint, typecheck, and test", () => {
|
||||
expect(workflow).toContain("pnpm biome:lint");
|
||||
expect(workflow).toContain("pnpm typecheck");
|
||||
expect(workflow).toContain("pnpm test");
|
||||
expect(workflow).toContain("needs: check");
|
||||
expect(workflow).toContain("gitea.event_name == 'push'");
|
||||
expect(workflow).toContain("gitea.ref_name == 'main'");
|
||||
expect(workflow).toContain("/api/health");
|
||||
});
|
||||
|
||||
it("deploy uses self-hosted runner", () => {
|
||||
expect(workflow).toContain("runs-on: self-hosted");
|
||||
});
|
||||
|
||||
it("check uses ubuntu-latest runner", () => {
|
||||
expect(workflow).toContain("runs-on: ubuntu-latest");
|
||||
});
|
||||
|
||||
it("installs pnpm via corepack", () => {
|
||||
expect(workflow).toContain("corepack enable");
|
||||
expect(workflow).toContain("corepack prepare [email protected]");
|
||||
});
|
||||
|
||||
it("does not use github context", () => {
|
||||
expect(workflow).not.toContain("github.ref");
|
||||
});
|
||||
|
||||
it("uses Gitea SHA for check checkout", () => {
|
||||
expect(workflow).toContain("SKIP_ENV_VALIDATION");
|
||||
});
|
||||
|
||||
it("includes tag triggers", () => {
|
||||
expect(workflow).toContain('tags:\n - "v*"');
|
||||
});
|
||||
|
||||
it("sets test environment variables as global env", () => {
|
||||
expect(workflow).toContain("SKIP_ENV_VALIDATION: 1");
|
||||
it("has tag trigger", () => {
|
||||
expect(workflow).toContain('tags: ["v*"]');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user