mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
82 lines
3.5 KiB
YAML
82 lines
3.5 KiB
YAML
name: Playwright E2E (stubbed)
|
|
|
|
# Reusable workflow called from build.yml. Backend-free Playwright suite —
|
|
# fast, no Spring Boot required. Runs against the `stubbed` project which
|
|
# mocks API responses in the browser. Fans out one job per browser
|
|
# (chromium/firefox/webkit) so all three run in parallel on their own runner.
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
playwright-e2e:
|
|
name: playwright-e2e (${{ matrix.browser }})
|
|
runs-on: ubuntu-latest
|
|
# The image already contains the Playwright browsers and all Linux
|
|
# dependencies. This keeps the matrix for per-browser reporting while
|
|
# avoiding three concurrent `playwright install --with-deps` runs.
|
|
container:
|
|
image: mcr.microsoft.com/playwright:v1.58.2-noble@sha256:6446946a1d9fd62d9ae501312a2d76a43ee688542b21622056a372959b65d63d
|
|
strategy:
|
|
# One browser breaking must not mask a failure in another - report all.
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- browser: chromium
|
|
project: stubbed
|
|
- browser: firefox
|
|
project: stubbed-firefox
|
|
- browser: webkit
|
|
project: stubbed-webkit
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
|
|
with:
|
|
egress-policy: audit
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
- name: Install Task
|
|
uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
|
|
- name: Build frontend (production bundle for vite preview)
|
|
env:
|
|
VITE_BUILD_FOR_PREVIEW: "1"
|
|
run: task frontend:build
|
|
- name: Run stubbed E2E tests (${{ matrix.browser }})
|
|
env:
|
|
# The official Playwright image expects its browser runtime under
|
|
# the root home directory. Keep this scoped to Playwright and use a
|
|
# neutral Docker config path so Docker does not read /root/.docker.
|
|
HOME: /root
|
|
DOCKER_CONFIG: /tmp/playwright-docker-config
|
|
PLAYWRIGHT_JSON_OUTPUT_FILE: ${{ github.workspace }}/frontend/playwright-report/results.json
|
|
NPM_CONFIG_PREFER_OFFLINE: "true"
|
|
NPM_CONFIG_FETCH_RETRIES: "5"
|
|
NPM_CONFIG_FETCH_RETRY_FACTOR: "2"
|
|
NPM_CONFIG_FETCH_RETRY_MINTIMEOUT: "1000"
|
|
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: "120000"
|
|
run: task e2e:stubbed-project PROJECT=${{ matrix.project }} -- --workers=3
|
|
- name: Flag flaky tests
|
|
# Runs regardless of the test outcome: a flaky test (passed on retry)
|
|
# leaves the step green, so this is the only place it surfaces. Emits
|
|
# ::warning:: annotations + a job summary; never fails the job.
|
|
if: always()
|
|
working-directory: frontend
|
|
run: npx tsx editor/scripts/report-flaky-tests.mts "$PLAYWRIGHT_JSON_OUTPUT_FILE"
|
|
env:
|
|
PLAYWRIGHT_JSON_OUTPUT_FILE: ${{ github.workspace }}/frontend/playwright-report/results.json
|
|
- name: Upload Playwright report
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: playwright-report-stubbed-${{ matrix.browser }}-${{ github.run_id }}
|
|
path: frontend/playwright-report/
|
|
retention-days: 7
|