Runs deploys first and lets a second runner share the work
Continuous Integration / check (pull_request) Successful in 6m0s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Failing after 1m13s
Continuous Integration / deploy-production (pull_request) Skipped

Jobs now pick runners by label: check and Lighthouse run on any Linux runner,
deploys only on the Pi. The test deploy is listed before Lighthouse, so a single
runner deploys first while two runners run both at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 14:17:12 +02:00
co-authored by Claude Opus 5.5
parent 3b86f04945
commit 0eec9a4ea0
2 changed files with 79 additions and 59 deletions
+67 -59
View File
@@ -38,10 +38,16 @@ defaults:
run:
working-directory: web
# Runners (labels per eigenschap; een job draait op een runner met al zijn
# runs-on-labels): 'linux' = elke vrije runner (Pi of pc), 'raspberry-pi' =
# alleen de Pi.
# Volgorde: Gitea geeft wachtende jobs uit in de volgorde van dit bestand.
# Daarom staan de deploys boven lighthouse: met één vrije runner gaat de deploy
# eerst, met twee draaien ze tegelijk.
jobs:
# lint, opmaak, tests (incl. property-based en axe), build en audit
check:
runs-on: ubuntu-latest
runs-on: linux
steps:
- uses: actions/checkout@v4
@@ -96,10 +102,68 @@ jobs:
path: web/dist/
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')
runs-on: raspberry-pi
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: dist
path: web/dist
# Eenvoudig: de testmap leegmaken en de nieuwe build erin zetten. Oude
# versies worden niet bewaard. Op de Pi draait ook de huidige
# WordPress-site; daarom weigert deze stap een lege variabele, '/', of
# een map waarin WordPress staat.
- name: Upload naar de testserver
env:
# Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }}
run: |
case "$DEPLOY_PATH" in
''|'/'|*' '*) echo "DEPLOY_PATH_TEST ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;;
esac
sudo apt-get update && sudo apt-get install -y sshpass
SSH="sshpass -e ssh -p $SSH_PORT -o StrictHostKeyChecking=accept-new $SSH_USER@$SSH_HOST"
$SSH "set -e
if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then
echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1
fi
mkdir -p '$DEPLOY_PATH'
find '$DEPLOY_PATH' -mindepth 1 -delete"
# De inhoud kopiëren (dist/*), niet de map zelf (dist/.): dan probeert
# scp de rechten van de doelmap niet te zetten, wat alleen de eigenaar
# mag. Zo zijn groeps-schrijfrechten op de doelmap genoeg.
# dotglob: ook bestanden die met een punt beginnen gaan mee.
shopt -s dotglob
sshpass -e scp -P "$SSH_PORT" -o StrictHostKeyChecking=accept-new -r dist/* "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/"
echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})"
- name: Controle na deploy
env:
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
run: |
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi
curl -fsS -o /dev/null --retry 5 --retry-delay 3 "$HEALTH_URL"
curl -fsSI "$HEALTH_URL" | grep -qi '^content-security-policy:'
echo "Test bereikbaar met security headers"
# Lighthouse tegen de gebouwde site (mobiel en desktop)
lighthouse:
needs: check
runs-on: ubuntu-latest
runs-on: linux
steps:
- uses: actions/checkout@v4
@@ -160,69 +224,13 @@ jobs:
path: web/lighthouse-reports/
retention-days: 14
# Test wacht niet op Lighthouse: test is om te testen, de rapporten zie je
# achteraf. Lighthouse draait ernaast.
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')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: dist
path: web/dist
# Eenvoudig: de testmap leegmaken en de nieuwe build erin zetten. Oude
# versies worden niet bewaard. Op de Pi draait ook de huidige
# WordPress-site; daarom weigert deze stap een lege variabele, '/', of
# een map waarin WordPress staat.
- name: Upload naar de testserver
env:
# Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }}
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }}
run: |
case "$DEPLOY_PATH" in
''|'/'|*' '*) echo "DEPLOY_PATH_TEST ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;;
esac
sudo apt-get update && sudo apt-get install -y sshpass
SSH="sshpass -e ssh -p $SSH_PORT -o StrictHostKeyChecking=accept-new $SSH_USER@$SSH_HOST"
$SSH "set -e
if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then
echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1
fi
mkdir -p '$DEPLOY_PATH'
find '$DEPLOY_PATH' -mindepth 1 -delete"
# De inhoud kopiëren (dist/*), niet de map zelf (dist/.): dan probeert
# scp de rechten van de doelmap niet te zetten, wat alleen de eigenaar
# mag. Zo zijn groeps-schrijfrechten op de doelmap genoeg.
# dotglob: ook bestanden die met een punt beginnen gaan mee.
shopt -s dotglob
sshpass -e scp -P "$SSH_PORT" -o StrictHostKeyChecking=accept-new -r dist/* "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/"
echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})"
- name: Controle na deploy
env:
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
run: |
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi
curl -fsS -o /dev/null --retry 5 --retry-delay 3 "$HEALTH_URL"
curl -fsSI "$HEALTH_URL" | grep -qi '^content-security-policy:'
echo "Test bereikbaar met security headers"
# Productie wacht wel op Lighthouse: toegankelijkheid, Best Practices en SEO
# moeten slagen voordat er iets live gaat.
deploy-production:
needs: [check, lighthouse]
# Alleen handmatig, en alleen vanaf een release-branch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true' && startsWith(github.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
runs-on: raspberry-pi
steps:
- uses: actions/checkout@v4