From e4b8c0f6aacb71fc3c0659a6bb2133518d6e65fc Mon Sep 17 00:00:00 2001 From: Enzo Marioni Date: Thu, 1 Oct 2026 17:03:33 +0200 Subject: [PATCH] CI sur Gitea Actions par le workflow commun avalon-vanguard/ci MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .gitea/workflows/ci.yml appelle node.yml@v1 sur la même matrice (Node 20.x, 22.x, 24.x) et les mêmes déclencheurs que .github/workflows/ci.yml. Comme node.yml ne connaît que lint, typecheck, test, build et check : - « typecheck » renvoie à « type-check » ; - « check » enchaîne, dans l'ordre de la CI GitHub, les contrôles post-build : points d'entrée publiés, démo, check:types, check:docs, check:docs-sync. Les cinq « node -e » de chargement des points d'entrée passent dans scripts/check-entry-points.mjs, que la CI GitHub appelle aussi : les deux CI vérifient la même chose. node.yml lance « npm test » et non « test:coverage » : vitest.config.ts ne fixe aucun seuil et rien ne lit le rapport lcov, donc ce sont les mêmes tests qui décident. La CI GitHub garde test:coverage. Co-Authored-By: Claude Opus 5.5 (1M context) --- .gitea/workflows/ci.yml | 25 +++++++++++++++++++++++++ .github/workflows/ci.yml | 7 +------ package.json | 2 ++ scripts/check-entry-points.mjs | 18 ++++++++++++++++++ 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 scripts/check-entry-points.mjs diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..fc45bfe --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,25 @@ +# Contrôles de .github/workflows/ci.yml sur Gitea, par le workflow commun avalon-vanguard/ci. +# Ce dossier fait ignorer .github/workflows par Gitea ; GitHub continue d'exécuter les siens +# (CI, Pages, publication npm). Les contrôles post-build (points d'entrée, démo, types publiés, +# page de docs) sont regroupés dans le script « check ». +# +# node.yml lance « npm test », pas « test:coverage » : vitest.config.ts ne fixe aucun seuil de +# couverture et rien ne lit le rapport lcov, donc les mêmes tests décident du résultat. +name: CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + verify: + strategy: + fail-fast: false + matrix: + node: [20.x, 22.x, 24.x] + uses: avalon-vanguard/ci/.gitea/workflows/node.yml@v1 + with: + node-version: ${{ matrix.node }} + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ef2cf9..57c25c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,12 +34,7 @@ jobs: - name: Build run: npm run build - name: Verify published entry points load - run: | - node --input-type=module -e "import * as m from './dist/esm/index.js'; if (typeof m.toInstance !== 'function') throw new Error('ESM entry point broken');" - node --input-type=commonjs -e "const m = require('./dist/cjs/index.js'); if (typeof m.toInstance !== 'function') throw new Error('CJS entry point broken');" - node --input-type=module -e "import { standardDecorators } from './dist/esm/vite.js'; if (standardDecorators().enforce !== 'pre') throw new Error('ESM cereale/vite broken');" - node --input-type=commonjs -e "const { standardDecorators } = require('./dist/cjs/vite.js'); if (standardDecorators().enforce !== 'pre') throw new Error('CJS cereale/vite broken');" - node --input-type=module -e "import * as m from './dist/cereale.min.js'; if (typeof m.toInstanceSync !== 'function') throw new Error('flat bundle broken');" + run: node scripts/check-entry-points.mjs - name: Run Demo run: npm run demo - name: Published types stand alone diff --git a/package.json b/package.json index 42f43bf..2023bf5 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "build:docs": "node scripts/build-docs.mjs", "demo": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/example.ts", "type-check": "tsc --noEmit", + "typecheck": "npm run type-check", "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage", @@ -49,6 +50,7 @@ "lint:fix": "eslint . --fix", "verify": "npm run type-check && npm run lint && npm run test && npm run build && npm run check:types && npm run check:docs", "prepublishOnly": "npm run verify", + "check": "node scripts/check-entry-points.mjs && npm run demo && npm run check:types && npm run check:docs && npm run check:docs-sync", "check:docs": "node scripts/check-docs.mjs", "check:types": "node scripts/check-types.mjs", "check:docs-sync": "npm run build:docs && node scripts/check-docs-sync.mjs" diff --git a/scripts/check-entry-points.mjs b/scripts/check-entry-points.mjs new file mode 100644 index 0000000..e37071d --- /dev/null +++ b/scripts/check-entry-points.mjs @@ -0,0 +1,18 @@ +/** + * Fails if a published entry point does not load from dist/: `.` and `./vite`, each as ESM + * and as CommonJS, and the flat `./min` bundle. Run after `npm run build` (first step of + * `npm run check`). Moved here from inline `node -e` lines in .github/workflows/ci.yml so + * that the GitHub and Gitea workflows run the same check. + */ +import { createRequire } from 'node:module'; + +const require = createRequire(import.meta.url); +const assert = (ok, what) => { + if (!ok) throw new Error(`${what} broken`); +}; + +assert(typeof (await import('../dist/esm/index.js')).toInstance === 'function', 'ESM entry point'); +assert(typeof require('../dist/cjs/index.js').toInstance === 'function', 'CJS entry point'); +assert((await import('../dist/esm/vite.js')).standardDecorators().enforce === 'pre', 'ESM cereale/vite'); +assert(require('../dist/cjs/vite.js').standardDecorators().enforce === 'pre', 'CJS cereale/vite'); +assert(typeof (await import('../dist/cereale.min.js')).toInstanceSync === 'function', 'flat bundle');