From 4cae76b21d4312af3f8dc2aefc4814f89de7cef7 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Thu, 12 Nov 2026 09:10:52 +0100 Subject: [PATCH] Builds the test site separately with the CMS packages and adds a nightly test build The check job builds dist without a CMS address, so what goes to production keeps the committed package list. A new build-test job builds with OFFERINGS_URL from ASF_OFFERINGS_URL_TEST and feeds only deploy-test. A nightly schedule (03:15 UTC) deploys the test site; Lighthouse is skipped for it. Co-Authored-By: Claude Sonnet 5.5 --- .gitea/workflows/continuous_integration.yaml | 69 +++++++++++++++++--- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/continuous_integration.yaml b/.gitea/workflows/continuous_integration.yaml index 36895fa..9b58bda 100644 --- a/.gitea/workflows/continuous_integration.yaml +++ b/.gitea/workflows/continuous_integration.yaml @@ -3,6 +3,7 @@ name: Continuous Integration # Branchstrategie (zie aidlc-docs/.../operations/deployment/deployment-plan.md): # - Pull request → controles, geen deploy # - Merge/push naar master → controles + automatisch naar test +# - Elke nacht (schedule) → controles + naar test, met de pakketten uit het CMS # - Handmatig, elke branch → controles + naar test als 'Deploy to Test' aan staat # - Handmatig, release/* → controles + naar productie als 'Deploy to Production' aan staat on: @@ -20,6 +21,12 @@ on: types: [opened, synchronize, reopened] push: branches: [master] + # Elke nacht een testbuild, zodat een wijziging van de pakketten in het CMS + # op de testsite komt (de build haalt ze op). Alleen test, nooit productie. + # 03:15 UTC (04:15 of 05:15 Nederlandse tijd), buiten kantooruren en niet op + # een heel uur. Gitea draait schedules alleen vanaf de standaardbranch. + schedule: + - cron: '15 3 * * *' # Alleen bij pull requests een verouderde run afbreken; een deploy wordt nooit # halverwege gestopt. @@ -84,17 +91,13 @@ jobs: run: pnpm test # Sentry toont bij elke fout uit welke commit de build komt - # De pakketten en prijzen komen uit het CMS: de build haalt ze op - # (web/config/fetchOfferings.ts) en valt bij een storing terug op de - # gecommitte lijst. ASF_OFFERINGS_URL (repo-variabele) is het adres dat - # /api/v1/offerings serveert, zonder is de fallback de bron. Let op: dit - # artefact is ook wat naar productie gaat; zet de variabele dus op het - # CMS waar de echte gegevens staan. + # Dit artefact (dist) is ook wat naar productie gaat: bewust zonder + # OFFERINGS_URL, dus met de gecommitte pakketlijst. De testbuild met de + # pakketten uit het CMS is job build-test. - name: Build run: pnpm build env: VITE_RELEASE: ${{ github.sha }} - OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL }} - name: Audit (productiepakketten, blokkerend) run: pnpm audit:deps @@ -109,13 +112,58 @@ jobs: path: web/dist/client/ retention-days: 7 + # De build voor de testsite: zelfde code als dist, maar met de pakketten uit + # het CMS van de testomgeving (OFFERINGS_URL uit de repo-variabele + # ASF_OFFERINGS_URL_TEST). Productie krijgt dit artefact nooit: die blijft op + # dist met de gecommitte lijst tot er een productie-CMS is. + build-test: + needs: check + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule' + runs-on: linux + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - uses: pnpm/action-setup@v4 + with: + package_json_file: web/package.json + + - name: Get pnpm store directory + id: pnpm-store + run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT" + + - name: Restore pnpm store + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-store.outputs.path }} + key: pnpm-${{ hashFiles('web/pnpm-lock.yaml') }} + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build (testomgeving, pakketten uit het CMS) + run: pnpm build + env: + VITE_RELEASE: ${{ github.sha }} + OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL_TEST }} + + - name: Upload build artifact (test) + uses: actions/upload-artifact@v3 + with: + name: dist-test + path: web/dist/client/ + retention-days: 7 + # Test wacht niet op Lighthouse: test is om te testen, de rapporten zie je # achteraf. Lighthouse draait ernaast of erna (zie de volgorde bovenaan). # Deploys alleen vanaf de Pi: die bereikt zichzelf zeker, en container- # actions werken niet op Podman. deploy-test: - needs: check - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') + needs: [check, build-test] + if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule' runs-on: raspberry-pi steps: - uses: actions/checkout@v4 @@ -128,7 +176,7 @@ jobs: - name: Download build artifact uses: actions/download-artifact@v3 with: - name: dist + name: dist-test path: web/dist # Alleen de clientmap hoort online: geen servermap, geen source maps @@ -189,6 +237,7 @@ jobs: # Lighthouse tegen de gebouwde site (mobiel en desktop) lighthouse: needs: check + if: github.event_name != 'schedule' runs-on: linux steps: - uses: actions/checkout@v4