ci: unify check and production deploy into one workflow
CI / check (push) Successful in 25s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m8s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-30 20:58:40 +02:00
1 parent bfbc02c75d
commit 3e584aadaf
4 files changed
+502 -483

No files matched your search

+14 -5
View File
@@ -8,18 +8,27 @@ describe("CI workflow", () => {
"utf8",
);
it("only runs check (lint/typecheck/test), not production deploy", () => {
it("runs check then production deploy on push to main", () => {
expect(workflow).toContain("pnpm biome:lint");
expect(workflow).toContain("pnpm typecheck");
expect(workflow).toContain("pnpm test");
expect(workflow).not.toMatch(/\n\s*deploy:\s*\n/);
expect(workflow).not.toContain("pm2 restart");
expect(workflow).not.toContain("pm2 start");
expect(workflow).toContain("needs: check");
expect(workflow).toContain(
"gitea.event_name == 'push' && gitea.ref_name == 'main'",
);
expect(workflow).toContain("worktree add --detach");
expect(workflow).toContain("/api/health");
expect(workflow).not.toContain("github.ref");
});
it("uses Gitea SHA for checkout", () => {
it("uses Gitea SHA for check checkout", () => {
expect(workflow).toContain("gitea.sha");
expect(workflow).toContain("SKIP_ENV_VALIDATION=1");
});
it("keeps tag release in the same workflow", () => {
expect(workflow).toContain('tags:\n - "v*"');
expect(workflow).toContain("Creating release for");
expect(workflow).toContain("startsWith(gitea.ref_name, 'v')");
});
});
+14 -2
View File
@@ -14,10 +14,22 @@ function toContainLiteral(workflow: string, literal: string) {
describe("production deploy workflow", () => {
const workflow = readFileSync(
resolve(process.cwd(), ".gitea/workflows/deploy.yaml"),
resolve(process.cwd(), ".gitea/workflows/ci.yaml"),
"utf8",
);
const deployJob = workflow.slice(workflow.indexOf("\n deploy:"));
const deployStart = workflow.indexOf("\n deploy:");
const afterDeploy = workflow.indexOf("\n release:", deployStart + 1);
const deployJob =
afterDeploy > deployStart
? workflow.slice(deployStart, afterDeploy)
: workflow.slice(deployStart);
it("is gated behind the check job", () => {
expect(deployJob).toContain("needs: check");
expect(deployJob).toContain(
"gitea.event_name == 'push' && gitea.ref_name == 'main'",
);
});
it("builds in a stage worktree while preserving live .env and storage", () => {
expect(deployJob).toContain("worktree add --detach");