name: Lighthouse CI # Audits the deployed staging site (https://boiler.saas-ctrl.com). A # meaningful Lighthouse audit needs a live server, a database and seeded # content; reproducing that whole stack inside a CI job is brittle, so the # audit targets the deployed environment instead. # # This is therefore a post-deploy / monitoring audit, NOT a per-commit merge # gate — staging always lags the commit under review. It runs nightly and on # manual dispatch. # # Spec: docs/improvement-plan/10-compliance-polish/lighthouse.md # Docs: docs/architecture/lighthouse.md on: workflow_dispatch: schedule: # 03:00 UTC nightly — after the day's deploys have settled. - cron: "0 3 * * *" env: TOOLCTRL_GITEA_HOST_IP: ${{ vars.TOOLCTRL_GITEA_HOST_IP }} jobs: lighthouse: name: Run Lighthouse audits runs-on: toolctrl-ci timeout-minutes: 30 steps: - name: Resolve internal Gitea host run: | if [ -n "${TOOLCTRL_GITEA_HOST_IP:-}" ]; then if ! TOOLCTRL_GITEA_HOST_IP="$TOOLCTRL_GITEA_HOST_IP" node -e 'process.exit(require("node:net").isIP(process.env.TOOLCTRL_GITEA_HOST_IP || "") ? 0 : 1)'; then echo "TOOLCTRL_GITEA_HOST_IP must be a single IPv4 or IPv6 token" exit 1 fi printf '%s git.tool-ctrl.de\n' "$TOOLCTRL_GITEA_HOST_IP" >> /etc/hosts fi - name: Checkout uses: actions/checkout@v4 - name: Mint Lighthouse session cookie run: node scripts/rotate-lighthouse-session-cookie.mjs env: LIGHTHOUSE_LOGIN_URL: https://boiler.saas-ctrl.com/login LIGHTHOUSE_LOGIN_EMAIL: ${{ secrets.LIGHTHOUSE_LOGIN_EMAIL }} LIGHTHOUSE_LOGIN_PASSWORD: ${{ secrets.LIGHTHOUSE_LOGIN_PASSWORD }} LIGHTHOUSE_SESSION_COOKIE: ${{ secrets.LIGHTHOUSE_SESSION_COOKIE }} LIGHTHOUSE_SESSION_COOKIE_NAME: RJ_session LIGHTHOUSE_COOKIE_DOMAIN: boiler.saas-ctrl.com - name: Install Chromium # The Gitea runner image (node:20-bookworm) ships no browser; LHCI's # healthcheck otherwise fails with "Chrome installation not found". run: | apt-get update apt-get install -y --no-install-recommends chromium fonts-liberation rm -rf /var/lib/apt/lists/* - name: Run Lighthouse-CI against staging run: npx --yes @lhci/cli@0.13.x autorun --config=./.lighthouserc.staging.json env: # chromium installs to /usr/bin/chromium on Debian bookworm. CHROME_PATH: /usr/bin/chromium - name: Upload Lighthouse artifacts if: always() uses: actions/upload-artifact@v4 with: name: lighthouse-ci-results path: .lighthouseci/ retention-days: 14