From c50e39855a4a7a7c497ccdbcafceb2ba69b9f201 Mon Sep 17 00:00:00 2001 From: dborup Date: Sat, 28 Nov 2026 14:55:50 +0100 Subject: [PATCH] ci: run the info site tests on changes to sites/meshview-info deploy.yml never ran sites/meshview-info/test-*, so the /velkommen, /guider and /faq tests only ran by hand (found in the #1014 review). info-site.yml runs on pull requests (any base, so stacked info PRs get checks too) and pushes to master that touch sites/meshview-info/, the runner or the workflow. Read-only: contents read, no secrets, no publish. scripts/run-info-site-tests.sh runs every test-*.cjs|js there and fails on any failing test or when none is found. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/info-site.yml | 52 +++++++++++++++++++++++++++++++++ scripts/run-info-site-tests.sh | 16 ++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/info-site.yml create mode 100755 scripts/run-info-site-tests.sh diff --git a/.github/workflows/info-site.yml b/.github/workflows/info-site.yml new file mode 100644 index 000000000..c90f7845c --- /dev/null +++ b/.github/workflows/info-site.yml @@ -0,0 +1,52 @@ +name: Info site tests + +# The standalone info pages in sites/meshview-info/ (served as /velkommen, +# /observer, /hardware, /radio, /guider, /faq) have their own browser tests. +# deploy.yml does not run them, so this workflow runs every +# sites/meshview-info/test-*.cjs|js on changes to the info site. +# Read-only: no secrets, no publish, no deploy. + +on: + pull_request: + paths: + - 'sites/meshview-info/**' + - 'scripts/run-info-site-tests.sh' + - '.github/workflows/info-site.yml' + push: + branches: [master] + paths: + - 'sites/meshview-info/**' + - 'scripts/run-info-site-tests.sh' + - '.github/workflows/info-site.yml' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: info-site-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + info-site: + name: "🌐 Info site tests" + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Node.js 22 + uses: actions/setup-node@v5 + with: + node-version: '22' + cache: npm + + - name: Install dependencies + run: npm ci --production=false + + - name: Install Chromium for Playwright + run: npx playwright install --with-deps chromium + + - name: Run info site tests + run: bash scripts/run-info-site-tests.sh diff --git a/scripts/run-info-site-tests.sh b/scripts/run-info-site-tests.sh new file mode 100755 index 000000000..fcfdde0cd --- /dev/null +++ b/scripts/run-info-site-tests.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Run every sites/meshview-info/test-*.cjs and test-*.js. Fails when any test +# fails, or when no test is found (a moved folder must not pass silently). +set -uo pipefail +cd "$(dirname "$0")/../sites/meshview-info" || { echo "sites/meshview-info not found" >&2; exit 1; } +shopt -s nullglob +tests=(test-*.cjs test-*.js) +if [ ${#tests[@]} -eq 0 ]; then echo "no info site tests found" >&2; exit 1; fi +failed=() +for t in "${tests[@]}"; do + echo "::group::$t" + if node "$t"; then echo "ok: $t"; else echo "FAIL: $t"; failed+=("$t"); fi + echo "::endgroup::" +done +echo "${#tests[@]} info site tests, ${#failed[@]} failed" +if [ ${#failed[@]} -gt 0 ]; then printf 'failed: %s\n' "${failed[@]}" >&2; exit 1; fi