Runs deploys first and lets a second runner share the work
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:
@@ -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
|
||||
|
||||
|
||||
@@ -918,3 +918,15 @@ Verder heb ik de vraag ook beantwoord"
|
||||
**Context**: OPERATIONS - Monitoring Setup; PR run green
|
||||
|
||||
---
|
||||
|
||||
## Deployment - Second Runner and Job Order
|
||||
|
||||
**Timestamp**: 2026-10-19T12:17:12Z
|
||||
|
||||
**User Input**: "Ik heb de labels aangepast. kan je het controleren? Daarna mag je de aanpassingen voor de workflow doen. dan kunnen we meteen alles testen" (earlier: "Ik wil nog wel de mogelijkheid hebben om ze tegelijk te draaien als ik 2 runners heb, maar als alleen de pi draait of de andere runner nog druk is wil ik dat deploy eerst wordt opgepakt. is dat mogelijk?" and "Dat is nog een issue. MIsschien later te verhelpen of deploys niet op de pc laten doen.")
|
||||
|
||||
**AI Response**: "Owner added a second global runner on the PC (bryan-desktop-podman, Podman in WSL, same job image as the Pi, labels global/linux/x64/podman/bryan-desktop). Pi labels verified via API: linux-arm64, ubuntu-latest, global, linux, arm64, podman, raspberry-pi. Gitea 1.27 hands out waiting jobs ordered by (updated, id) and job ids follow the YAML order, and a runner must have all runs-on labels. Workflow: check and lighthouse on 'linux' (any runner), deploy-test and deploy-production on 'raspberry-pi' (deploys never on the PC; container actions do not work on Podman); deploy-test moved above lighthouse so a single free runner takes the deploy first while two runners run them in parallel. Commit/push and test runs allowed for this change."
|
||||
|
||||
**Context**: OPERATIONS - Deployment pipeline adjustment (during Monitoring Setup approval wait)
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user