mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
# Description of Changes - Use the pinned official Playwright `v1.58.2-noble` container image. - Remove the per-browser `playwright install --with-deps` step from the matrix jobs. - Keep the browser matrix unchanged for independent Chromium, Firefox, and WebKit reporting. - Configure Playwright to use the container's root home directory while directing Docker to a separate configuration path. - Add npm retry and offline-cache settings to reduce transient dependency installation failures. This prevents three matrix jobs from concurrently downloading Playwright browsers and Linux dependencies, reducing network-related CI failures while preserving separate per-browser test results. --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have run `task check` to verify linters, typechecks, and tests pass - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details.
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@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1
|
|
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@01a4adf9db2d14c1de7a560f09170b6e0df736aa # v2.1.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
|