feat : dev on prod
CI / Build immutable images and deploy (push) Successful in 1m52s

This commit is contained in:
2026-09-16 20:19:27 +07:00 Unverified
parent 2799103dd0
commit 910afdeb71
11 changed files with 87 additions and 4 deletions
+12 -1
View File
@@ -91,7 +91,12 @@ describe("production deployment contract", () => {
expect(dockerfile.match(/^USER 1000:1000$/gmu)).toHaveLength(2);
expect(dockerfile).toContain('ENTRYPOINT ["bun", "scripts/migrate.ts"]');
expect(dockerfile).toContain('CMD ["bun", "server.js"]');
expect(dockerfile).toContain("ARG BASE_URL\nENV BASE_URL=${BASE_URL}");
expect(dockerfile).toContain("ARG BASE_URL");
expect(dockerfile).toContain("ENV BASE_URL=${BASE_URL}");
expect(dockerfile).toContain("ARG NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID");
expect(dockerfile).toContain(
"ENV NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID=${NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID}",
);
expect(dockerfile).toContain("backend/discord.ts");
expect(dockerfile).toContain("./worker/discord.js");
});
@@ -106,6 +111,9 @@ describe("production deployment contract", () => {
expect(workflow).toContain("kubectl kustomize k8s/");
expect(workflow).toContain("--target app");
expect(workflow).toContain('--build-arg BASE_URL="$BASE_URL"');
expect(workflow).toContain(
'--build-arg NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID="$NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID"',
);
expect(workflow).toContain('\\"BASE_URL\\":\\"$BASE_URL\\"');
expect(workflow).toContain("--target migration");
expect(workflow).not.toContain("platforms: linux/arm64");
@@ -167,6 +175,9 @@ describe("environment template contract", () => {
expect(environmentExample).toMatch(new RegExp(`^${key}=`, "mu"));
}
expect(environmentExample).toContain("BUZZ_DEMO_MODE=false");
expect(environmentExample).toContain(
"NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID=ca-pub-9687404323559597",
);
});
it("runs Discord catalog sync as an isolated worker", async () => {
+21
View File
@@ -55,4 +55,25 @@ describe("public rendering performance", () => {
sitemap: "https://guide.example.test/sitemap.xml",
});
});
it("loads AdSense only after confirming the visitor is signed out", async () => {
const [adsense, home, guide, guideSection, adsTxt] = await Promise.all([
repositoryFile("components/public/google-adsense.tsx"),
repositoryFile("app/page.tsx"),
repositoryFile("app/[character]/page.tsx"),
repositoryFile("app/[character]/[page]/page.tsx"),
repositoryFile("public/ads.txt"),
]);
expect(adsense).toContain("authClient.useSession()");
expect(adsense).toContain('process.env.NODE_ENV !== "production"');
expect(adsense).toMatch(/isPending \|\|\s+error \|\|\s+session/u);
expect(adsense).toContain("pagead2.googlesyndication.com");
expect(home).toContain("<GoogleAdsense />");
expect(guide).toContain("<GoogleAdsense />");
expect(guideSection).toContain("<GoogleAdsense />");
expect(adsTxt.trim()).toBe(
"google.com, pub-9687404323559597, DIRECT, f08c47fec0942fa0",
);
});
});