Gitea Actions ignore .github/workflows/ dès que .gitea/workflows/ existe (ajouté avec prod.yml). Résultat : ci.yml et release.yml ne se déclenchaient plus (ni CI sur push, ni publication sur tag). On les remet dans le répertoire effectivement lu par Gitea.
85 lines
3.0 KiB
YAML
85 lines
3.0 KiB
YAML
# CI Arboretum : build + tests sur Node 22/24, puis smoke de packaging npx.
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Build & test (Node ${{ matrix.node }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: [22, 24]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run typecheck
|
|
- run: npm run build
|
|
- run: npm run build:site
|
|
- run: npx vitest run
|
|
|
|
pack-smoke:
|
|
name: Pack & boot smoke (Node 22)
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run build
|
|
# @arboretum/shared (paquet workspace NON publié) est INLINÉ dans dist/_shared au prepack
|
|
# (scripts/inline-shared.mjs) : le tarball est 100 % autonome — aucun node_modules embarqué,
|
|
# aucune bundleDependency, aucun symlink. On packe en mode workspace (-w), EXACTEMENT comme
|
|
# le fait « npm publish » dans release.yml, puis on l'installe seul comme un vrai consommateur.
|
|
- name: Pack tarball
|
|
run: |
|
|
rm -rf /tmp/tarballs && mkdir -p /tmp/tarballs
|
|
npm pack -w @johanleroy/git-arboretum --pack-destination /tmp/tarballs
|
|
ls -l /tmp/tarballs
|
|
- name: Assert the package is self-contained (@arboretum/shared inlined)
|
|
run: |
|
|
tgz=$(ls /tmp/tarballs/*.tgz)
|
|
rm -rf /tmp/inspect && mkdir -p /tmp/inspect && tar -xzf "$tgz" -C /tmp/inspect
|
|
test -f /tmp/inspect/package/dist/_shared/index.js \
|
|
|| { echo "ERREUR: dist/_shared/index.js absent de $tgz — inline-shared n'a pas tourné ?"; exit 1; }
|
|
if grep -rq '@arboretum/shared' /tmp/inspect/package/dist; then
|
|
echo "ERREUR: import bare '@arboretum/shared' encore présent dans le JS publié"
|
|
grep -rn '@arboretum/shared' /tmp/inspect/package/dist; exit 1
|
|
fi
|
|
echo "OK: paquet autonome — shared inliné dans dist/_shared, aucun import externe"
|
|
- name: Install tarball in an empty project
|
|
run: |
|
|
mkdir /tmp/smoke
|
|
cd /tmp/smoke
|
|
npm init -y
|
|
npm i /tmp/tarballs/*.tgz
|
|
- name: Boot smoke (expect 401 on /api/v1/sessions)
|
|
run: |
|
|
cd /tmp/smoke
|
|
timeout 30 node_modules/.bin/arboretum --port 7999 --db ./t.db &
|
|
server_pid=$!
|
|
code=000
|
|
for i in $(seq 1 20); do
|
|
sleep 0.5
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:7999/api/v1/sessions || true)
|
|
if [ "$code" = "401" ]; then break; fi
|
|
done
|
|
echo "GET /api/v1/sessions -> HTTP $code"
|
|
kill "$server_pid" 2>/dev/null || true
|
|
test "$code" = "401"
|