- Split approve/dismiss application workflows with distinct audit logs, rate-limited guards and real error logging - Validate article status/date/id input and stop resetting publishedAt on every update - Validate guild updates (state, forum enums, non-empty name) behind rate-limited guard - Fix scheduled-article publishing (ignore NULL dates, set updatedAt, type-safe predicates) - Harden admin search API (LIKE escaping, query cap, per-user rate limit, round-robin result cap) and fix search dialog abort/res.ok/loading races - Lock down HTML sanitizer to an allowlist profile and add XSS tests - Improve mobile nav accessibility (unique id, dialog role, focus management, scroll lock, outside close) - Log swallowed server errors instead of silent catch blocks - Remove dead eslint config, drop unused dompurify deps, restore knip CI step, add Playwright config with smoke spec
94 lines
2.9 KiB
TypeScript
94 lines
2.9 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("builds on host network for registry access", () => {
|
|
expect(deployJob).toContain("--network=host");
|
|
});
|
|
|
|
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("provides production .env to the build", () => {
|
|
expect(deployJob).toContain("cp /var/www/atom-nexst/.env .env");
|
|
});
|
|
|
|
it("runs container with production env and volumes", () => {
|
|
expect(deployJob).toContain(". /var/www/atom-nexst/.env");
|
|
// biome-ignore lint/suspicious/noTemplateCurlyInString: intentional literal shell snippet
|
|
expect(deployJob).toContain('"${ENV_ARGS[@]}"');
|
|
expect(deployJob).toContain("/var/www/Gamedata:/var/www/Gamedata");
|
|
expect(deployJob).toContain("/app/storage");
|
|
});
|
|
|
|
it("does not use --env-file (it keeps literal quotes)", () => {
|
|
expect(deployJob).not.toContain("--env-file");
|
|
});
|
|
|
|
it("frees port 3002 by stopping the compose container", () => {
|
|
expect(deployJob).toContain("docker stop epicnext-cms 2>/dev/null || true");
|
|
});
|
|
|
|
it("rolls back to compose on health check failure", () => {
|
|
expect(deployJob).toContain("docker compose");
|
|
});
|
|
|
|
it("runs database migrations before replacing the container", () => {
|
|
expect(deployJob).toContain("pnpm db:migrate");
|
|
expect(deployJob.indexOf("pnpm db:migrate")).toBeLessThan(
|
|
deployJob.indexOf("docker stop 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");
|
|
});
|
|
});
|