ci: self-hosted map assets for e2e — download + cache pack, mount ./public
CI / build + unit + e2e (pull_request) Successful in 18m27s

This commit is contained in:
2026-09-19 07:55:29 +00:00
parent aa5eabeb78
commit 97f82dd464
3 changed files with 35 additions and 0 deletions
+30
View File
@@ -86,6 +86,36 @@ jobs:
# No explicit save step: caches marked by the restore steps are uploaded automatically at job end.
# Map e2e tests abort ALL *.openfreemap.org traffic (page.route → route.abort()), assuming
# styles/fonts/sprites are SELF-HOSTED from /styles, /fonts, /sprites — locally that pack is
# produced by `npm run assets:download` and reaches the app via the compose volume mount.
# CI must reproduce it or lib/mapStyles.ts probes /map-assets-manifest.json, finds nothing,
# falls back to remote OFM styles — which the tests abort → style never loads (the
# deterministic map.spec.ts wheel-zoom + style-switcher failures). The script needs no env
# vars/args and writes into ./public (git-ignored, docker-excluded; the app container gets
# it via the volume mount in docker-compose.ci.yml).
- name: Restore map assets cache
uses: actions/cache@v4
continue-on-error: true
with:
path: public/
key: ${{ runner.os }}-map-assets-${{ hashFiles('scripts/download-map-assets.mjs') }}
# Retried: the runner's uplink is flaky (same transient EAI_AGAIN pattern as dep install).
# The job-end cache upload seeds public/ for future runs; a partial pack without
# map-assets-manifest.json is harmless — the app probes that manifest and falls back to
# remote styles when it's missing.
- name: Download map assets (retries)
run: |
set -u
ok=0
for i in 1 2 3 4 5 6; do
if npm run assets:download; then ok=1; break; fi
echo "::warning::map assets download attempt $i/6 failed (likely transient network) — retrying in 5s" >&2
sleep 5
done
[ "$ok" = "1" ] || { echo "::error::map assets download failed after 6 attempts" >&2; exit 1; }
- name: Build
run: npm run build