Repository navigation
chore(release): v0.13.0 #1993
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Not "Build" or "CI": workflow_run triggers on main matched those names and | |
| # ran on pull-request code (SEC-02). Required checks key on the job names below. | |
| name: Checks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| # Lets visual-baselines.yml start these checks on the commit it pushes when | |
| # no App token or PAT is configured (e2e/visual/README.md). | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # A new push to a pull request cancels its older run; runs on main finish. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| # Prisma's config needs a URL to load; jobs with a database override it. | |
| DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/plex_manager_test?schema=public" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Run linter | |
| run: npm run lint | |
| # No local absolute paths, agent scratch folders or session links (scripts/local-paths/rules.mjs). | |
| - name: Check for local paths | |
| run: npm run check:local-paths | |
| # The release tarball is pinned by version and SHA-256. | |
| - name: Lint workflows | |
| env: | |
| ACTIONLINT_VERSION: 1.7.12 | |
| ACTIONLINT_SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 | |
| run: | | |
| archive="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" | |
| curl -sSLf -o "$RUNNER_TEMP/$archive" \ | |
| "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/${archive}" | |
| echo "${ACTIONLINT_SHA256} $RUNNER_TEMP/$archive" | sha256sum --check --strict | |
| tar -xzf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP" actionlint | |
| "$RUNNER_TEMP/actionlint" -color | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| # The app (tsconfig.json, which covers e2e/) and the Jest files. | |
| - name: Type-check the app and the tests | |
| run: npm run typecheck | |
| # High and critical advisories in production dependencies fail unless | |
| # .github/audit-exceptions.json lists them with an expiry (scripts/audit-gate.mjs). | |
| audit: | |
| name: Audit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| # npm audit reads package-lock.json; it needs no install. | |
| - name: Setup Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: '24' | |
| - name: Audit production dependencies | |
| run: node scripts/audit-gate.mjs | |
| - name: Review the dependencies this pull request adds | |
| if: github.event_name == 'pull_request' | |
| uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 | |
| with: | |
| fail-on-severity: high | |
| knip: | |
| name: Knip | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| # knip's Playwright plugin loads playwright.config.ts, which refuses to | |
| # load without a _test database URL. Nothing connects to it. | |
| env: | |
| E2E_DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/plex_manager_test?schema=public" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| # Unused files, exports and dependencies in production code. | |
| - name: Run knip | |
| run: npm run knip | |
| # Design-system check (ui-design-system 9.6, P10.11): fails on any banned | |
| # pattern outside the documented allowlist (scripts/design-system/allowlist.mjs). | |
| design-system: | |
| name: Design System | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Check the design system | |
| run: npm run design:check | |
| # NFR-6 for Rewind, which the check's infinite-motion rule skips (P5.2). | |
| - name: Check Rewind motion | |
| run: npm run design:rewind-motion | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: plex_manager_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Run Prisma migrations | |
| run: npm run db:deploy | |
| - name: Build application | |
| run: npm run build | |
| env: | |
| NEXT_PUBLIC_APP_URL: "http://localhost:3000" | |
| NEXTAUTH_URL: "http://localhost:3000" | |
| NEXTAUTH_SECRET: "test-secret-for-ci-build-at-least-32-chars-long" | |
| PLEX_CLIENT_IDENTIFIER: "00000000-0000-0000-0000-000000000000" | |
| # Pull requests only: builds the image without pushing it (images are | |
| # published only by docker-publish.yml, from main and v* tags), then runs it | |
| # the way an operator would: on a fresh Postgres and Redis with passwords, under the | |
| # boot check (a generated secret on loopback http). Not a required check. | |
| image-smoke: | |
| name: Image Smoke Test | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| IMAGE: plex-manager:smoke | |
| NET: smoke | |
| PG_PASSWORD: smoke-postgres-password | |
| REDIS_PASSWORD: smoke-redis-password | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Build Docker image (no push) | |
| uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: ${{ env.IMAGE }} | |
| cache-from: type=gha | |
| - name: Start Postgres and Redis | |
| run: | | |
| docker network create "$NET" | |
| docker run -d --name db --network "$NET" \ | |
| -e POSTGRES_PASSWORD="$PG_PASSWORD" -e POSTGRES_DB=plex_manager_smoke \ | |
| --health-cmd "pg_isready -U postgres" --health-interval 2s --health-retries 30 \ | |
| postgres:16 | |
| docker run -d --name redis --network "$NET" -e REDISCLI_AUTH="$REDIS_PASSWORD" \ | |
| --health-cmd "redis-cli ping" --health-interval 2s --health-retries 30 \ | |
| redis:7 redis-server --requirepass "$REDIS_PASSWORD" | |
| for service in db redis; do | |
| timeout 60 sh -c "until [ \"\$(docker inspect -f '{{.State.Health.Status}}' $service)\" = healthy ]; do sleep 1; done" | |
| done | |
| - name: Write the app environment | |
| run: | | |
| secret="$(openssl rand -base64 32)" | |
| echo "::add-mask::$secret" | |
| { | |
| echo "DATABASE_URL=postgresql://postgres:${PG_PASSWORD}@db:5432/plex_manager_smoke?schema=public" | |
| echo "REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379" | |
| echo "NEXTAUTH_SECRET=${secret}" | |
| echo "ENCRYPTION_KEYS=smoke:$(openssl rand -base64 32)" | |
| echo "NEXTAUTH_URL=http://localhost:3000" | |
| echo "NEXT_PUBLIC_APP_URL=http://localhost:3000" | |
| echo "PLEX_CLIENT_IDENTIFIER=$(openssl rand -hex 16)" | |
| echo "METRICS_TOKEN=smoke-metrics-token-0123456789" | |
| } > "$RUNNER_TEMP/app.env" | |
| # The image's own HEALTHCHECK (liveness probe, 30 s interval) decides. | |
| - name: Start the app on the fresh database and wait for healthy | |
| run: | | |
| start_app() { | |
| docker run -d --name app --network "$NET" -p 127.0.0.1:3000:3000 \ | |
| --env-file "$RUNNER_TEMP/app.env" "$@" "$IMAGE" | |
| if ! timeout 90 sh -c "until [ \"\$(docker inspect -f '{{.State.Health.Status}}' app)\" = healthy ]; do sleep 2; done"; then | |
| docker logs app | |
| echo "::error::The container did not report healthy within 90 s" | |
| exit 1 | |
| fi | |
| } | |
| start_app | |
| docker logs app 2>&1 | grep -F "All migrations have been successfully applied" | |
| docker exec -e NODE_PATH=/opt/prisma-cli/node_modules app \ | |
| /opt/prisma-cli/node_modules/.bin/prisma migrate status | grep -F "Database schema is up to date" | |
| # The readiness body checks both dependencies | |
| curl -fsS http://127.0.0.1:3000/api/health | tee /dev/stderr | grep -F '"checks":{"database":"ok","redis":"ok"}' | |
| # Metrics: 401 without the token; with it, queue gauges and no failed source | |
| [ "$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3000/api/metrics)" = 401 ] | |
| curl -fsS -H "Authorization: Bearer smoke-metrics-token-0123456789" http://127.0.0.1:3000/api/metrics > "$RUNNER_TEMP/metrics.txt" | |
| grep -F 'plex_manager_queue_jobs{queue="plex-wrapped",state="waiting"}' "$RUNNER_TEMP/metrics.txt" | |
| if grep -E '^plex_manager_scrape_error\{.*\} 1$' "$RUNNER_TEMP/metrics.txt"; then | |
| echo "::error::A metrics source failed"; exit 1 | |
| fi | |
| # Restarted with SKIP_MIGRATIONS=true: logs the skip, still healthy | |
| docker rm -f app | |
| start_app -e SKIP_MIGRATIONS=true | |
| docker logs app 2>&1 | grep -F "SKIP_MIGRATIONS=true: not applying migrations" | |
| - name: Check the hardening | |
| run: | | |
| fail() { echo "::error::$1"; exit 1; } | |
| # Read-only app files; the Rewind cache is the one writable path | |
| if docker exec app touch /app/server.js; then fail "/app/server.js is writable"; fi | |
| docker exec app sh -c 'touch "$REWIND_CACHE_DIR/smoke" && rm "$REWIND_CACHE_DIR/smoke"' || | |
| fail "REWIND_CACHE_DIR is not writable" | |
| [ "$(docker exec app printenv REWIND_CACHE_DIR)" = /app/.next/cache/rewind ] || | |
| fail "REWIND_CACHE_DIR is not /app/.next/cache/rewind" | |
| # tini is PID 1, Node is 24, and no dev dependency shipped | |
| [ "$(docker exec app cat /proc/1/comm)" = tini ] || fail "PID 1 is not tini" | |
| docker exec app node -v | grep -q "^v24\." || fail "Node is not v24" | |
| for dir in /app/node_modules/jest /app/node_modules/@playwright; do | |
| if docker exec app test -e "$dir"; then fail "$dir is in the image"; fi | |
| done | |
| if docker exec app sh -c 'command -v npm'; then fail "npm is in the runner"; fi | |
| # P11.7: the bundled slash-command registration runs from the image | |
| docker exec app node scripts/dist/register-discord-commands.cjs --dry-run | grep -F "/assistant" || | |
| fail "register-discord-commands.cjs --dry-run did not list the commands" | |
| # P11.3: one image, two roles; only the worker starts the queue Workers, | |
| # and it serves nothing but the health check and the metrics. | |
| - name: Check the web and worker roles | |
| run: | | |
| for role in web worker; do | |
| docker run -d --name "app-$role" --network "$NET" \ | |
| --env-file "$RUNNER_TEMP/app.env" -e PROCESS_ROLE="$role" -e SKIP_MIGRATIONS=true "$IMAGE" | |
| done | |
| for role in web worker; do | |
| if ! timeout 90 sh -c "until [ \"\$(docker inspect -f '{{.State.Health.Status}}' app-$role)\" = healthy ]; do sleep 2; done"; then | |
| docker logs "app-$role" | |
| echo "::error::app-$role did not report healthy within 90 s" | |
| exit 1 | |
| fi | |
| done | |
| docker logs app-worker 2>&1 | grep -F "Queue worker started" | |
| if docker logs app-web 2>&1 | grep -F "Queue worker started"; then | |
| echo "::error::The web role started the queue worker"; exit 1 | |
| fi | |
| docker exec app-worker node -e "fetch('http://127.0.0.1:3000/').then(r=>process.exit(r.status===404?0:1),()=>process.exit(1))" || | |
| { echo "::error::The worker served a page"; exit 1; } | |
| docker exec app-worker node -e "fetch('http://127.0.0.1:3000/api/health?probe=live').then(r=>r.json()).then(b=>process.exit(b.role==='worker'?0:1),()=>process.exit(1))" || | |
| { echo "::error::/api/health did not report the worker role"; exit 1; } | |
| docker rm -f app-web app-worker | |
| - name: Check a Redis outage leaves the site live | |
| run: | | |
| docker stop redis | |
| status="$(curl -s -o "$RUNNER_TEMP/health.json" -w '%{http_code}' http://127.0.0.1:3000/api/health)" | |
| cat "$RUNNER_TEMP/health.json" | |
| [ "$status" = 503 ] || { echo "::error::/api/health answered $status with Redis down"; exit 1; } | |
| grep -F '"redis":"fail"' "$RUNNER_TEMP/health.json" | |
| curl -fsS "http://127.0.0.1:3000/api/health?probe=live" | |
| docker start redis | |
| # P4.2's coordinator drains and exits 0 inside Docker's 10 s stop timeout. | |
| - name: Stop the app within 10 s with exit code 0 | |
| run: | | |
| started=$(date +%s) | |
| docker stop -t 10 app | |
| elapsed=$(( $(date +%s) - started )) | |
| code="$(docker inspect -f '{{.State.ExitCode}}' app)" | |
| docker logs app 2>&1 | tail -20 | |
| echo "Stopped in ${elapsed} s with exit code ${code}" | |
| if [ "$code" != 0 ] || [ "$elapsed" -ge 10 ]; then | |
| echo "::error::docker stop took ${elapsed} s, exit code ${code}" | |
| exit 1 | |
| fi | |
| # setup-trivy, which trivy-action calls, downloads the binary from | |
| # get.trivy.dev, and that host stopped resolving on 2026-11-03 | |
| # (aquasecurity/setup-trivy#42). Until the action falls back to GitHub, | |
| # install the release asset the action would pick (its default version), | |
| # check it against the release's checksums, and skip the action's setup. | |
| - name: Install Trivy | |
| env: | |
| TRIVY_VERSION: 0.70.0 | |
| run: | | |
| set -euo pipefail | |
| base="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}" | |
| tarball="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" | |
| cd "$RUNNER_TEMP" | |
| curl -fsSL --retry 3 -o "$tarball" "${base}/${tarball}" | |
| curl -fsSL --retry 3 -o trivy_checksums.txt "${base}/trivy_${TRIVY_VERSION}_checksums.txt" | |
| grep " ${tarball}$" trivy_checksums.txt | sha256sum -c - | |
| mkdir -p trivy-bin | |
| tar -xzf "$tarball" -C trivy-bin trivy | |
| echo "$RUNNER_TEMP/trivy-bin" >> "$GITHUB_PATH" | |
| - name: Scan the image | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| image-ref: ${{ env.IMAGE }} | |
| severity: CRITICAL,HIGH | |
| ignore-unfixed: true | |
| exit-code: '1' | |
| skip-setup-trivy: true | |
| - name: Container logs | |
| if: failure() | |
| run: docker logs app || true | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| # No database and no URL: lib/prisma.ts builds its client on first use | |
| # (P11.22), so modules import without one. The setup action's Prisma | |
| # generate step supplies its own. | |
| env: | |
| DATABASE_URL: "" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| # The Postgres- and Redis-backed suites (*.pg.test.ts, *.redis.test.ts) run in the | |
| # integration job; see jest.config.js. Jest fails when coverage falls | |
| # below a floor in jest.coverage-thresholds.json. | |
| - name: Run unit tests with coverage | |
| run: npm run test:coverage -- --ci --reporters=default --reporters=github-actions | |
| # The formatters must not read the process zone (P3.10). | |
| - name: Rerun the formatter tests at UTC+14 | |
| run: npm run test:tz -- --ci | |
| # The run above is in UTC. The Rewind goldens and stats must give the | |
| # same answers in any process zone (P2.10), so run them again in Sydney. | |
| - name: Run the Rewind goldens under TZ=Australia/Sydney | |
| run: npx jest evals/rewind lib/wrapped/stats --ci | |
| env: | |
| TZ: Australia/Sydney | |
| - name: Check the Rewind fixtures match their profiles | |
| run: npm run rewind:fixtures -- --check | |
| # The prompt, the fact catalogue and the model are frozen for the | |
| # season (P8.1, docs/rewind.md "The freeze lock"). | |
| - name: Check the Rewind freeze lock | |
| run: npm run rewind:freeze -- --check | |
| # docs/environment.md and example.env are generated from lib/env.ts (P11.24). | |
| - name: Check the environment reference | |
| run: npm run env:docs -- --check | |
| - name: Upload coverage report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 7 | |
| # The Postgres- and Redis-backed suites (*.pg.test.ts, *.redis.test.ts), | |
| # gated by describePg and describeRedis (__tests__/helpers/integration.ts). Under | |
| # CI a missing TEST_DATABASE_URL or TEST_REDIS_URL fails them instead of | |
| # skipping them. | |
| integration: | |
| name: Integration | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: plex_manager_it_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| env: | |
| DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/plex_manager_it_test?schema=public" | |
| TEST_DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/plex_manager_it_test?schema=public" | |
| TEST_REDIS_URL: "redis://localhost:6379/0" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Run Prisma migrations | |
| run: npm run db:deploy | |
| # The suites share one database and one Redis, so they run one at a time. | |
| - name: Run integration tests | |
| run: npm run test:integration -- --ci --reporters=default --reporters=github-actions | |
| # Fails when prisma/schema.prisma and the migrations disagree: a schema edit | |
| # without its migration, or a migration edited by hand. Exit code 2 is drift. | |
| schema-drift: | |
| name: Schema Drift | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: plex_manager_drift_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/plex_manager_drift_test?schema=public" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Apply every migration to an empty database | |
| run: npm run db:deploy | |
| # Prints the human-readable diff before failing. | |
| - name: Compare the migrated database with schema.prisma | |
| run: | | |
| set +e | |
| npx prisma migrate diff --from-config-datasource --to-schema prisma/schema.prisma --exit-code | |
| status=$? | |
| if [ "$status" -eq 2 ]; then | |
| echo "::error::prisma/schema.prisma differs from the migrations. Create a migration with npm run db:migrate." | |
| fi | |
| exit "$status" | |
| # Descriptive names and rising timestamps for every folder newer than | |
| # prisma/migrations/.legacy-names.json (P11.6). | |
| - name: Check migration names | |
| run: node scripts/check-migrations.mjs | |
| # The Playwright projects against `next build` plus `next start`, in the | |
| # image the visual baselines are taken in, on a throwaway Postgres and Redis. | |
| # "E2E Tests" (required) runs every functional spec and the setup wizard; | |
| # "Rewind E2E Tests" (required) runs Rewind's story flows, its axe scans and | |
| # the strict CSP scan (chromium, webkit and firefox; the image ships all | |
| # three). "Visual Diffs" and "Rewind Visual Diffs" run the screenshot | |
| # projects and are advisory: a diff leaves a warning and the report, not a | |
| # failed check (refresh baselines with visual-baselines.yml). "Rewind | |
| # Performance" (the 4x-throttled long-task and commit gate on a normal and | |
| # a low-end device, the first-page JavaScript and page-chunk budgets; P5.4, | |
| # P7.15) is a blocking gate. | |
| e2e: | |
| name: ${{ matrix.suite.name }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: ${{ matrix.suite.timeout }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| suite: | |
| - name: E2E Tests | |
| projects: --project=chromium --project=setup-wizard | |
| advisory: false | |
| artifact: playwright-report | |
| # The media cleanup specs took the job to about 29 minutes, near the old 30-minute stop | |
| timeout: 40 | |
| # Its own job (and database) so it runs beside "E2E Tests"; together | |
| # they were one 28 minute serial run. | |
| - name: Rewind E2E Tests | |
| projects: >- | |
| --project=rewind-e2e-chromium --project=rewind-e2e-webkit --project=rewind-e2e-firefox | |
| --project=rewind-a11y-chromium --project=rewind-a11y-webkit --project=rewind-a11y-firefox | |
| --project=csp-chromium --project=csp-webkit --project=csp-firefox | |
| advisory: false | |
| artifact: playwright-report-rewind | |
| timeout: 30 | |
| # The setup projects pull in setup-wizard, which they depend on. The | |
| # advisory suites lift playwright.config.ts's 10-failure stop, so the | |
| # report lists every diff. | |
| - name: Visual Diffs | |
| projects: >- | |
| --project=visual-desktop --project=visual-mobile | |
| --project=visual-setup-desktop --project=visual-setup-mobile | |
| --max-failures=0 | |
| advisory: true | |
| artifact: visual-diffs | |
| warning: Screenshots differ from the baselines. Review the visual-diffs artifact; if the change is intended, run the Visual Baselines workflow (e2e/visual/README.md). | |
| timeout: 40 | |
| - name: Rewind Visual Diffs | |
| projects: >- | |
| --project=rewind-visual-phone-chromium --project=rewind-visual-phone-webkit | |
| --project=rewind-visual-desktop-chromium --project=rewind-visual-desktop-webkit | |
| --max-failures=0 | |
| advisory: true | |
| artifact: rewind-visual-diffs | |
| warning: Screenshots differ from the baselines. Review the rewind-visual-diffs artifact; if the change is intended, run the Visual Baselines workflow (e2e/visual/README.md). A 12 px text or 44 px target check may have failed instead; the job log names the page. | |
| timeout: 60 | |
| # Blocking: the first-page JavaScript fits its 110 KB budget (about | |
| # 102 KB) and, since a turn no longer toggles inert on the pages or | |
| # restarts the chrome's colour transitions, heavy's longest task | |
| # stays under the 50 ms gate (P7.15). | |
| - name: Rewind Performance | |
| projects: --project=rewind-perf | |
| advisory: false | |
| artifact: rewind-perf-report | |
| timeout: 30 | |
| # Keep the tag equal to the exact @playwright/test version in package.json. | |
| container: | |
| image: mcr.microsoft.com/playwright:v1.57.0-noble | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: plex_manager_e2e_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| # Without Redis, FR-50 shows Rewind's unavailable state (P5.1, P6.9). | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| # Inside the job container the services are reached by name. | |
| DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/plex_manager_e2e_test?schema=public" | |
| E2E_DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/plex_manager_e2e_test?schema=public" | |
| REDIS_URL: "redis://redis:6379/0" | |
| # Inlined into the client bundle at build time; matches E2E_PORT's default. | |
| NEXT_PUBLIC_APP_URL: "http://localhost:3100" | |
| NEXTAUTH_URL: "http://localhost:3100" | |
| PLEX_CLIENT_IDENTIFIER: "00000000-0000-0000-0000-000000000000" | |
| E2E_TEST_MODE: "true" | |
| SKIP_CONNECTION_TESTS: "true" | |
| E2E_SERVER: prod | |
| # Firefox will not start when $HOME is not owned by the container's user | |
| # (root); GitHub sets HOME to the runner's /github/home. | |
| HOME: /root | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| # A fresh secret per run; the minted session cookies (e2e/fixtures/session.ts) | |
| # are signed with it. | |
| - name: Generate NEXTAUTH_SECRET | |
| run: | | |
| secret="$(node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('base64'))")" | |
| echo "::add-mask::$secret" | |
| echo "NEXTAUTH_SECRET=$secret" >> "$GITHUB_ENV" | |
| - name: Run Prisma migrations | |
| run: npm run db:deploy | |
| - name: Build the app for E2E | |
| run: npm run build:e2e | |
| # E2E_PREBUILT=1: the web server runs `next start` on the build above. | |
| - name: Run Playwright against the production build | |
| id: playwright | |
| continue-on-error: ${{ matrix.suite.advisory }} | |
| run: npx playwright test ${{ matrix.suite.projects }} | |
| env: | |
| E2E_PREBUILT: "1" | |
| - name: Flag the advisory failure | |
| if: steps.playwright.outcome == 'failure' && matrix.suite.advisory | |
| env: | |
| TITLE: ${{ matrix.suite.name }} | |
| WARNING: ${{ matrix.suite.warning }} | |
| run: echo "::warning title=$TITLE::$WARNING" | |
| - name: Upload the Playwright report and diffs | |
| if: failure() || steps.playwright.outcome == 'failure' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: ${{ matrix.suite.artifact }} | |
| path: | | |
| playwright-report/ | |
| test-results/ | |
| retention-days: 7 |