Skip to content

Keep test snapshots in the package R CMD check tests - #128

Merged
strengejacke merged 3 commits into
mainfrom
snapshots-in-ci-build
Dec 2, 2026
Merged

strengejacke merged 3 commits into
mainfrom
snapshots-in-ci-build

Conversation

@jmgirard

@jmgirard jmgirard commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closes #88.

Since testthat 3.3.0, a snapshot test with no saved snapshot fails on CI by default. Most of our packages have ^tests/testthat/_snaps/. in .Rbuildignore, so R CMD check tests the package without its snapshots and every snapshot test fails as new.

This adds a step before check-r-package in R-CMD-check.yaml, R-CMD-check-main.yaml, R-CMD-check-no-oldrel.yaml and R-CMD-check-hard.yaml. The step deletes the _snaps lines from .Rbuildignore, but only in the CI checkout, so the CRAN packages don't change.

I pointed performance's and modelbased's callers at this branch from test branches on my forks. Test failures went from 46 to 3–4 in performance and from about 245 to 17 in modelbased, and performance's R-CMD-check-hard passes:
https://github.com/jmgirard/performance/actions/runs/46670228145
https://github.com/jmgirard/performance/actions/runs/46670222439
https://github.com/jmgirard/modelbased/actions/runs/46670237171

The packages need to fix what's left. performance has one test with no saved snapshot (test-model_performance.rma.R:59), and a few modelbased snapshots, mostly in test-print.R, don't match now that they're actually compared. The other failures aren't about snapshots: mice 3.20.0, the Windows brms error that #126 fixes, and some that fail on main too.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two moderate active findings remain because the short R-CMD-check workflow lacks the snapshot-preparation step and can still fail missing-snapshot checks.

2 open issues
What changed in this PR

This PR updates reusable R CMD check workflows so test snapshots remain in the temporary package build used by CI, preventing missing-snapshot failures caused by .Rbuildignore.

Changes:

  • Removes .Rbuildignore entries containing _snaps in the CI checkout.
  • Applies the workaround before check-r-package in four R CMD check workflows.
  • Leaves repository and CRAN package source files unchanged.
  • The short R CMD check workflow remains without this workaround.
File Description
.github/​workflows/​R-CMD-check.yaml Keeps test snapshots in standard cross-platform R CMD checks by removing their .Rbuildignore exclusions in the CI checkout.
.github/​workflows/​R-CMD-check-no-oldrel.yaml Keeps test snapshots in R CMD checks without older R versions by removing their .Rbuildignore exclusions in the CI checkout.
.github/​workflows/​R-CMD-check-main.yaml Keeps test snapshots in main-branch R CMD checks by removing their .Rbuildignore exclusions in the CI checkout.
.github/​workflows/​R-CMD-check-hard.yaml Keeps test snapshots in hard-dependency R CMD checks by removing their .Rbuildignore exclusions in the CI checkout.

Review effort: Lite

Comment thread .github/workflows/R-CMD-check-main.yaml Resolved
Comment thread .github/workflows/R-CMD-check.yaml Resolved
@jmgirard

jmgirard commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

I left R-CMD-check-pr-short.yaml out on purpose: nothing calls it, not in easystats and not anywhere else GitHub's code search can find, and the README doesn't list it. #126 skips it for the same reason. If you'd rather keep it in step with the others, I can add the step there too.

@strengejacke

Copy link
Copy Markdown
Member

There are some merge conflicts.

# Conflicts:
#	.github/workflows/R-CMD-check-main.yaml
#	.github/workflows/R-CMD-check-no-oldrel.yaml
#	.github/workflows/R-CMD-check.yaml
@jmgirard

jmgirard commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Fixed. I merged main in. #126 had added its rstan step at the same spot, so the snapshot step now comes right after it, just before check-r-package.

@strengejacke
strengejacke merged commit 81a27c7 into main Dec 2, 2026
3 checks passed
@strengejacke
strengejacke deleted the snapshots-in-ci-build branch December 2, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange failures

3 participants