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 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ name: Continuous Integration
|
|||||||
# Branchstrategie (zie aidlc-docs/.../operations/deployment/deployment-plan.md):
|
# Branchstrategie (zie aidlc-docs/.../operations/deployment/deployment-plan.md):
|
||||||
# - Pull request → controles, geen deploy
|
# - Pull request → controles, geen deploy
|
||||||
# - Merge/push naar master → controles + automatisch naar test
|
# - 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, elke branch → controles + naar test als 'Deploy to Test' aan staat
|
||||||
# - Handmatig, release/* → controles + naar productie als 'Deploy to Production' aan staat
|
# - Handmatig, release/* → controles + naar productie als 'Deploy to Production' aan staat
|
||||||
on:
|
on:
|
||||||
@@ -20,6 +21,12 @@ on:
|
|||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
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
|
# Alleen bij pull requests een verouderde run afbreken; een deploy wordt nooit
|
||||||
# halverwege gestopt.
|
# halverwege gestopt.
|
||||||
@@ -84,17 +91,13 @@ jobs:
|
|||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
|
||||||
# Sentry toont bij elke fout uit welke commit de build komt
|
# Sentry toont bij elke fout uit welke commit de build komt
|
||||||
# De pakketten en prijzen komen uit het CMS: de build haalt ze op
|
# Dit artefact (dist) is ook wat naar productie gaat: bewust zonder
|
||||||
# (web/config/fetchOfferings.ts) en valt bij een storing terug op de
|
# OFFERINGS_URL, dus met de gecommitte pakketlijst. De testbuild met de
|
||||||
# gecommitte lijst. ASF_OFFERINGS_URL (repo-variabele) is het adres dat
|
# pakketten uit het CMS is job build-test.
|
||||||
# /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.
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
env:
|
env:
|
||||||
VITE_RELEASE: ${{ github.sha }}
|
VITE_RELEASE: ${{ github.sha }}
|
||||||
OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL }}
|
|
||||||
|
|
||||||
- name: Audit (productiepakketten, blokkerend)
|
- name: Audit (productiepakketten, blokkerend)
|
||||||
run: pnpm audit:deps
|
run: pnpm audit:deps
|
||||||
@@ -109,13 +112,58 @@ jobs:
|
|||||||
path: web/dist/client/
|
path: web/dist/client/
|
||||||
retention-days: 7
|
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
|
# Test wacht niet op Lighthouse: test is om te testen, de rapporten zie je
|
||||||
# achteraf. Lighthouse draait ernaast of erna (zie de volgorde bovenaan).
|
# achteraf. Lighthouse draait ernaast of erna (zie de volgorde bovenaan).
|
||||||
# Deploys alleen vanaf de Pi: die bereikt zichzelf zeker, en container-
|
# Deploys alleen vanaf de Pi: die bereikt zichzelf zeker, en container-
|
||||||
# actions werken niet op Podman.
|
# actions werken niet op Podman.
|
||||||
deploy-test:
|
deploy-test:
|
||||||
needs: check
|
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')
|
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
|
runs-on: raspberry-pi
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -128,7 +176,7 @@ jobs:
|
|||||||
- name: Download build artifact
|
- name: Download build artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist-test
|
||||||
path: web/dist
|
path: web/dist
|
||||||
|
|
||||||
# Alleen de clientmap hoort online: geen servermap, geen source maps
|
# Alleen de clientmap hoort online: geen servermap, geen source maps
|
||||||
@@ -189,6 +237,7 @@ jobs:
|
|||||||
# Lighthouse tegen de gebouwde site (mobiel en desktop)
|
# Lighthouse tegen de gebouwde site (mobiel en desktop)
|
||||||
lighthouse:
|
lighthouse:
|
||||||
needs: check
|
needs: check
|
||||||
|
if: github.event_name != 'schedule'
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user