Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

ci: shard the e2e matrix, split the compose job, stop rebuilding in image tests (#8113)

ConnorYohfaf3bb649b61
diff --git a/.github/workflows/PR-Auto-Deploy-V2.yml b/.github/workflows/PR-Auto-Deploy-V2.yml
index 791946a6bc..e8f016731f 100644
--- a/.github/workflows/PR-Auto-Deploy-V2.yml
+++ b/.github/workflows/PR-Auto-Deploy-V2.yml
@@ -276,8 +276,10 @@ jobs:
context: .
file: ./docker/embedded/Dockerfile
push: true
+ # Read the cache the main-branch publish writes, never write it back:
+ # the build stage changes on every push, so the export bought nothing
+ # and its blobs crowded the nightly Rust caches out of the 10 GB store.
cache-from: type=gha,scope=stirling-pdf-latest
- cache-to: type=gha,mode=max,scope=stirling-pdf-latest
tags: ghcr.io/${{ steps.repoowner.outputs.lowercase }}/stirling-pdf-test:v2-${{ steps.commit-hash.outputs.app_short }}
build-args: |
VERSION_TAG=v2-alpha
diff --git a/.github/workflows/ai-engine.yml b/.github/workflows/ai-engine.yml
index bfc67705cb..b1540f1a92 100644
--- a/.github/workflows/ai-engine.yml
+++ b/.github/workflows/ai-engine.yml
@@ -15,6 +15,7 @@ permissions:
jobs:
engine:
runs-on: ubuntu-latest
+ timeout-minutes: 20
permissions:
contents: read
pull-requests: write
diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml
index a3dfaf4a27..2e64eb11a2 100644
--- a/.github/workflows/backend-build.yml
+++ b/.github/workflows/backend-build.yml
@@ -24,6 +24,7 @@ jobs:
name: ci-unsigned
deployment: false
runs-on: ubuntu-latest
+ timeout-minutes: 30
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5d9a86668e..783b32edbb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -177,23 +177,15 @@ jobs:
with:
docker-base-changed: ${{ needs.files-changed.outputs.docker-base }}
+ # The image builds compile the code inside their own build stage and do
+ # not touch the Gradle cache, so they start with the rest of the fan-out
+ # instead of waiting ~9 minutes for the backend matrix. That wait became
+ # the critical path once the e2e matrix was sharded.
test-build-docker-images:
if: |
- !cancelled() &&
github.event_name == 'pull_request' &&
- needs.files-changed.outputs.project == 'true' &&
- contains(fromJSON('["success", "skipped"]'), needs.gradle-cache-prime.result) &&
- contains(fromJSON('["success", "skipped"]'), needs.build.result) &&
- contains(fromJSON('["success", "skipped"]'), needs.check-generateOpenApiDocs.result) &&
- contains(fromJSON('["success", "skipped"]'), needs.check-licence.result)
- needs:
- [
- files-changed,
- build,
- check-generateOpenApiDocs,
- check-licence,
- gradle-cache-prime,
- ]
+ needs.files-changed.outputs.project == 'true'
+ needs: [files-changed]
permissions:
contents: read
packages: read
@@ -295,6 +287,7 @@ jobs:
all-checks-passed:
name: All checks passed
if: always()
+ timeout-minutes: 10
needs:
- files-changed
- gradle-cache-prime
diff --git a/.github/workflows/check-generated-models.yml b/.github/workflows/check-generated-models.yml
index 12e2c5cafa..2330de1a72 100644
--- a/.github/workflows/check-generated-models.yml
+++ b/.github/workflows/check-generated-models.yml
@@ -23,6 +23,7 @@ permissions:
jobs:
generated-models:
runs-on: ubuntu-latest
+ timeout-minutes: 20
permissions:
contents: read
pull-requests: write
diff --git a/.github/workflows/check-licence.yml b/.github/workflows/check-licence.yml
index db5486c9d7..210d032bf7 100644
--- a/.github/workflows/check-licence.yml
+++ b/.github/workflows/check-licence.yml
@@ -14,6 +14,7 @@ jobs:
name: ci-unsigned
deployment: false
runs-on: ubuntu-latest
+ timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
diff --git a/.github/workflows/check-openapi.yml b/.github/workflows/check-openapi.yml
index 4eb0aa6667..8dee906d21 100644
--- a/.github/workflows/check-openapi.yml
+++ b/.github/workflows/check-openapi.yml
@@ -15,6 +15,7 @@ jobs:
name: ci-unsigned
deployment: false
runs-on: ubuntu-latest
+ timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index ff17f5947c..eb0badde7f 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -12,6 +12,7 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-latest
+ timeout-minutes: 10
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.yml
index f7570ca32b..f83e9577ab 100644
--- a/.github/workflows/docker-compose-tests.yml
+++ b/.github/workflows/docker-compose-tests.yml
@@ -1,8 +1,14 @@
name: Docker Compose Cucumber tests
# Reusable workflow called from build.yml when project / docker / testing
-# sources change. Boots the docker-compose stack and runs the cucumber
-# scenarios in testing/cucumber.
+# sources change. Builds the embedded images, boots the docker-compose stacks
+# and runs the cucumber scenarios in testing/cucumber.
+#
+# One leg per image. testing/test.sh builds the ultra-lite image for one
+# stack and the fat image for three; in a single job those two builds ran
+# back to back (~25 minutes) in front of ~4 minutes of tests. `--rerun` is
+# the script's own filter: a leg names the tests it owns and the script only
+# builds the image those tests need.
on:
workflow_call:
inputs:
@@ -17,14 +23,28 @@ permissions:
jobs:
docker-compose-tests:
+ name: docker-compose-tests (${{ matrix.image }})
environment:
name: ci-unsigned
deployment: false
runs-on: ubuntu-latest
+ timeout-minutes: 40
permissions:
actions: write
contents: read
checks: write
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - image: ultra-lite
+ tests: Stirling-PDF-Ultra-Lite,Webpage-Accessibility-lite,Stirling-PDF-Ultra-Lite-Version-Check
+ cucumber: false
+ # The cucumber suite (Stirling-PDF-Security-Fat-with-login) runs
+ # against the fat image, so JaCoCo coverage is collected here only.
+ - image: fat
+ tests: Stirling-PDF-Security-Fat,Webpage-Accessibility-full,Stirling-PDF-Security-Fat-Version-Check,Stirling-PDF-Security-Fat-with-login,Stirling-PDF-Fat-Disable-Endpoints,Disabled-Endpoints,Stirling-PDF-Fat-Disable-Endpoints-Version-Check
+ cucumber: true
steps:
- name: Harden Runner
@@ -35,6 +55,8 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ # printVersion, copyJacocoAgent and jacocoReportFromExec still run
+ # Gradle on the host, so the dependency cache is still worth restoring.
- name: Restore cache Gradle User Home
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -63,12 +85,19 @@ jobs:
if: inputs.docker-base-changed != 'true'
uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0
+ # --fail so a gateway error page is never saved as the binary (a 504 once
+ # left bash trying to execute HTML at `docker-compose up`), and retries
+ # for the transient 5xx the runners see from GitHub releases.
- name: Install Docker Compose
run: |
- sudo curl -SL "https://github.com/docker/compose/releases/download/v5.4.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+ sudo curl --fail --location --retry 5 --retry-delay 3 --retry-all-errors \
+ "https://github.com/docker/compose/releases/download/v5.4.0/docker-compose-$(uname -s)-$(uname -m)" \
+ -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
+ docker-compose version
- name: Install uv
+ if: matrix.cucumber
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
@@ -77,6 +106,7 @@ jobs:
engine/uv.lock
- name: Install Cucumber and coverage dependencies
+ if: matrix.cucumber
run: |
uv sync --project engine --locked --group cucumber --group tools
@@ -84,30 +114,33 @@ jobs:
# Stages build/jacoco/jacocoagent.jar where the coverage override
# file bind-mounts it into the cucumber container. The agent jar
# never goes into the published image - this is host-only.
+ if: matrix.cucumber
run: ./gradlew copyJacocoAgent -PnoSpotless
- - name: Run Docker Compose Tests
+ - name: Run Docker Compose Tests (${{ matrix.image }})
run: |
chmod +x ./testing/test_webpages.sh
chmod +x ./testing/test.sh
chmod +x ./testing/test_disabledEndpoints.sh
- ./testing/test.sh
+ ./testing/test.sh --rerun "$TESTS"
env:
+ TESTS: ${{ matrix.tests }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_PUBLIC_URL: ${{ secrets.MAVEN_PUBLIC_URL }}
DOCKER_BASE_CHANGED: ${{ inputs.docker-base-changed }}
# Tells test.sh to layer testing/compose/docker-compose-coverage.override.yml
# over the cucumber compose so the container starts with the
- # JaCoCo agent attached via JAVA_CUSTOM_OPTS.
- STIRLING_PDF_TEST_COVERAGE: "1"
+ # JaCoCo agent attached via JAVA_CUSTOM_OPTS. Empty on the leg
+ # that never runs cucumber.
+ STIRLING_PDF_TEST_COVERAGE: ${{ matrix.cucumber && '1' || '' }}
- name: Generate cucumber JaCoCo report
# `if: always()` so a behave failure still produces partial
# coverage from whatever endpoints did run. The exec file only
# exists when the container shut down cleanly - guard so the step
# is silent on the (rare) crash path.
- if: always()
+ if: always() && matrix.cucumber
id: cucumber-coverage
run: |
if [ -s testing/cucumber-coverage/cucumber.exec ]; then
@@ -122,7 +155,7 @@ jobs:
fi
- name: Cucumber coverage step summary
- if: always() && steps.cucumber-coverage.outputs.report == 'true'
+ if: always() && matrix.cucumber && steps.cucumber-coverage.outputs.report == 'true'
run: |
uv run --project engine --locked --group tools python scripts/coverage-summary.py \
--title "Cucumber (docker) JaCoCo coverage" \
@@ -130,7 +163,7 @@ jobs:
--github-step-summary
- name: Upload cucumber JaCoCo report
- if: always() && steps.cucumber-coverage.outputs.report == 'true'
+ if: always() && matrix.cucumber && steps.cucumber-coverage.outputs.report == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jacoco-cucumber-${{ github.run_id }}
@@ -140,7 +173,7 @@ jobs:
- name: Upload raw cucumber .exec for aggregate merge
# Picked up by the coverage-aggregate workflow via the
# `jacoco-exec-*` artifact name pattern.
- if: always() && steps.cucumber-coverage.outputs.report == 'true'
+ if: always() && matrix.cucumber && steps.cucumber-coverage.outputs.report == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jacoco-exec-cucumber
@@ -149,7 +182,7 @@ jobs:
if-no-files-found: warn
- name: Upload Cucumber Report
- if: always()
+ if: always() && matrix.cucumber
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cucumber-report
@@ -161,13 +194,13 @@ jobs:
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
- name: docker-compose-test-reports
+ name: docker-compose-test-reports-${{ matrix.image }}
path: testing/reports/
retention-days: 7
if-no-files-found: warn
- name: Cucumber Test Report
- if: always()
+ if: always() && matrix.cucumber
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
with:
name: Cucumber Tests
diff --git a/.github/workflows/e2e-stubbed.yml b/.github/workflows/e2e-stubbed.yml
index 7c0b69a1e1..8fdec9e45e 100644
--- a/.github/workflows/e2e-stubbed.yml
+++ b/.github/workflows/e2e-stubbed.yml
@@ -1,9 +1,14 @@
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.
+# Reusable workflow called from build.yml. Backend-free Playwright suite: no
+# Spring Boot required, the `stubbed` projects mock API responses in the
+# browser.
+#
+# 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.
+# The disk-link suite needs a desktop-mode bundle, so it is its own leg
+# instead of tailing the first chromium shard.
on:
workflow_call:
@@ -12,24 +17,46 @@ permissions:
jobs:
playwright-e2e:
- name: playwright-e2e (${{ matrix.browser }})
+ name: playwright-e2e (${{ matrix.label }})
runs-on: ubuntu-latest
+ timeout-minutes: 40
# 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.
+ # dependencies, so no leg pays for `playwright install --with-deps`.
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.
+ # One leg 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
+ # 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 }
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
@@ -48,12 +75,16 @@ jobs:
cache-dependency-path: frontend/package-lock.json
- name: Install Task
uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
+ # Every leg needs this, the disk-link one included: the OG prerender
+ # plugin in vite.config.ts reads dist/index.html whatever --outDir the
+ # desktop build was given.
- name: Build frontend (production bundle for vite preview)
env:
VITE_BUILD_FOR_PREVIEW: "1"
VITE_INCLUDE_PORTAL: "true"
run: task frontend:build:proprietary
- - name: Run stubbed E2E tests (${{ matrix.browser }})
+ - name: Run stubbed E2E tests (${{ matrix.label }})
+ if: matrix.suite != 'desktop'
env:
# The official Playwright image expects its browser runtime under
# the root home directory. Keep this scoped to Playwright and use a
@@ -66,21 +97,18 @@ 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=3
- # 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, and building twice on all three would treble the job.
+ run: task e2e:stubbed-project PROJECT=${{ matrix.project }} -- --workers=${{ matrix.workers || 3 }} ${{ matrix.shard && format('--shard={0}/{1}', matrix.shard, matrix.shards) || '' }}
- name: Build frontend (desktop mode, for the disk-link suite)
- if: matrix.browser == 'chromium'
+ if: matrix.suite == 'desktop'
env:
VITE_BUILD_FOR_PREVIEW: "1"
run: task frontend:build:desktop:e2e
- name: Run disk-link E2E tests (desktop mode)
- if: matrix.browser == 'chromium'
+ if: matrix.suite == 'desktop'
env:
HOME: /root
DOCKER_CONFIG: /tmp/playwright-docker-config
- PLAYWRIGHT_JSON_OUTPUT_FILE: ${{ github.workspace }}/frontend/playwright-report/results-desktop.json
+ PLAYWRIGHT_JSON_OUTPUT_FILE: ${{ github.workspace }}/frontend/playwright-report/results.json
run: task e2e:stubbed-desktop -- --workers=3
- name: Flag flaky tests
if: always()
@@ -93,6 +121,6 @@ jobs:
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
- name: playwright-report-stubbed-${{ matrix.browser }}-${{ github.run_id }}
+ name: playwright-report-stubbed-${{ matrix.artifact }}-${{ github.run_id }}
path: frontend/playwright-report/
retention-days: 7
diff --git a/.github/workflows/frontend-validation.yml b/.github/workflows/frontend-validation.yml
index a553c48280..d3968a3d21 100644
--- a/.github/workflows/frontend-validation.yml
+++ b/.github/workflows/frontend-validation.yml
@@ -1,18 +1,37 @@
name: Frontend lint, type-check, and build
# Reusable workflow called from build.yml when frontend / testing sources
-# change. Runs `task frontend:check:all` and uploads the
-# coverage + dist artifacts for downstream jobs.
+# 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.
on:
workflow_call:
permissions:
contents: read
- pull-requests: write
jobs:
- frontend-validation:
+ check:
+ name: frontend-validation (${{ matrix.check }})
runs-on: ubuntu-latest
+ timeout-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:build
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
@@ -28,14 +47,59 @@ jobs:
cache-dependency-path: frontend/package-lock.json
- name: Install Task
uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- - name: Quality-check frontend
- id: frontend-check
- run: task frontend:check:all
- continue-on-error: true
+ - name: Run ${{ matrix.check }}
+ run: ${{ matrix.run }}
+ - name: Install uv
+ if: always() && matrix.check == 'test'
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
+ 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@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
+ with:
+ egress-policy: audit
- 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: steps.frontend-check.outcome == 'failure' && github.event_name == 'pull_request'
+ if: needs.check.result == 'failure' && github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
@@ -70,23 +134,8 @@ 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: steps.frontend-check.outcome == 'success' && github.event_name == 'pull_request'
+ if: needs.check.result == 'success' && github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
@@ -105,32 +154,18 @@ jobs:
comment_id: existing.id,
});
}
- - name: Install uv
- if: always()
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- with:
- enable-cache: true
- cache-dependency-glob: |
- engine/pyproject.toml
- engine/uv.lock
- - name: Vitest coverage step summary
- if: always()
+ - name: Fail if frontend check failed
+ if: needs.check.result != 'success'
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()
- 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: 3
+ 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
diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml
index f3442086a0..9d9abd194e 100644
--- a/.github/workflows/pre_commit.yml
+++ b/.github/workflows/pre_commit.yml
@@ -12,6 +12,7 @@ permissions:
jobs:
pre-commit:
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/tauri-build.yml
index fc46e88887..87cc3d46b0 100644
--- a/.github/workflows/tauri-build.yml
+++ b/.github/workflows/tauri-build.yml
@@ -68,6 +68,7 @@ jobs:
deployment: false
if: ${{ vars.CI_PROFILE != 'lite' }}
runs-on: ubuntu-latest
+ timeout-minutes: 5
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
@@ -123,6 +124,7 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.determine-matrix.outputs.matrix) }}
runs-on: ${{ matrix.platform }}
+ timeout-minutes: 90
env:
TAURI_BUNDLER_DMG_IGNORE_CI: "true"
SM_API_KEY: ${{ secrets.SM_API_KEY }}
@@ -175,6 +177,10 @@ jobs:
# Save the dependency cache even if a later step fails
cache-on-failure: true
+ # The shared key is only ever written by the Linux prime job, so on
+ # Windows and macOS it never hits and every PR leg downloaded the Gradle
+ # distribution and every dependency. Fall back to the cache the nightly
+ # warm run saves for this OS.
- name: Restore cache Gradle User Home
if: inputs.use_shared_cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
@@ -183,6 +189,8 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
key: gradle-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'buildSrc/**', 'settings.gradle', 'build.gradle', 'app/**/build.gradle', 'gradle/**/*.gradle') }}
+ restore-keys: |
+ gradle-tauri-build-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-
- name: Restore cache Gradle
if: inputs.use_shared_cache == false
@@ -192,6 +200,8 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
key: gradle-tauri-build-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'buildSrc/**', 'settings.gradle', 'build.gradle', 'app/**/build.gradle', 'gradle/**/*.gradle') }}
+ restore-keys: |
+ gradle-tauri-build-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-
- name: Set up x86_64 JDK 25 (macOS universal JRE)
if: matrix.platform == 'macos-15'
@@ -238,9 +248,6 @@ jobs:
JPDFIUM_PLATFORMS: ${{ matrix.jpdfium_platforms }}
run: task desktop:prepare
- - name: Run Tauri/Cargo tests
- run: task desktop:test
-
# DigiCert KeyLocker Setup (Cloud HSM)
- name: Setup DigiCert KeyLocker
id: digicert-setup
@@ -694,9 +701,103 @@ jobs:
fi
continue-on-error: true
+ # cargo test compiles the whole dependency graph in the dev profile, about
+ # four minutes on a cold cache, and used to run ahead of the bundle build
+ # in the same job. It runs beside it now. desktop:test still runs
+ # desktop:prepare first (jar + bundled JRE) so the crate builds under the
+ # same conditions as the bundle.
+ test:
+ name: test (${{ matrix.name }})
+ environment:
+ name: ci-unsigned
+ deployment: false
+ needs: determine-matrix
+ strategy:
+ fail-fast: false
+ matrix: ${{ fromJson(needs.determine-matrix.outputs.matrix) }}
+ runs-on: ${{ matrix.platform }}
+ timeout-minutes: 45
+ 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: Install dependencies (ubuntu only)
+ if: matrix.platform == 'ubuntu-22.04'
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libjavascriptcoregtk-4.0-dev libsoup2.4-dev libjavascriptcoregtk-4.1-dev libsoup-3.0-dev
+
+ - name: Setup Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22
+ cache: "npm"
+ cache-dependency-path: frontend/package-lock.json
+
+ - name: Setup Rust
+ uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
+ with:
+ toolchain: stable
+
+ # Dev-profile artifacts, kept apart from the release cache the bundle
+ # build restores. Written on main (the nightly warm run); PRs restore.
+ - name: Cache Rust build
+ uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
+ with:
+ workspaces: frontend/editor/src-tauri
+ shared-key: tauri-test-${{ matrix.name }}
+ save-if: ${{ github.ref == 'refs/heads/main' }}
+ cache-on-failure: true
+
+ - name: Restore cache Gradle User Home
+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+ with:
+ path: |
+ ~/.gradle/caches
+ ~/.gradle/wrapper
+ key: gradle-tauri-build-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'buildSrc/**', 'settings.gradle', 'build.gradle', 'app/**/build.gradle', 'gradle/**/*.gradle') }}
+ restore-keys: |
+ gradle-tauri-build-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-
+
+ - name: Set up JDK 25
+ if: matrix.platform != 'windows-11-arm'
+ uses: ./.github/actions/java
+ with:
+ java-version: "25"
+
+ # Windows ARM64 runners have no preinstalled JDK 25; Microsoft provides an ARM64 build.
+ - name: Set up JDK 25 (Windows ARM64)
+ if: matrix.platform == 'windows-11-arm'
+ uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
+ with:
+ java-version: "25"
+ distribution: "microsoft"
+ architecture: "arm64"
+
+ - name: Setup Task
+ uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
+
+ - name: Prepare desktop build
+ env:
+ MAVEN_USER: ${{ secrets.MAVEN_USER }}
+ MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+ MAVEN_PUBLIC_URL: ${{ secrets.MAVEN_PUBLIC_URL }}
+ DISABLE_ADDITIONAL_FEATURES: true
+ JPDFIUM_PLATFORMS: ${{ matrix.jpdfium_platforms }}
+ run: task desktop:prepare
+
+ - name: Run Tauri/Cargo tests
+ run: task desktop:test
+
pr-comment:
needs: build
runs-on: ubuntu-latest
+ timeout-minutes: 5
# Fork and Dependabot pull_request runs receive a read-only GITHUB_TOKEN,
# so the API cannot create or update PR comments there. The artifacts are
# still uploaded and remain available from the Actions run page.
@@ -796,8 +897,9 @@ jobs:
}
report:
- needs: build
+ needs: [build, test]
runs-on: ubuntu-latest
+ timeout-minutes: 5
if: always()
steps:
- name: Harden the runner (Audit all outbound calls)
@@ -807,8 +909,8 @@ jobs:
- name: Report build results
run: |
- if [ "${{ needs.build.result }}" = "success" ]; then
- echo "✅ All Tauri builds completed successfully!"
+ if [ "${{ needs.build.result }}" = "success" ] && [ "${{ needs.test.result }}" = "success" ]; then
+ echo "✅ All Tauri builds and tests completed successfully!"
echo "Artifacts are ready for distribution."
elif [ "${{ needs.build.result }}" = "skipped" ]; then
echo "⏭️ Tauri builds skipped (CI lite mode enabled)"
diff --git a/.github/workflows/test-build-docker.yml b/.github/workflows/test-build-docker.yml
index d96f35588f..eae6d0025c 100644
--- a/.github/workflows/test-build-docker.yml
+++ b/.github/workflows/test-build-docker.yml
@@ -4,6 +4,11 @@ name: Build Docker images (PR test)
# embedded Dockerfiles (default, ultra-lite, fat) still build cleanly,
# optionally against a freshly-built base image when the PR touches the
# base Dockerfile.
+#
+# Each Dockerfile compiles the backend and frontend in its own build stage
+# and .dockerignore keeps host build output out of the context, so nothing
+# is built on the host first. arm64 gets a native runner leg instead of a
+# QEMU build inside the amd64 job, which took over an hour per image.
on:
workflow_call:
inputs:
@@ -13,7 +18,7 @@ on:
type: string
default: "false"
dockerfiles-changed:
- description: "Whether any Dockerfile changed (forwarded from files-changed). Gates the slow arm64 build leg."
+ description: "Whether any Dockerfile changed (forwarded from files-changed). Gates the arm64 legs."
required: false
type: string
default: "false"
@@ -56,24 +61,31 @@ jobs:
if-no-files-found: error
test-build-docker-images:
+ name: test-build-docker-images (${{ matrix.docker-rev }}, ${{ matrix.platform }})
if: always() && (needs.prepare-base-image.result == 'success' || needs.prepare-base-image.result == 'skipped')
needs: [prepare-base-image]
environment:
name: ci-unsigned
deployment: false
- runs-on: ubuntu-latest
+ # GitHub's arm64 runners are free for public repositories.
+ runs-on: ${{ matrix.platform == 'linux/arm64/v8' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
+ timeout-minutes: 60
strategy:
fail-fast: false
matrix:
+ docker-rev:
+ - docker/embedded/Dockerfile
+ - docker/embedded/Dockerfile.ultra-lite
+ - docker/embedded/Dockerfile.fat
+ # arm64 is verified only when a Dockerfile changed and the base did
+ # not (a PR-built base exists for amd64 only), as before.
+ platform: ${{ fromJSON(inputs.dockerfiles-changed == 'true' && inputs.docker-base-changed != 'true' && '["linux/amd64", "linux/arm64/v8"]' || '["linux/amd64"]') }}
include:
- docker-rev: docker/embedded/Dockerfile
- artifact-suffix: Dockerfile
cache-scope: stirling-pdf-latest
- docker-rev: docker/embedded/Dockerfile.ultra-lite
- artifact-suffix: Dockerfile.ultra-lite
cache-scope: stirling-pdf-ultra-lite
- docker-rev: docker/embedded/Dockerfile.fat
- artifact-suffix: Dockerfile.fat
cache-scope: stirling-pdf-fat
steps:
- name: Harden Runner
@@ -91,10 +103,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ github.token }}
- - name: Convert repository owner to lowercase
- id: repoowner
- run: echo "lowercase=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT
-
- name: Free disk space on runner
run: |
echo "Disk space before cleanup:" && df -h
@@ -112,38 +120,11 @@ jobs:
if: github.event_name == 'pull_request' && inputs.docker-base-changed == 'true'
run: gzip -dc stirling-pdf-base-pr-test.tar.gz | docker load
- - name: Restore cache Gradle User Home
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: gradle-v1-${{ runner.os }}-${{ runner.arch }}-jdk-25-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', 'buildSrc/**', 'settings.gradle', 'build.gradle', 'app/**/build.gradle', 'gradle/**/*.gradle') }}
-
- - name: Set up JDK 25
- uses: ./.github/actions/java
- with:
- java-version: "25"
-
- - name: Install Task
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- - name: Build application
- run: task backend:build
- env:
- MAVEN_USER: ${{ secrets.MAVEN_USER }}
- MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- MAVEN_PUBLIC_URL: ${{ secrets.MAVEN_PUBLIC_URL }}
- DISABLE_ADDITIONAL_FEATURES: true
- STIRLING_PDF_DESKTOP_UI: false
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
-
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- - name: Set base image and platform for this build
+ - name: Set base image for this build
id: build-params
# Pass workflow inputs through env vars rather than expanding `${{ }}`
# directly into the shell — defense-in-depth against template injection
@@ -151,28 +132,18 @@ jobs:
# GITHUB_EVENT_NAME is already provided by the runner.
env:
DOCKER_BASE_CHANGED: ${{ inputs.docker-base-changed }}
- DOCKERFILES_CHANGED: ${{ inputs.dockerfiles-changed }}
run: |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && [ "$DOCKER_BASE_CHANGED" = "true" ]; then
- # Base Dockerfile changed: build against the locally-built base,
- # which only exists for amd64.
+ # Base Dockerfile changed: build against the locally-built base.
echo "base_image=stirling-pdf-base:pr-test" >> "$GITHUB_OUTPUT"
- echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
- elif [ "$DOCKERFILES_CHANGED" = "true" ]; then
- # A Dockerfile changed: also verify the arm64 build (slow QEMU leg).
- echo "base_image=stirlingtools/stirling-pdf-base:latest" >> "$GITHUB_OUTPUT"
- echo "platforms=linux/amd64,linux/arm64/v8" >> "$GITHUB_OUTPUT"
else
- # No Dockerfile change: amd64 only. arm64 is exercised on the base
- # image publish and on release, not on every code PR.
echo "base_image=stirlingtools/stirling-pdf-base:latest" >> "$GITHUB_OUTPUT"
- echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
fi
# Base-changed PRs build the embedded image with the local docker driver
# so the locally-built stirling-pdf-base:pr-test (in the daemon image
# store) resolves. A buildx container builder cannot see it and would try
- # to pull it from a registry, which fails. Single-platform, no gha cache.
+ # to pull it from a registry, which fails. No gha cache.
- name: Build ${{ matrix.docker-rev }} against local base (PR base change)
if: github.event_name == 'pull_request' && inputs.docker-base-changed == 'true'
run: |
@@ -183,8 +154,8 @@ jobs:
.
# PRs that did NOT change the base use the buildx container builder
- # (multi-platform + gha cache) against the published base image.
- - name: Build ${{ matrix.docker-rev }}
+ # against the published base image.
+ - name: Build ${{ matrix.docker-rev }} (${{ matrix.platform }})
if: inputs.docker-base-changed != 'true'
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
@@ -192,28 +163,19 @@ jobs:
context: .
file: ./${{ matrix.docker-rev }}
push: false
+ # Read the cache the main-branch publish writes, never write it
+ # back: exporting the build stage (mode=max) took ~5 minutes per
+ # image and PR entries were evicted before the next PR read them.
cache-from: type=gha,scope=${{ matrix.cache-scope }}
- cache-to: type=gha,mode=max,scope=${{ matrix.cache-scope }}
- platforms: ${{ steps.build-params.outputs.platforms }}
+ platforms: ${{ matrix.platform }}
build-args: |
BASE_IMAGE=${{ steps.build-params.outputs.base_image }}
provenance: true
sbom: true
- - name: Upload Reports
- if: always()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: reports-docker-${{ matrix.artifact-suffix }}
- path: |
- build/reports/tests/
- build/test-results/
- build/reports/problems/
- retention-days: 3
- if-no-files-found: warn
-
test-build-unoserver-image:
runs-on: ubuntu-latest
+ timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
diff --git a/.taskfiles/e2e.yml b/.taskfiles/e2e.yml
index 23c7043d60..4f25f82bbc 100644
--- a/.taskfiles/e2e.yml
+++ b/.taskfiles/e2e.yml
@@ -14,6 +14,9 @@ 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=1
stubbed-desktop:
desc: "Run the disk-link E2E suite against a desktop-mode build"
@@ -180,6 +183,7 @@ 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=1
check:
desc: "Run all E2E tests not requiring Docker"
diff --git a/frontend/editor/playwright.config.ts b/frontend/editor/playwright.config.ts
index 8b7f19da5b..c3d5459a27 100644
--- a/frontend/editor/playwright.config.ts
+++ b/frontend/editor/playwright.config.ts
@@ -35,6 +35,13 @@ 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",
@@ -73,7 +80,7 @@ export default defineConfig({
{
name: "stubbed",
testDir: "./src/core/tests/stubbed",
- testIgnore: DISK_LINK_SPECS,
+ testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_SPECS],
use: chromiumViewport,
},
@@ -89,6 +96,35 @@ 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.
@@ -125,13 +161,13 @@ export default defineConfig({
{
name: "stubbed-firefox",
testDir: "./src/core/tests/stubbed",
- testIgnore: DISK_LINK_SPECS,
+ testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_SPECS],
use: { ...devices["Desktop Firefox"], viewport: STUBBED_VIEWPORT },
},
{
name: "stubbed-webkit",
testDir: "./src/core/tests/stubbed",
- testIgnore: DISK_LINK_SPECS,
+ testIgnore: [DISK_LINK_SPECS, VIEWER_SWAP_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.properties
index ad7845be30..60f3b911e0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -2,7 +2,7 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
-retries=0
+retries=3
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/testing/compose/docker-compose-coverage.override.yml b/testing/compose/docker-compose-coverage.override.yml
index 9af2a4a181..019f5a373c 100644
--- a/testing/compose/docker-compose-coverage.override.yml
+++ b/testing/compose/docker-compose-coverage.override.yml
@@ -6,6 +6,10 @@
# copyJacocoAgent`) so the published Stirling-PDF image stays untouched and
# we cannot accidentally ship the agent to end users.
#
+# Host paths go through PROJECT_ROOT (exported by testing/test.sh) because
+# Compose resolves relative paths against the first `-f` file's directory,
+# which is docker/embedded/compose/ when test.sh drives the run, not this one.
+#
# The container appends the agent to its JVM via `JAVA_CUSTOM_OPTS`, which
# the init script concatenates into `JAVA_TOOL_OPTIONS` for the Spring Boot
# process. On graceful shutdown the agent writes
@@ -18,8 +22,8 @@ services:
# so the volume mounts intentionally land on whichever service uses the
# key "stirling-pdf" in the base file.
volumes:
- - ../../build/jacoco/jacocoagent.jar:/jacoco/jacocoagent.jar:ro
- - ../../testing/cucumber-coverage:/jacoco-out:rw
+ - ${PROJECT_ROOT}/build/jacoco/jacocoagent.jar:/jacoco/jacocoagent.jar:ro
+ - ${PROJECT_ROOT}/testing/cucumber-coverage:/jacoco-out:rw
environment:
# append=false so an aborted re-run starts clean. dumponexit=true is
# what flushes the .exec when SIGTERM hits the JVM (which happens on
diff --git a/testing/test.sh b/testing/test.sh
index 254d566763..5a1bbf5276 100644
--- a/testing/test.sh
+++ b/testing/test.sh
@@ -30,6 +30,8 @@ find_root() {
}
PROJECT_ROOT=$(find_root)
+# The coverage compose override mounts host paths through this variable.
+export PROJECT_ROOT
REPORT_DIR="$PROJECT_ROOT/testing/reports"
mkdir -p "$REPORT_DIR"
@@ -722,25 +724,22 @@ main() {
should_run_test "Webpage-Accessibility-lite" || \
should_run_test "Stirling-PDF-Ultra-Lite-Version-Check"; then
- gha_group "Build: Ultra-Lite (Gradle + Docker)"
+ gha_group "Build: Ultra-Lite image"
+ # No host Gradle build here: the Dockerfile compiles the backend and
+ # frontend in its build stage, .dockerignore keeps host build output
+ # out of the context, and the unit tests run in the backend matrix.
export DISABLE_ADDITIONAL_FEATURES=true
- if ! ./gradlew clean build -PnoSpotless; then
- echo "Gradle build failed with security disabled, exiting script."
- failed_tests+=("Build-Ultra-Lite-Gradle")
- capture_build_failure "Build-Ultra-Lite-Gradle"
- gha_endgroup
- exit 1
- fi
-
- # Get expected version after the build to ensure version.properties is created
echo "Getting expected version from Gradle..."
EXPECTED_VERSION=$(get_expected_version)
echo "Expected version: $EXPECTED_VERSION"
# Build Ultra-Lite image with embedded frontend (matching docker-compose-latest-ultra-lite.yml)
echo "Building ultra-lite image for tests that require it..."
+ # Read the cache the main-branch image publish writes, never write it
+ # back: exporting the build stage (mode=max) took 6-8 minutes per image
+ # here and the entries were evicted before the next PR could read them.
if [ -n "${ACTIONS_RUNTIME_TOKEN}" ] && { [ -n "${ACTIONS_RESULTS_URL}" ] || [ -n "${ACTIONS_CACHE_URL}" ]; }; then
- DOCKER_CACHE_ARGS_ULTRA_LITE="--cache-from type=gha,scope=stirling-pdf-ultra-lite --cache-to type=gha,mode=max,scope=stirling-pdf-ultra-lite"
+ DOCKER_CACHE_ARGS_ULTRA_LITE="--cache-from type=gha,scope=stirling-pdf-ultra-lite"
else
DOCKER_CACHE_ARGS_ULTRA_LITE=""
fi
@@ -809,16 +808,8 @@ main() {
should_run_test "Disabled-Endpoints" || \
should_run_test "Stirling-PDF-Fat-Disable-Endpoints-Version-Check"; then
- gha_group "Build: Fat + Security (Gradle + Docker)"
+ gha_group "Build: Fat + Security image"
export DISABLE_ADDITIONAL_FEATURES=false
- if ! ./gradlew clean build -PnoSpotless; then
- echo "Gradle build failed with security enabled, exiting script."
- failed_tests+=("Build-Fat-Gradle")
- capture_build_failure "Build-Fat-Gradle"
- gha_endgroup
- exit 1
- fi
-
echo "Getting expected version from Gradle (security enabled)..."
EXPECTED_VERSION=$(get_expected_version)
echo "Expected version with security enabled: $EXPECTED_VERSION"
@@ -826,7 +817,7 @@ main() {
# Build Fat (Security) image with embedded frontend (matching all 'fat' compose files)
echo "Building fat image for tests that require it..."
if [ -n "${ACTIONS_RUNTIME_TOKEN}" ] && { [ -n "${ACTIONS_RESULTS_URL}" ] || [ -n "${ACTIONS_CACHE_URL}" ]; }; then
- DOCKER_CACHE_ARGS_FAT="--cache-from type=gha,scope=stirling-pdf-fat --cache-to type=gha,mode=max,scope=stirling-pdf-fat"
+ DOCKER_CACHE_ARGS_FAT="--cache-from type=gha,scope=stirling-pdf-fat"
else
DOCKER_CACHE_ARGS_FAT=""
fi
@@ -898,6 +889,9 @@ main() {
echo "::warning::STIRLING_PDF_TEST_COVERAGE=1 but build/jacoco/jacocoagent.jar is missing - run ./gradlew copyJacocoAgent first"
else
mkdir -p "$PROJECT_ROOT/testing/cucumber-coverage"
+ # The JVM in the container runs as uid 1000 and dumps the .exec on
+ # shutdown; the runner user owns the directory.
+ chmod 777 "$PROJECT_ROOT/testing/cucumber-coverage"
rm -f "$PROJECT_ROOT/testing/cucumber-coverage/cucumber.exec"
COVERAGE_COMPOSE_FILE="$PROJECT_ROOT/testing/compose/docker-compose-coverage.override.yml"
echo "Cucumber JaCoCo coverage enabled - exec will land at testing/cucumber-coverage/cucumber.exec"