name: Engine v3 Conformance # Boots @cloudpdf/server in-process and runs the metadata conformance suite # against both engine-local (WASM) and the cloud engine (HTTP -> native PDFium). # Any divergence between the two implementations fails the job. # Runs from ci.yml when engine, server, viewer or stamp sources changed (the # umbrella owns the path decision and builds the runtime once for every job # that needs it), or by hand — a manual run builds its own runtime. on: workflow_call: inputs: runtime_artifacts: description: 'The caller uploaded engine-runtime-* artifacts in this run' required: false type: boolean default: true workflow_dispatch: {} permissions: contents: read concurrency: group: engine-conformance-${{ github.ref }} cancel-in-progress: true env: CI: true jobs: # Only a manual run builds here; under ci.yml the artifacts already exist. build-runtime: if: ${{ !inputs.runtime_artifacts }} uses: ./.github/workflows/build-engine-runtime.yml secrets: inherit conformance: name: local + cloud parity needs: build-runtime # A skipped build (artifacts from the caller) must not skip us. if: ${{ !cancelled() && needs.build-runtime.result != 'failure' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download engine-runtime artifacts (linux-x64 + wasm32) uses: actions/download-artifact@v7 with: pattern: engine-runtime-* path: packages/engine/runtime/_artifacts - name: Stage runtime payloads shell: bash run: | shopt -s nullglob for dir in packages/engine/runtime/_artifacts/engine-runtime-*; do target="${dir##*/engine-runtime-}" mkdir -p "packages/engine/runtime/npm/$target" cp -R "$dir/." "packages/engine/runtime/npm/$target/" done rm -rf packages/engine/runtime/_artifacts - name: Build engine packages run: | pnpm --filter @embedpdf/engine-runtime build pnpm --filter @embedpdf/engine-core build pnpm --filter @embedpdf/core-fonts build pnpm --filter @embedpdf/default-fallback-fonts build pnpm --filter @embedpdf/engine-services build pnpm --filter @embedpdf/engine build pnpm --filter @cloudpdf/contract build pnpm --filter @cloudpdf/server build pnpm --filter @cloudpdf/engine build # Output size and WASM memory of redacting scanned pages: the same on # every run of a build, so they are checked; times are only reported. - name: Redaction on scans budgets (WASM) run: pnpm --filter @embedpdf/engine-runtime test:redaction-perf - name: engine-local conformance (WASM) run: pnpm --filter @embedpdf/engine test - name: cloud engine conformance (HTTP -> @cloudpdf/server, native) run: pnpm --filter @cloudpdf/engine test - name: CloudPDF license security run: pnpm --filter @cloudpdf/server exec vitest run test/licensing.test.ts - name: Engine v3 parity demo (local vs cloud) run: pnpm --filter @embedpdf/example-engine-runtime-demo run engine:node # The built viewer in a browser. packages.yml runs the same suite through turbo # for every change in the viewer's build graph (its plugins, core, and the React # and web adapters included), with the runner's Chrome. snippet: name: the viewer in a browser needs: build-runtime if: ${{ !cancelled() && needs.build-runtime.result != 'failure' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v5 - uses: actions/setup-node@v6 with: node-version: 22 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download engine-runtime artifact (wasm32) uses: actions/download-artifact@v7 with: name: engine-runtime-wasm32 path: packages/engine/runtime/npm/wasm32 - name: Install a browser for Playwright run: pnpm --filter @embedpdf/viewer exec playwright-core install --with-deps chromium - name: Build the viewer and everything it bundles id: build run: pnpm turbo run build --filter=@embedpdf/viewer # Every test under packages/viewer/main/test, the browser ones against # dist: snippet-cross-origin (dist/embedpdf.js imported from another # origin renders and fetches nothing from anywhere else), strict-csp (no # violation of the published policy, same-origin and from a CDN), # hostile-host (host page CSS changes no pixel) and theming. They run # after a failed build too: it writes dist before its declaration step, # so a declaration error doesn't hide their results (the job still fails). - name: Viewer tests in a browser if: ${{ !cancelled() && steps.build.outcome != 'skipped' }} run: pnpm --filter @embedpdf/viewer test