CI : workflow validate.yml, manifeste ci.required:true, garde VITEST, tests isolés
This commit is contained in:
45
.gitea/workflows/validate.yml
Normal file
45
.gitea/workflows/validate.yml
Normal 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
|
||||||
10
app.json
10
app.json
@@ -2,9 +2,15 @@
|
|||||||
"id": "formation-manager-itinova",
|
"id": "formation-manager-itinova",
|
||||||
"name": "Formation Manager",
|
"name": "Formation Manager",
|
||||||
"category": "ITINOVA",
|
"category": "ITINOVA",
|
||||||
"urls": {"recette": "https://formations.recette.santinova-soft.org", "prod": "https://formations.santinova-soft.org"},
|
"urls": {
|
||||||
|
"recette": "https://formations.recette.santinova-soft.org",
|
||||||
|
"prod": "https://formations.santinova-soft.org"
|
||||||
|
},
|
||||||
"containerName": "formation-manager-itinova",
|
"containerName": "formation-manager-itinova",
|
||||||
"image": "images/formation-manager.png",
|
"image": "images/formation-manager.png",
|
||||||
"giteaRepo": "formation-manager-itinova",
|
"giteaRepo": "formation-manager-itinova",
|
||||||
"giteaOwner": "manus-admin"
|
"giteaOwner": "manus-admin",
|
||||||
|
"ci": {
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { describe, it, expect, beforeAll } from "vitest";
|
import { describe, it, expect, beforeAll } from "vitest";
|
||||||
|
|
||||||
|
// En CI, skip si pas de DATABASE_URL.
|
||||||
|
const describeIntegration = process.env.DATABASE_URL ? describe : describe.skip;
|
||||||
import { getDb } from "../db";
|
import { getDb } from "../db";
|
||||||
import { users } from "../../drizzle/schema";
|
import { users } from "../../drizzle/schema";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
|
||||||
describe("Local Authentication", () => {
|
describeIntegration("Local Authentication", () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
// Vérifier que la base de données est accessible
|
// Vérifier que la base de données est accessible
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
|
|||||||
@@ -94,4 +94,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);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user