From 5ae1f980983d26e2c34b7e33cdba3cbd93915886 Mon Sep 17 00:00:00 2001 From: voidReq <100312344+voidReq@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:32:35 -0400 Subject: [PATCH] CI: install Firefox's system libraries only when Firefox needs them GitHub's Linux runners ship Firefox, so they already have the libraries it needs; installing them with apt took 24 minutes in a build job and ran the test job into its 20-minute limit when Ubuntu's mirror was slow. The test job now installs them only if Firefox does not start without them, and the build job's smoke test runs first without them and installs them only to try once more after a failure. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 12 ++++++++---- .github/workflows/tests.yml | 14 +++++++++++++- docs/ARCHITECTURE.md | 3 ++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78ac846..9ea01db 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,13 +30,17 @@ jobs: - uses: astral-sh/setup-uv@v6 - name: Build run: sh packaging/build.sh - - name: Libraries Firefox needs (for the smoke test) - if: runner.os == 'Linux' - run: sudo packaging/build/venv/bin/python -m playwright install-deps firefox - name: Smoke test + # Linux: first without installing Firefox's system libraries (GitHub's runners ship Firefox, so they have them; + # apt can take 20+ minutes when Ubuntu's mirror is slow); if it fails, they are installed and it runs once more run: | if [ "$RUNNER_OS" = Linux ]; then APP="$(ls dist/*.AppImage)"; else APP=packaging/build/dist/NUauto.app/Contents/MacOS/NUauto; fi - packaging/build/venv/bin/python packaging/smoke.py "$APP" + if ! packaging/build/venv/bin/python packaging/smoke.py "$APP"; then + [ "$RUNNER_OS" = Linux ] || exit 1 + echo "Smoke test failed: installing the system libraries Firefox needs, then once more" + sudo packaging/build/venv/bin/python -m playwright install-deps firefox + packaging/build/venv/bin/python packaging/smoke.py "$APP" + fi - uses: actions/upload-artifact@v4 with: name: nuauto-${{ matrix.os }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a79cf09..2f4a984 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,18 @@ jobs: uv venv --python 3.12 .venv uv pip install --python .venv/bin/python -e . - name: Install Playwright's Firefox - run: .venv/bin/python -m playwright install --with-deps firefox + # GitHub's Linux runners ship Firefox, so they already have the system libraries it needs; they are installed + # (apt, which can take 20+ minutes when Ubuntu's mirror is slow) only if Firefox does not start without them + run: | + .venv/bin/python -m playwright install firefox + if [ "$RUNNER_OS" = Linux ] && ! .venv/bin/python - <<'EOF' + from playwright.sync_api import sync_playwright + with sync_playwright() as p: + p.firefox.launch().close() + EOF + then + echo "Firefox did not start: installing the system libraries it needs" + sudo .venv/bin/python -m playwright install-deps firefox + fi - name: Tests run: .venv/bin/nuauto test diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 0d833a2..e49f151 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -196,7 +196,8 @@ REPO LAYOUT (what is not a module) deploy/systemd/ (homelab units: daily, weekly, intern, deploy, assist timers + services; web service) packaging/ (the packaged app: nuauto.spec, build.sh, distros.sh, entry.py, AppRun, desktop file, icons, smoke.py) .github/workflows/ (tests.yml: `nuauto test` on Ubuntu + macOS, on PRs and main; release.yml: AppImages + DMGs, built on - PRs (Intel Mac: tags only), released on v* tags) + PRs (Intel Mac: tags only), released on v* tags. Firefox's system libraries are installed on Linux only when Firefox + won't start without them: GitHub's runners already have them, and apt can take 20+ minutes on a slow Ubuntu mirror) TESTS (`nuauto test` runs every tests/test_*.py, 4 at a time: offline, no sheet, no real NUworks, no network; browser tests use headless Firefox on local pages or demo mode. Run it before pushing; CI runs it on Ubuntu and macOS.)