From 295bb263784379f747e1e5c0cb8d2d856510add2 Mon Sep 17 00:00:00 2001 From: Manus CI Date: Fri, 21 Aug 2026 11:15:58 +0000 Subject: [PATCH] =?UTF-8?q?CI=20:=20workflow=20validate.yml,=20manifeste?= =?UTF-8?q?=20ci.required:true,=20garde=20VITEST,=20tests=20isol=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/validate.yml | 45 ++++++++++++++++++++++++++++++++++ app.json | 10 ++++++-- package.json | 5 ++-- server/_core/index.ts | 5 +++- server/llmFieldsConfig.test.ts | 4 ++- 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/validate.yml diff --git a/.gitea/workflows/validate.yml b/.gitea/workflows/validate.yml new file mode 100644 index 0000000..7023c2b --- /dev/null +++ b/.gitea/workflows/validate.yml @@ -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 diff --git a/app.json b/app.json index 343eea8..9575a94 100644 --- a/app.json +++ b/app.json @@ -2,9 +2,15 @@ "id": "demat-facturation-dsi", "name": "Démat. Facturation DSI", "category": "SANTINOVA", - "urls": {"recette": "https://demat-facturation.recette.santinova-soft.org", "prod": "https://demat-facturation.santinova-soft.org"}, + "urls": { + "recette": "https://demat-facturation.recette.santinova-soft.org", + "prod": "https://demat-facturation.santinova-soft.org" + }, "containerName": "demat-facturation-app", "image": "images/demat-facturation-dsi.jpg", "giteaRepo": "demat-facturation-dsi", - "giteaOwner": "manus-admin" + "giteaOwner": "manus-admin", + "ci": { + "required": true + } } diff --git a/package.json b/package.json index bda85c8..dc04c1d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "check": "tsc --noEmit", "format": "prettier --write .", "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": { "@aws-sdk/client-s3": "^3.693.0", @@ -141,4 +142,4 @@ "sharp" ] } -} \ No newline at end of file +} diff --git a/server/_core/index.ts b/server/_core/index.ts index 529c79c..77ff011 100644 --- a/server/_core/index.ts +++ b/server/_core/index.ts @@ -393,4 +393,7 @@ async function startServer() { }, 5000); // Attendre 5s que le serveur soit prêt } -startServer().catch(console.error); +// Vitest ne doit jamais démarrer un serveur HTTP. +if (!process.env.VITEST) { + startServer().catch(console.error); +} diff --git a/server/llmFieldsConfig.test.ts b/server/llmFieldsConfig.test.ts index d5c9c58..15be5e1 100644 --- a/server/llmFieldsConfig.test.ts +++ b/server/llmFieldsConfig.test.ts @@ -1,11 +1,13 @@ import { describe, it, expect, beforeAll } from "vitest"; + +const describeIntegration = process.env.DATABASE_URL ? describe : describe.skip; import { getLlmFieldsConfigByUser, upsertLlmFieldConfig, initializeDefaultLlmFields } from "./db"; -describe("LLM Fields Configuration", () => { +describeIntegration("LLM Fields Configuration", () => { const testUserId = 99999; // Use a high ID to avoid conflicts beforeAll(async () => {