#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
ci: one shard list per browser, frontend check back to check:all (#8133)
ConnorYohfe7b8693fd81
diff --git a/.github/workflows/e2e-stubbed.yml b/.github/workflows/e2e-stubbed.ymlindex c2b7ebc2a1..1fde804e45 100644--- a/.github/workflows/e2e-stubbed.yml+++ b/.github/workflows/e2e-stubbed.yml@@ -6,7 +6,8 @@ name: Playwright E2E (stubbed)## The suite is ~1000 tests. One job per browser on a 2-core runner took 30-50# minutes and was the longest job in every PR run, so each browser is split-# into Playwright shards (`--shard=i/n`) that each run on their own runner.+# into Playwright shards (`--shard=i/n`) that each run on their own runner;+# the shard list in the matrix is the single place to change the count.# The disk-link suite needs a desktop-mode bundle, so it is its own leg# instead of tailing the first chromium shard.on:@@ -17,7 +18,7 @@ permissions:jobs:playwright-e2e:- name: playwright-e2e (${{ matrix.label }})+ name: playwright-e2e (${{ matrix.browser }} ${{ matrix.shard }})runs-on: ubuntu-latesttimeout-minutes: 40# The image already contains the Playwright browsers and all Linux@@ -28,35 +29,21 @@ jobs:# One leg breaking must not mask a failure in another - report all.fail-fast: falsematrix:+ browser: [chromium, firefox, webkit]+ # One Playwright shard per entry, the same count for every browser.+ # Playwright splits shards by test count, so legs grow with the suite;+ # add an entry when the slowest leg passes about 15 minutes.+ shard: ["1/5", "2/5", "3/5", "4/5", "5/5"]include:- # webkit and firefox are the slow engines and get five shards;- # chromium gets four. Shards split by test count, and the viewer- # specs cluster, so the slowest shard still runs a few minutes- # longer than the rest. `artifact` is the label made safe for an- # artifact name.- - { label: "chromium 1/4", artifact: chromium-1of4, browser: chromium, project: stubbed, shard: 1, shards: 4 }- - { label: "chromium 2/4", artifact: chromium-2of4, browser: chromium, project: stubbed, shard: 2, shards: 4 }- - { label: "chromium 3/4", artifact: chromium-3of4, browser: chromium, project: stubbed, shard: 3, shards: 4 }- - { label: "chromium 4/4", artifact: chromium-4of4, browser: chromium, project: stubbed, shard: 4, shards: 4 }- - { label: "firefox 1/5", artifact: firefox-1of5, browser: firefox, project: stubbed-firefox, shard: 1, shards: 5 }- - { label: "firefox 2/5", artifact: firefox-2of5, browser: firefox, project: stubbed-firefox, shard: 2, shards: 5 }- - { label: "firefox 3/5", artifact: firefox-3of5, browser: firefox, project: stubbed-firefox, shard: 3, shards: 5 }- - { label: "firefox 4/5", artifact: firefox-4of5, browser: firefox, project: stubbed-firefox, shard: 4, shards: 5 }- - { label: "firefox 5/5", artifact: firefox-5of5, browser: firefox, project: stubbed-firefox, shard: 5, shards: 5 }- - { label: "webkit 1/5", artifact: webkit-1of5, browser: webkit, project: stubbed-webkit, shard: 1, shards: 5 }- - { label: "webkit 2/5", artifact: webkit-2of5, browser: webkit, project: stubbed-webkit, shard: 2, shards: 5 }- - { label: "webkit 3/5", artifact: webkit-3of5, browser: webkit, project: stubbed-webkit, shard: 3, shards: 5 }- - { label: "webkit 4/5", artifact: webkit-4of5, browser: webkit, project: stubbed-webkit, shard: 4, shards: 5 }- - { label: "webkit 5/5", artifact: webkit-5of5, browser: webkit, project: stubbed-webkit, shard: 5, shards: 5 }- # The frame-sampling viewer swap specs run serially on an unloaded- # runner (see the stubbed-viewer-swap projects in playwright.config.ts).- - { label: "chromium viewer-swap", artifact: chromium-viewer-swap, browser: chromium, project: stubbed-viewer-swap, workers: 1 }- - { label: "firefox viewer-swap", artifact: firefox-viewer-swap, browser: firefox, project: stubbed-viewer-swap-firefox, workers: 1 }- - { label: "webkit viewer-swap", artifact: webkit-viewer-swap, browser: webkit, project: stubbed-viewer-swap-webkit, workers: 1 }- # The disk-link suite exercises a seam chosen at build time, so it- # needs a desktop-mode bundle of its own. Chromium only: it is not- # testing engine behaviour.- - { label: "chromium disk-link", artifact: chromium-disk-link, browser: chromium, project: stubbed-desktop, suite: desktop }+ - { browser: chromium, project: stubbed }+ - { browser: firefox, project: stubbed-firefox }+ - { browser: webkit, project: stubbed-webkit }+ # A `shard` value outside the list above makes this a standalone+ # leg instead of an addition to every shard. The disk-link suite+ # exercises a seam chosen at build time, so it needs a desktop-mode+ # bundle of its own. Chromium only: it is not testing engine+ # behaviour.+ - { browser: chromium, shard: disk-link, project: stubbed-desktop, suite: desktop }steps:- name: Harden Runneruses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1@@ -85,7 +72,7 @@ jobs:VITE_BUILD_FOR_PREVIEW: "1"VITE_INCLUDE_PORTAL: "true"run: task frontend:build:proprietary- - name: Run stubbed E2E tests (${{ matrix.label }})+ - name: Run stubbed E2E tests (${{ matrix.browser }} ${{ matrix.shard }})if: matrix.suite != 'desktop'env:# The official Playwright image expects its browser runtime under@@ -99,7 +86,7 @@ jobs: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=${{ matrix.workers || 3 }} ${{ matrix.shard && format('--shard={0}/{1}', matrix.shard, matrix.shards) || '' }}+ run: task e2e:stubbed-project PROJECT=${{ matrix.project }} -- --workers=3 ${{ contains(matrix.shard, '/') && format('--shard={0}', matrix.shard) || '' }}- name: Build frontend (desktop mode, for the disk-link suite)if: matrix.suite == 'desktop'env:@@ -123,6 +110,7 @@ jobs:if: always()uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1with:- name: playwright-report-stubbed-${{ matrix.artifact }}-${{ github.run_id }}+ # job-index because `shard` holds a slash, which artifact names reject.+ name: playwright-report-stubbed-${{ matrix.browser }}-${{ strategy.job-index }}-${{ github.run_id }}path: frontend/playwright-report/retention-days: 7diff --git a/.github/workflows/frontend-validation.yml b/.github/workflows/frontend-validation.ymlindex 1a9b2bebfa..8b2c139514 100644--- a/.github/workflows/frontend-validation.yml+++ b/.github/workflows/frontend-validation.yml@@ -1,37 +1,19 @@name: Frontend lint, type-check, and build# Reusable workflow called from build.yml when frontend / testing sources-# change. Runs the checks behind `task frontend:check:all` as parallel legs-# (they are independent, and back to back on one 2-core runner they took-# ~10 minutes) and uploads the coverage + dist artifacts for downstream jobs.-# The `report` job owns the PR comment so the legs never race to post it.+# change. Runs `task frontend:check:all` and uploads the+# coverage + dist artifacts for downstream jobs.on:workflow_call:permissions:contents: read+ pull-requests: writejobs:- check:- name: frontend-validation (${{ matrix.check }})+ frontend-validation:runs-on: ubuntu-latesttimeout-minutes: 30- strategy:- fail-fast: false- matrix:- include:- # og:check stays ahead of anything that runs `prepare`, which- # regenerates the committed OG metadata it guards.- - check: lint- run: task frontend:og:check frontend:lint frontend:format:check- - check: typecheck- run: task frontend:typecheck:all- - check: build- run: task frontend:build- - check: test- run: task frontend:test- - check: storybook- run: task frontend:storybook:buildsteps:- name: Harden Runneruses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1@@ -47,59 +29,14 @@ jobs:cache-dependency-path: frontend/package-lock.json- name: Install Taskuses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0- - name: Run ${{ matrix.check }}- run: ${{ matrix.run }}- - name: Install uv- if: always() && matrix.check == 'test'- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0- with:- enable-cache: true- cache-dependency-glob: |- engine/pyproject.toml- engine/uv.lock- - name: Vitest coverage step summary- if: always() && matrix.check == 'test'- run: |- uv run --project engine --locked --group tools python scripts/coverage-summary.py \- --title "Frontend Vitest coverage" \- --vitest frontend/editor/coverage/coverage-summary.json \- --github-step-summary- - name: Upload vitest coverage report- if: always() && matrix.check == 'test'- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- with:- name: frontend-coverage- path: frontend/editor/coverage/- retention-days: 7- if-no-files-found: warn- - name: Upload frontend build artifacts- if: matrix.check == 'build'- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1- with:- name: frontend-build- path: frontend/editor/dist/- retention-days: 3-- # One place for the PR comment: posted when a leg failed, removed when all- # passed. Fails when the legs did so the workflow result says the same.- report:- name: frontend-validation (report)- needs: check- if: always()- runs-on: ubuntu-latest- timeout-minutes: 5- permissions:- contents: read- pull-requests: write- steps:- - name: Harden Runner- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1- with:- egress-policy: audit+ - name: Quality-check frontend+ id: frontend-check+ run: task frontend:check:all+ continue-on-error: true- name: Comment on frontend check failure# Only post a comment on PRs. github-script's PR helpers need an# issue/PR number, which doesn't exist on merge_group runs.- if: needs.check.result == 'failure' && github.event_name == 'pull_request'+ if: steps.frontend-check.outcome == 'failure' && github.event_name == 'pull_request'continue-on-error: trueuses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0with:@@ -134,8 +71,23 @@ jobs:body,});}+ - name: Fail if frontend check failed+ if: steps.frontend-check.outcome == 'failure'+ run: |+ echo "============================================"+ echo " Frontend Check Failed"+ echo "============================================"+ echo ""+ echo "There are issues with your frontend code that"+ echo "will need to be fixed before they can be merged in."+ echo ""+ echo "Run 'task frontend:fix' to auto-fix what can be"+ echo "fixed automatically, then run 'task frontend:check:all'"+ echo "to see what still needs fixing manually."+ echo "============================================"+ exit 1- name: Remove frontend check comment on success- if: needs.check.result == 'success' && github.event_name == 'pull_request'+ if: steps.frontend-check.outcome == 'success' && github.event_name == 'pull_request'continue-on-error: trueuses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0with:@@ -154,18 +106,32 @@ jobs:comment_id: existing.id,});}- - name: Fail if frontend check failed- if: needs.check.result != 'success'+ - name: Install uv+ if: always()+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0+ with:+ enable-cache: true+ cache-dependency-glob: |+ engine/pyproject.toml+ engine/uv.lock+ - name: Vitest coverage step summary+ if: always()run: |- echo "============================================"- echo " Frontend Check Failed"- echo "============================================"- echo ""- echo "There are issues with your frontend code that"- echo "will need to be fixed before they can be merged in."- echo ""- echo "Run 'task frontend:fix' to auto-fix what can be"- echo "fixed automatically, then run 'task frontend:check:all'"- echo "to see what still needs fixing manually."- echo "============================================"- exit 1+ uv run --project engine --locked --group tools python scripts/coverage-summary.py \+ --title "Frontend Vitest coverage" \+ --vitest frontend/editor/coverage/coverage-summary.json \+ --github-step-summary+ - name: Upload vitest coverage report+ if: always()+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: frontend-coverage+ path: frontend/editor/coverage/+ retention-days: 7+ if-no-files-found: warn+ - name: Upload frontend build artifacts+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1+ with:+ name: frontend-build+ path: frontend/editor/dist/+ retention-days: 3diff --git a/.taskfiles/e2e.yml b/.taskfiles/e2e.ymlindex 4f25f82bbc..23c7043d60 100644--- a/.taskfiles/e2e.yml+++ b/.taskfiles/e2e.yml@@ -14,9 +14,6 @@ tasks:deps: [ ':frontend:prepare' ]cmds:- npx playwright test --project=stubbed {{.CLI_ARGS}}- # One worker pool serves every project in an invocation, so the- # frame-sampling viewer swap specs get their own run with one worker.- - npx playwright test --project=stubbed-viewer-swap {{.CLI_ARGS}} --workers=1stubbed-desktop:desc: "Run the disk-link E2E suite against a desktop-mode build"@@ -183,7 +180,6 @@ tasks:deps: [ ':frontend:prepare' ]cmds:- npx playwright test --project=stubbed --project=stubbed-firefox --project=stubbed-webkit {{.CLI_ARGS}}- - npx playwright test --project=stubbed-viewer-swap --project=stubbed-viewer-swap-firefox --project=stubbed-viewer-swap-webkit {{.CLI_ARGS}} --workers=1check:desc: "Run all E2E tests not requiring Docker"diff --git a/frontend/editor/playwright.config.ts b/frontend/editor/playwright.config.tsindex c3d5459a27..8b7f19da5b 100644--- a/frontend/editor/playwright.config.ts+++ b/frontend/editor/playwright.config.ts@@ -35,13 +35,6 @@ const DEV_PORT = process.env.V2_PORT ?? "5173";const DESKTOP_PORT = process.env.V2_DESKTOP_PORT ?? "5273";const DISK_LINK_SPECS = /disk-link-.*\.spec\.ts/;-// The viewer swap specs sample animation frames during a byte swap and assert-// that no frame shows the wrong position, zoom or page width. Three workers on-// a 2-core CI runner starve that sampler, so CI runs them on their own leg with-// one worker; the sharded stubbed projects skip them.-const VIEWER_SWAP_SPECS =- /viewer-(hot-reload-matrix|in-place-reload)\.spec\.ts/;-export default defineConfig({testDir: "./src/core/tests",testMatch: "**/*.spec.ts",@@ -80,7 +73,7 @@ export default defineConfig({{name: "stubbed",testDir: "./src/core/tests/stubbed",- testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_SPECS],+ testIgnore: DISK_LINK_SPECS,use: chromiumViewport,},@@ -96,35 +89,6 @@ export default defineConfig({},},- // Serial arm of the stubbed suite, one per engine: the frame-sampling- // viewer swap specs. `fullyParallel: false` keeps each file in one worker;- // the CI leg also passes --workers=1.- {- name: "stubbed-viewer-swap",- testDir: "./src/core/tests/stubbed",- testMatch: VIEWER_SWAP_SPECS,- fullyParallel: false,- use: chromiumViewport,- },- {- name: "stubbed-viewer-swap-firefox",- testDir: "./src/core/tests/stubbed",- testMatch: VIEWER_SWAP_SPECS,- fullyParallel: false,- use: { ...devices["Desktop Firefox"], viewport: STUBBED_VIEWPORT },- },- {- name: "stubbed-viewer-swap-webkit",- testDir: "./src/core/tests/stubbed",- testMatch: VIEWER_SWAP_SPECS,- fullyParallel: false,- use: {- ...devices["Desktop Safari"],- viewport: STUBBED_VIEWPORT,- deviceScaleFactor: 1,- },- },-// Live setup - runs once before the live suite to perform the real// forced-password-change first-login flow against a freshly-booted// backend. The live project depends on it.@@ -161,13 +125,13 @@ export default defineConfig({{name: "stubbed-firefox",testDir: "./src/core/tests/stubbed",- testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_SPECS],+ testIgnore: DISK_LINK_SPECS,use: { ...devices["Desktop Firefox"], viewport: STUBBED_VIEWPORT },},{name: "stubbed-webkit",testDir: "./src/core/tests/stubbed",- testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_SPECS],+ testIgnore: DISK_LINK_SPECS,// Desktop Safari ships deviceScaleFactor 2; the editor now renders// bitmaps at dpr x zoom, so leaving it would 4x every page raster in// this suite. The HiDPI spec opts into 2x deliberately where it matters.diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.propertiesindex 60f3b911e0..33aaef924c 100644--- a/gradle/wrapper/gradle-wrapper.properties+++ b/gradle/wrapper/gradle-wrapper.properties@@ -2,6 +2,8 @@ distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zipnetworkTimeout=10000+# Retries for downloading the Gradle distribution itself, not for tests: one+# 504 from services.gradle.org used to fail the cache prime job.retries=3retryBackOffMs=500validateDistributionUrl=true