Skip to content

Bugfix/sitemap showing deep dives #600

Bugfix/sitemap showing deep dives

Bugfix/sitemap showing deep dives #600

Workflow file for this run

# Runs Playwright E2E suite for merge-queue validation
name: Playwright
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions: {}
jobs:
e2e-test:
name: E2E Tests
runs-on: ubuntu-latest
environment: testing
if: ${{ !startsWith(github.head_ref || github.ref_name, 'hotfix/') }}
permissions:
actions: write
contents: read
env:
ASTRO_DB_APP_TOKEN: ${{ secrets.ASTRO_DB_APP_TOKEN }}
ASTRO_DB_REMOTE_URL: ${{ secrets.ASTRO_DB_REMOTE_URL }}
COMPOSE_PROJECT_NAME: ${{ vars.COMPOSE_PROJECT_NAME }}
CRON_SECRET: ${{ vars.CRON_SECRET }}
# Use localhost so IPv6-only listeners (e.g. ::1) are reachable under act.
DEV_SERVER_HOST: localhost
DEV_SERVER_PORT: ${{ vars.DEV_SERVER_PORT }}
DISABLE_TELEMETRY: true
FORCE_COLOR: 3
PUBLIC_GOOGLE_MAPS_API_KEY: ${{ vars.PUBLIC_GOOGLE_MAPS_API_KEY }}
PUBLIC_GOOGLE_MAP_ID: ${{ vars.PUBLIC_GOOGLE_MAP_ID }}
PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN: ${{ vars.PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN }}
PUBLIC_UPSTASH_SEARCH_REST_URL: ${{ vars.PUBLIC_UPSTASH_SEARCH_REST_URL }}
RESEND_API_KEY: ${{ vars.RESEND_API_KEY }}
RESEND_HTTP_PORT: ${{ vars.RESEND_HTTP_PORT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
WEBMENTION_IO_TOKEN: ${{ vars.WEBMENTION_IO_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ">=24.16.0 <25"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Start Astro dev server
run: |
echo "Starting Astro dev server on ${DEV_SERVER_HOST}:${DEV_SERVER_PORT}"
build_healthcheck_urls() {
echo "http://localhost:${DEV_SERVER_PORT}/"
echo "http://127.0.0.1:${DEV_SERVER_PORT}/"
echo "http://[::1]:${DEV_SERVER_PORT}/"
}
if [ "${DEBUG:-0}" = "1" ]; then
echo "[debug] DEBUG=1"
echo "[debug] DEV_SERVER_HOST=${DEV_SERVER_HOST:-<unset>}"
echo "[debug] DEV_SERVER_PORT=${DEV_SERVER_PORT:-<unset>}"
echo "[debug] node=$(node --version 2>/dev/null || true)"
echo "[debug] npm=$(npm --version 2>/dev/null || true)"
fi
nohup npm run dev -- --host 0.0.0.0 --port "${DEV_SERVER_PORT}" > /tmp/astro-dev.log 2>&1 &
echo $! > /tmp/astro-dev.pid
sleep 1
if ! ps -p "$(cat /tmp/astro-dev.pid)" > /dev/null 2>&1; then
echo "❌ Astro dev server process exited immediately"
echo '--- Astro dev server log ---'
cat /tmp/astro-dev.log || true
exit 1
fi
if [ "${DEBUG:-0}" = "1" ]; then
echo "[debug] astro pid=$(cat /tmp/astro-dev.pid)"
ps -fp "$(cat /tmp/astro-dev.pid)" || true
echo "[debug] listening ports (ss -ltnp)"
ss -ltnp || true
echo "[debug] curl check (verbose)"
while read -r url; do
echo "[debug] probing ${url}"
curl -v "${url}" || true
done < <(build_healthcheck_urls)
echo "[debug] tail /tmp/astro-dev.log"
tail -n 200 /tmp/astro-dev.log || true
fi
- name: Wait for Astro dev server
run: |
build_healthcheck_urls() {
echo "http://localhost:${DEV_SERVER_PORT}/"
echo "http://127.0.0.1:${DEV_SERVER_PORT}/"
echo "http://[::1]:${DEV_SERVER_PORT}/"
}
probe_dev_server() {
local url
while read -r url; do
if curl -fsS "${url}" > /dev/null; then
echo "✅ Dev server is responding at ${url}"
return 0
fi
done < <(build_healthcheck_urls)
return 1
}
# `npm run dev` runs `astro sync` first; allow time for it to finish.
for i in $(seq 1 120); do
if probe_dev_server; then
exit 0
fi
if [ "${DEBUG:-0}" = "1" ]; then
echo "[debug] still waiting... attempt=${i}/120"
if [ -f /tmp/astro-dev.pid ]; then
echo "[debug] pid=$(cat /tmp/astro-dev.pid)"
ps -fp "$(cat /tmp/astro-dev.pid)" || true
fi
ss -ltnp || true
tail -n 50 /tmp/astro-dev.log || true
fi
sleep 1
done
echo "❌ Dev server did not start within 120 seconds"
echo '--- Astro dev server log ---'
cat /tmp/astro-dev.log || true
exit 1
- name: Run Playwright E2E tests
run: npm run test:e2e:smoke
env:
CI: "1"
- name: Stop Astro dev server
if: always()
run: |
if [ -f /tmp/astro-dev.pid ]; then
kill $(cat /tmp/astro-dev.pid) || true
rm /tmp/astro-dev.pid
fi
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: playwright-report/
retention-days: 30
hotfix-bypass:
name: E2E Test Hotfix Bypass
runs-on: ubuntu-latest
if: ${{ startsWith(github.head_ref || github.ref_name, 'hotfix/') }}
permissions: {}
steps:
- name: Skip E2E for hotfix branch
run: echo "hotfix/* branch detected; skipping e2e workflow but allowing
deployments."