name: PDF/A Validation (veraPDF) # Runs the veraPDF reference validator against a corpus of PDF/A-claiming # documents produced by the CLI itself (scripts/generate-pdfa-corpus.ts → # test-output/pdfa/), covering a representative sample of the PDF/A-relevant # features the CLI exposes. Each file is validated against the profile it # claims in XMP and compared with the manifest's `expectCompliant` flag; the # corpus includes negative canaries that veraPDF MUST reject (an unexpected # pass — XPASS — is fatal), so a validator that accepts everything fails the # run instead of turning it green. The same corpus carries the PDF/X-4 files # that `validate:pdfx` checks inside the CI gate (veraPDF does not cover # PDF/X). # # Status: BLOCKING in pdfnative-cli as of v1.4.0 (precedent: pdfnative made # its gate blocking in v1.1.0+). The validate step has no `continue-on-error`, # so any deviation from the manifest expectations fails the workflow. # Exit codes of scripts/validate-pdfa.ts: # 0 all expectations met · 1 conformance FAIL / XPASS / coverage canary · # 2 INFRA (no corpus, veraPDF unusable or produced no report — not a verdict). # # NOTE on `paths:` filters vs. required checks: this workflow only triggers # when the listed paths change. GitHub reports a path-filtered workflow that # did not run as "Expected — Waiting for status" on a PR, which BLOCKS merging # forever if the check is marked "required" in branch protection. This job is # therefore NOT in .github/rulesets/main.json; the publish gate re-runs it # with --require-all before any release. # # veraPDF is an external CI tool (a Java CLI installed on the runner). It is # not a dependency of pdfnative-cli: the package keeps its zero-runtime- # dependency policy (`pdfnative` is the only runtime dependency), and the # validator is never bundled or linked. The pinned release, its checksum and # the install steps live in the composite action .github/actions/setup-verapdf, # shared with publish.yml, so the URL/SHA-256 bump happens in one place. on: push: branches: [main, master] paths: - 'src/**' - 'samples/**' - 'scripts/**' - 'tests/fixtures/**' - 'package.json' - 'package-lock.json' - 'tsup.config.ts' - 'tsconfig.json' - '.github/workflows/verapdf.yml' - '.github/actions/setup-verapdf/**' - '.github/checksums/**' pull_request: branches: [main, master] paths: - 'src/**' - 'samples/**' - 'scripts/**' - 'tests/fixtures/**' - 'package.json' - 'package-lock.json' - 'tsup.config.ts' - 'tsconfig.json' - '.github/workflows/verapdf.yml' - '.github/actions/setup-verapdf/**' - '.github/checksums/**' # Manual runs against any branch from the Actions UI. workflow_dispatch: permissions: contents: read concurrency: group: verapdf-${{ github.ref }} cancel-in-progress: true jobs: verapdf: runs-on: ubuntu-latest timeout-minutes: 20 env: VERAPDF_REPORT_DIR: test-output/pdfa/reports steps: - name: Harden the runner uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 with: egress-policy: audit # 2026-10-31: veraPDF and Adoptium download hosts are not baselined yet - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Node.js uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: .nvmrc cache: npm # Pinned veraPDF release (greenfield), checksummed, so CI and the # documented local setup validate against the same validator version — # a floating "latest" URL can silently change the rule set between two # runs of the same commit. Bump deliberately in the action's default. - name: Setup veraPDF id: verapdf uses: ./.github/actions/setup-verapdf - name: Install dependencies run: npm ci --ignore-scripts - name: Build run: npm run build - name: Generate the conformance corpus run: npm run corpus:pdfa # BLOCKING (see header). The exit code drives the step outcome — the # step fails naturally on a non-zero exit — and the summary step below # surfaces the verdict. - name: Validate PDF/A corpus (blocking) id: validate env: VERAPDF_HOME: ${{ steps.verapdf.outputs.home }} run: | set +e npm run validate:pdfa --silent -- --verbose 2> >(tee verapdf-stderr.txt >&2) | tee verapdf-report.txt code=${PIPESTATUS[0]} echo "exit_code=${code}" >> "$GITHUB_OUTPUT" exit "${code}" # Raw per-file veraPDF XML (+ stderr when non-empty) lives under # test-output/pdfa/reports/ — upload it so a FAIL / INFRA line can be # diagnosed without re-running the job. - name: Upload veraPDF report if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: verapdf-report path: | verapdf-report.txt verapdf-stderr.txt test-output/pdfa/manifest.json test-output/pdfa/reports/ if-no-files-found: warn retention-days: 14 - name: Job summary if: always() run: | code='${{ steps.validate.outputs.exit_code }}' case "${code}" in 0) verdict='all expectations met' ;; 1) verdict='CONFORMANCE failure (FAIL, XPASS or coverage canary — see report)' ;; 2) verdict='INFRA failure — no corpus, veraPDF unusable or no report (NOT a conformance verdict)' ;; *) verdict="unknown (exit ${code:-n/a})" ;; esac { echo "## PDF/A validation (veraPDF, blocking)" echo echo "Step outcome: ${{ steps.validate.outcome }} · exit ${code:-n/a} · ${verdict}" echo echo '```' cat verapdf-report.txt 2>/dev/null || echo "(no report produced)" echo '```' if [ -s verapdf-stderr.txt ]; then echo echo '
validator stderr' echo echo '```' cat verapdf-stderr.txt echo '```' echo '
' fi } >> "$GITHUB_STEP_SUMMARY"