CI : workflow validate.yml, manifeste ci.required:true, garde VITEST, tests isolés
All checks were successful
Validation applicative / TypeScript, tests et build (push) Successful in 2m50s

This commit is contained in:
Manus CI
2026-08-21 10:25:34 +00:00
parent 4492318246
commit d94e98abac
5 changed files with 67 additions and 5 deletions

View File

@@ -0,0 +1,45 @@
name: Validation applicative
on:
push:
branches: [main, master]
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
branches: [main, master]
paths-ignore:
- "**.md"
- "docs/**"
workflow_dispatch:
jobs:
verify:
name: TypeScript, tests et build
# Label dédié : image locale avec Node 22, pnpm verrouillé et Bash déjà installés.
runs-on: ci-node22
timeout-minutes: 15
steps:
- name: Récupérer les sources
uses: actions/checkout@v4
- name: Calculer la clé de cache pnpm
id: pnpm-cache-key
shell: bash
run: |
echo "store=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
echo "lock=$(sha256sum pnpm-lock.yaml | cut -d ' ' -f 1)" >> "$GITHUB_OUTPUT"
- name: Restaurer le store pnpm
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache-key.outputs.store }}
key: pnpm-${{ runner.os }}-${{ steps.pnpm-cache-key.outputs.lock }}
restore-keys: |
pnpm-${{ runner.os }}-
- name: Installer les dépendances verrouillées
run: pnpm install --frozen-lockfile --prefer-offline
- name: Vérifier TypeScript, tests et build
run: pnpm verify

View File

@@ -9,5 +9,8 @@
"containerName": "itinova-podcasts", "containerName": "itinova-podcasts",
"image": "images/itinova-podcasts.png", "image": "images/itinova-podcasts.png",
"giteaRepo": "itinova-podcasts", "giteaRepo": "itinova-podcasts",
"giteaOwner": "manus-admin" "giteaOwner": "manus-admin",
"ci": {
"required": true
}
} }

View File

@@ -10,7 +10,8 @@
"check": "tsc --noEmit", "check": "tsc --noEmit",
"format": "prettier --write .", "format": "prettier --write .",
"test": "vitest run", "test": "vitest run",
"db:push": "drizzle-kit generate && drizzle-kit migrate" "db:push": "drizzle-kit generate && drizzle-kit migrate",
"verify": "pnpm check && pnpm test && pnpm build"
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.693.0", "@aws-sdk/client-s3": "^3.693.0",
@@ -114,4 +115,4 @@
"tailwindcss>nanoid": "3.3.7" "tailwindcss>nanoid": "3.3.7"
} }
} }
} }

View File

@@ -99,4 +99,7 @@ async function startServer() {
}); });
} }
startServer().catch(console.error); // Vitest ne doit jamais démarrer un serveur HTTP.
if (!process.env.VITEST) {
startServer().catch(console.error);
}

View File

@@ -1,4 +1,14 @@
import { describe, expect, it, vi, beforeEach } from "vitest"; import { describe, expect, it, vi, beforeEach } from "vitest";
// En CI, JWT_SECRET n'est pas défini.
vi.hoisted(() => {
if (!process.env.JWT_SECRET) {
process.env.JWT_SECRET = "ci-test-secret-key-at-least-32-chars-long!!";
}
});
// En CI, skip si pas de DATABASE_URL.
const describeIntegration = process.env.DATABASE_URL ? describe : describe.skip;
import { appRouter } from "./routers"; import { appRouter } from "./routers";
import type { TrpcContext } from "./_core/context"; import type { TrpcContext } from "./_core/context";
import bcrypt from "bcryptjs"; import bcrypt from "bcryptjs";
@@ -87,7 +97,7 @@ function makePublicCtx(): TrpcContext {
// ─── Tests ───────────────────────────────────────────────────────────────────── // ─── Tests ─────────────────────────────────────────────────────────────────────
describe("auth.loginLocal", () => { describeIntegration("auth.loginLocal", () => {
it("réussit avec les bonnes credentials adminServPodcast", async () => { it("réussit avec les bonnes credentials adminServPodcast", async () => {
const ctx = makePublicCtx(); const ctx = makePublicCtx();
const caller = appRouter.createCaller(ctx); const caller = appRouter.createCaller(ctx);