Skip to content

New capability: check-extra (warnings-as-errors examples/tests/vignettes, random test order) #335

Description

@d-morrison

IndrajeetPatil/workflows/.github/workflows/check-extra.yaml (MIT) runs three R checks that nothing in this repo — or in rpt — currently does. They catch a class of bug R CMD check passes over.

1. Warnings as errors, across three surfaces

All under options(warn = 2L):

  • devtools::run_examples(fresh = TRUE, run_dontrun = TRUE, run_donttest = TRUE)
  • a testthat sweep
  • a vignette render loop over fs::dir_ls("vignettes/", glob = "*.Rmd", recurse = TRUE)

A deprecation warning from a dependency is the motivating case: it is invisible in a normal green check until the deprecation becomes an error a release later.

Note the workaround upstream needed, since reimplementing it from scratch would hit the same wall: parallel testthat does not honor a global warn option (testthat#1912), so it finds test scripts and calls testthat::test_file() per file inside withr::local_options(list(warn = 2L)).

2. Random test order

testthat::test_dir("tests", shuffle = TRUE) with a randomly drawn seed that is logged, so a failure is reproducible. It also sets TESTTHAT_PARALLEL = "FALSE" via withr::local_envvar, since shuffling is meaningless if tests run in parallel anyway.

This catches inter-test dependence — a test that only passes because an earlier one left state behind. That failure mode stays hidden indefinitely under a fixed order and then surfaces as a mysterious CI failure when someone adds or reorders a test.

3. README render check

Renders README.Rmd with warnings as errors. rpt has a bespoke check-readme.yaml doing the freshness half of this (re-render, fail if README.md changed), so this is partly covered there and worth reconciling rather than duplicating.

Design notes

  • Upstream's 6-line header comment explains the deliberate redundancy of installing R separately in each of the three jobs: parallel jobs give each check its own status badge and surface all failures at once instead of short-circuiting at the first. Worth preserving that rationale (and the comment) if the structure is copied.
  • Upstream's inline R uses purrr, withr, fs, cli, and pkgload without listing them in extra-packages — they arrive transitively via devtools. That is fragile; declare them explicitly.
  • The three checks are independent and could reasonably be three inputs on one workflow rather than one monolith.

Source: IndrajeetPatil/workflows, MIT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions