diff --git a/.github/workflows/cran-check.yaml b/.github/workflows/cran-check.yaml deleted file mode 100644 index f4f6877..0000000 --- a/.github/workflows/cran-check.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# cran-check.yaml — weekly rhub-based check on CRAN's platforms. -# -# pdfium is not released to CRAN, but it is held to CRAN's quality bar -# (ADR-008, ADR-026). This job catches issues that only CRAN-style -# platforms show (compiler matrices, valgrind notes, sanitizer -# findings). Runs on schedule plus manual dispatch. - -name: cran-check - -on: - schedule: - - cron: '17 4 * * 1' - workflow_dispatch: - -permissions: - contents: read - -jobs: - rhub: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v7 - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::rhub, any::rcmdcheck - - name: rhub check - run: | - res <- rhub::check_for_cran(show_status = TRUE) - status <- res$cran_summary() - cat("rhub summary:\n", paste(status, collapse = "\n"), "\n") - shell: Rscript {0} diff --git a/.github/workflows/rhub.yaml b/.github/workflows/rhub.yaml new file mode 100644 index 0000000..01f029b --- /dev/null +++ b/.github/workflows/rhub.yaml @@ -0,0 +1,113 @@ +# R-hub's generic GitHub Actions workflow file. It's canonical location is at +# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml +# You can update this file to a newer version using the rhub2 package: +# +# rhub::rhub_setup() +# +# pdfium's changes to the canonical file; keep them when updating it: +# - a weekly schedule that checks the CRAN-flavour platforms in +# RHUB_WEEKLY_PLATFORMS (ADR-030). pdfium is not released to CRAN but +# is held to CRAN's quality bar (ADR-026); +# - a manual run with an empty `config` uses the same platforms; +# - `permissions: contents: read`, like the other workflows here. + +name: R-hub +run-name: >- + ${{ github.event.inputs.id || (github.event_name == 'schedule' && 'Weekly CRAN-flavour check') || format('Manual run by @{0}', github.triggering_actor) }}: + ${{ github.event.inputs.name || github.event.inputs.config || 'weekly platforms' }} + +on: + schedule: + - cron: '17 4 * * 1' + workflow_dispatch: + inputs: + config: + description: >- + Comma-separated list of R-hub platforms to use. Leave empty for + the weekly CRAN-flavour set. + Full list: https://r-hub.github.io/containers/ + type: string + default: '' + name: + description: 'Run name. You can leave this empty.' + type: string + id: + description: 'Unique ID. You can leave this empty.' + type: string + +permissions: + contents: read + +env: + RHUB_WEEKLY_PLATFORMS: 'windows,macos-arm64,gcc-asan,clang-asan,rchk,nosuggests' + +jobs: + + setup: + runs-on: ubuntu-latest + outputs: + containers: ${{ steps.rhub-setup.outputs.containers }} + platforms: ${{ steps.rhub-setup.outputs.platforms }} + + steps: + # NO NEED TO CHECKOUT HERE + - uses: r-hub/actions/setup@v1 + with: + config: ${{ github.event.inputs.config || env.RHUB_WEEKLY_PLATFORMS }} + id: rhub-setup + + linux-containers: + needs: setup + if: ${{ needs.setup.outputs.containers != '[]' }} + runs-on: ubuntu-latest + name: ${{ matrix.config.label }} + strategy: + fail-fast: false + matrix: + config: ${{ fromJson(needs.setup.outputs.containers) }} + container: + image: ${{ matrix.config.container }} + + steps: + - uses: r-hub/actions/checkout@v1 + - uses: r-hub/actions/platform-info@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/setup-deps@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/run-check@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + + other-platforms: + needs: setup + if: ${{ needs.setup.outputs.platforms != '[]' }} + runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.label }} + strategy: + fail-fast: false + matrix: + config: ${{ fromJson(needs.setup.outputs.platforms) }} + + steps: + - uses: r-hub/actions/checkout@v1 + - uses: r-hub/actions/setup-r@v1 + with: + job-config: ${{ matrix.config.job-config }} + token: ${{ secrets.RHUB_TOKEN }} + - uses: r-hub/actions/platform-info@v1 + with: + token: ${{ secrets.RHUB_TOKEN }} + job-config: ${{ matrix.config.job-config }} + - uses: r-hub/actions/setup-deps@v1 + with: + job-config: ${{ matrix.config.job-config }} + token: ${{ secrets.RHUB_TOKEN }} + - uses: r-hub/actions/run-check@v1 + with: + job-config: ${{ matrix.config.job-config }} + token: ${{ secrets.RHUB_TOKEN }} diff --git a/dev/architecture.md b/dev/architecture.md index 9daed4b..2004061 100644 --- a/dev/architecture.md +++ b/dev/architecture.md @@ -154,7 +154,9 @@ fixture or pin a font in the build script. See [ADR-007](decisions/ADR-007-ci-and-coverage.md). Eight workflows; four are gates (`R-CMD-check`, `coverage`, `lint`, `pre-commit`). -`valgrind` and `cran-check` run weekly. `cpp-asan` is advisory. +`valgrind` runs weekly and on pull requests that touch code, and +`rhub` runs R-hub's CRAN-flavour platforms weekly (ADR-030). +`cpp-asan` is advisory. `pkgdown` only deploys on tag pushes. ## Where decisions live diff --git a/dev/decisions/ADR-030-rhub-v2-cran-flavour-checks.md b/dev/decisions/ADR-030-rhub-v2-cran-flavour-checks.md new file mode 100644 index 0000000..2787e84 --- /dev/null +++ b/dev/decisions/ADR-030-rhub-v2-cran-flavour-checks.md @@ -0,0 +1,119 @@ +# ADR-030 — Weekly CRAN-flavour checks with rhub v2 + +- Status: Supersedes ADR-007's `cran-check.yaml` row (weekly `rhub::check_for_cran()`) +- Date: 2026-09-27 +- Deciders: Bill Denney + +## Context + +ADR-007 made a weekly `rhub::check_for_cran()` run, in +`.github/workflows/cran-check.yaml`, the check against CRAN's platforms. +rhub v2 made that function defunct. Every scheduled run failed with +"This function is deprecated and defunct since rhub v2" and then +"attempt to apply non-function": 19 of 19 runs up to 2026-09-21. The +job never checked anything. + +`pdfium` is not released to CRAN (ADR-026) but keeps CRAN's quality +bar. CRAN checks packages on more than its main platforms: it also runs +sanitizer builds, rchk and a check without suggested packages. + +rhub v2 runs these checks as a GitHub Actions workflow in the package's +own repository (`r-hub/actions`). It uses R-hub's containers for CRAN's +extra check flavours and GitHub's Windows and macOS runners for the +rest. + +Our other CI already covers the following: + +- `R-CMD-check.yaml` runs `--as-cran` and fails on warnings, on macOS + arm64 R-release, Windows R-release, and Ubuntu R-devel, R-release and + R-oldrel. +- `valgrind.yaml` gates leaks weekly and on pull requests that touch + code. +- `cpp-asan.yaml` is advisory. + +## Decision + +1. **Replace `cran-check.yaml`** with R-hub's canonical + `.github/workflows/rhub.yaml`, changed in three ways: + - a weekly schedule, Mondays 04:17 UTC (the old job's slot); + - `RHUB_WEEKLY_PLATFORMS`, the platform set used by scheduled runs + and by manual runs whose `config` is empty; + - `permissions: contents: read`. + + The file's header lists these changes, because `rhub::rhub_setup()` + would overwrite them. + +2. **The weekly platforms:** + + | Platform | CRAN check flavour | Why | + |---|---|---| + | `windows` | r-devel-windows-x86_64 | Our CI checks Windows on R-release only. | + | `macos-arm64` | macOS arm64, R-devel | Our CI checks macOS on R-release only. | + | `gcc-asan` | gcc-ASAN, gcc-UBSAN | R and the package built with gcc's AddressSanitizer and UBSan. Our own ASan job is advisory. | + | `clang-asan` | clang-ASAN | clang's sanitizers, with CRAN's `ASAN_OPTIONS`. | + | `rchk` | rchk | PROTECT bugs in our C++ glue around R objects. | + | `nosuggests` | noSuggests | Tests and examples must run without suggested packages. | + +3. **Other platforms are not in the weekly set.** + - `valgrind`: `valgrind.yaml` already covers it. + - `linux`, `ubuntu-release`, `ubuntu-gcc12`: `R-CMD-check.yaml` + covers Ubuntu. + - The per-compiler containers (`clang16`–`clang22`, `gcc13`–`gcc16`), + `lto`, `intel`, `atlas`, `mkl`, `nold`, `noremap`, `c23`, + `donttest` and `vnu` test concerns this package lacks: it has no C + or Fortran code, no BLAS use and no `\donttest` examples. They + remain available for manual runs. + +4. **What fails the job.** R-hub's `run-check` action: + - runs `R CMD check --as-cran` through + `r-lib/actions/check-r-package`, which fails on any WARNING or + ERROR; + - on the sanitizer platforms, also fails on any UBSan + `runtime error:`; + - on `rchk`, fails on any `bcheck` error outside R-hub's short list + of ignored messages. + +## Consequences + +- Six CRAN check flavours run every week, on free runner time for a + public repository. +- The weekly set was checked locally in R-hub's containers on + 2026-09-27, against the code of `origin/main` at `b58fd55`: + - `gcc-asan`: 0 test failures, no sanitizer reports, NOTEs only. + - `clang-asan`: the same. + - `rchk`: no errors after R-hub's filter. + - `nosuggests`: an ERROR. The `pdf_image_extract()` example needs + `png`, a suggested package, and does not check for it. That is the + kind of issue this ADR is for, and the job stays red until the + example is fixed. + - `windows` and `macos-arm64` were not run locally. The first + scheduled or manual run checks them. +- Every `--as-cran` run reports the "New submission" NOTE, because the + package is not on CRAN. NOTEs do not fail the job. +- Ad hoc runs: use "Run workflow" on the Actions page (an empty + `config` gives the weekly set) or `rhub::rhub_check()` from R. The + latter needs a GitHub personal access token in the git credential + store; `rhub::rhub_doctor()` checks the setup. +- `rhub::rhub_setup()` rewrites the file. Re-apply the three changes + listed in its header after updating it. + +## Alternatives considered + +- **Keep `rhub::check_for_cran()`.** It is defunct. +- **Drop the weekly job and rely on `R-CMD-check.yaml` and r-universe.** + Rejected: neither runs sanitizers, rchk or a no-Suggests check, and + r-universe's check is not `--as-cran`. +- **Run these containers on every pull request.** Deferred. The + sanitizer and rchk jobs are the slowest, and a weekly run is enough + to catch regressions before a release. Revisit if a regression slips + through between weekly runs. +- **Include `valgrind`.** It would duplicate `valgrind.yaml`, which + already has a leak policy tuned to PDFium's known mismatched frees. + +## References + +- ADR-007 (CI and coverage), ADR-026 (no CRAN release; CRAN-quality + bar) +- [R-hub v2 actions](https://github.com/r-hub/actions) and + [containers](https://r-hub.github.io/containers/) +- CRAN's additional check flavours: diff --git a/dev/decisions/README.md b/dev/decisions/README.md index 5624204..dc9a5ed 100644 --- a/dev/decisions/README.md +++ b/dev/decisions/README.md @@ -14,7 +14,7 @@ Markdown ADR following the | [004](ADR-004-api-style.md) | Accepted | API style: snake_case `pdf_*`, S3 classes, tibble outputs | | [005](ADR-005-memory-model.md) | Accepted | Memory model: `externalptr` + finalizers + idempotent explicit close | | [006](ADR-006-pdfium-pin.md) | Accepted | PDFium version pinning policy | -| [007](ADR-007-ci-and-coverage.md) | Accepted | CI: GitHub Actions matrix, 100% R coverage gate, valgrind, ASan | +| [007](ADR-007-ci-and-coverage.md) | Accepted (`cran-check.yaml` row superseded by ADR-030) | CI: GitHub Actions matrix, 100% R coverage gate, valgrind, ASan | | [008](ADR-008-cran-targeting.md) | Accepted (release targeting superseded by ADR-026; quality constraints in force) | CRAN-from-v0.1.0 hardening | | [009](ADR-009-defer-bezier-controls.md) | Superseded by ADR-021 | Defer Bezier control points to a post-0.1.0 release (no public PDFium API) | | [010](ADR-010-checkmate-for-argument-validation.md) | Accepted | Use `checkmate` for argument validation throughout the package | @@ -36,6 +36,7 @@ Markdown ADR following the | [026](ADR-026-no-cran-release.md) | Supersedes ADR-008's release targeting and ADR-003's CRAN-submission wording | No CRAN release: keep ADR-008's CRAN-quality bar, ship binaries through r-universe and source through GitHub | | [028](ADR-028-library-destroy-closes-every-handle.md) | Accepted (extends ADR-025) | Destroying the library closes every handle first: documents, standalone clip paths, bitmaps and memory-document buffers are registered under the library and released before `FPDF_DestroyLibrary`; every finalizer is attached in one place | | [029](ADR-029-handles-follow-their-owners.md) | Accepted (extends ADR-020 §4 and ADR-025) | A handle is refused once any of its owners is closed: clip paths pin their page-object and nested objects their form, and `validate_handle()` and `is_open()` walk the whole ownership chain | +| [030](ADR-030-rhub-v2-cran-flavour-checks.md) | Supersedes ADR-007's `cran-check.yaml` row | Weekly CRAN-flavour checks with rhub v2 (`rhub.yaml`): windows and macos-arm64 on R-devel, gcc-asan, clang-asan, rchk, nosuggests; replaces the defunct `rhub::check_for_cran()` job | ## Policy