From 39d1c57be33b48474dab91548058dd59fe93f99f Mon Sep 17 00:00:00 2001 From: Jeffrey Girard Date: Tue, 1 Dec 2026 08:36:45 -0600 Subject: [PATCH 1/2] Keep test snapshots in the package built for R CMD check --- .github/workflows/R-CMD-check-hard.yaml | 11 +++++++++++ .github/workflows/R-CMD-check-main.yaml | 11 +++++++++++ .github/workflows/R-CMD-check-no-oldrel.yaml | 11 +++++++++++ .github/workflows/R-CMD-check.yaml | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index edf55fe..e2ab6f1 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -42,6 +42,17 @@ jobs: any::knitr any::rmarkdown + - name: Keep test snapshots in the built package + # testthat fails on CI when a snapshot is missing, and .Rbuildignore + # often leaves tests/testthat/_snaps out of the build. This changes + # only the CI checkout, not the package sent to CRAN. + shell: bash + run: | + if [ -f .Rbuildignore ]; then + sed -i.bak '/_snaps/d' .Rbuildignore + rm .Rbuildignore.bak + fi + - uses: r-lib/actions/check-r-package@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2 with: upload-snapshots: true diff --git a/.github/workflows/R-CMD-check-main.yaml b/.github/workflows/R-CMD-check-main.yaml index 1509221..cbb5900 100644 --- a/.github/workflows/R-CMD-check-main.yaml +++ b/.github/workflows/R-CMD-check-main.yaml @@ -47,6 +47,17 @@ jobs: ivprobit=?ignore-before-r=100.0.0 needs: check + - name: Keep test snapshots in the built package + # testthat fails on CI when a snapshot is missing, and .Rbuildignore + # often leaves tests/testthat/_snaps out of the build. This changes + # only the CI checkout, not the package sent to CRAN. + shell: bash + run: | + if [ -f .Rbuildignore ]; then + sed -i.bak '/_snaps/d' .Rbuildignore + rm .Rbuildignore.bak + fi + - uses: r-lib/actions/check-r-package@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2 with: upload-snapshots: true diff --git a/.github/workflows/R-CMD-check-no-oldrel.yaml b/.github/workflows/R-CMD-check-no-oldrel.yaml index 7711f10..9b41173 100644 --- a/.github/workflows/R-CMD-check-no-oldrel.yaml +++ b/.github/workflows/R-CMD-check-no-oldrel.yaml @@ -116,6 +116,17 @@ jobs: WRS2=?ignore-before-r=4.1.0 needs: check + - name: Keep test snapshots in the built package + # testthat fails on CI when a snapshot is missing, and .Rbuildignore + # often leaves tests/testthat/_snaps out of the build. This changes + # only the CI checkout, not the package sent to CRAN. + shell: bash + run: | + if [ -f .Rbuildignore ]; then + sed -i.bak '/_snaps/d' .Rbuildignore + rm .Rbuildignore.bak + fi + - uses: r-lib/actions/check-r-package@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2 with: upload-snapshots: true diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f344081..29d0793 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -123,6 +123,17 @@ jobs: WRS2=?ignore-before-r=4.1.0 needs: check + - name: Keep test snapshots in the built package + # testthat fails on CI when a snapshot is missing, and .Rbuildignore + # often leaves tests/testthat/_snaps out of the build. This changes + # only the CI checkout, not the package sent to CRAN. + shell: bash + run: | + if [ -f .Rbuildignore ]; then + sed -i.bak '/_snaps/d' .Rbuildignore + rm .Rbuildignore.bak + fi + - uses: r-lib/actions/check-r-package@f9a764fea8d5c63df6ef9a5c7795bf7deb5d7e05 # v2 with: upload-snapshots: true From ba99789b1db67a7a82157595ce83ae2b3898c002 Mon Sep 17 00:00:00 2001 From: Jeffrey Girard Date: Tue, 1 Dec 2026 13:17:16 -0600 Subject: [PATCH 2/2] Say testthat fails on missing snapshots by default --- .github/workflows/R-CMD-check-hard.yaml | 6 +++--- .github/workflows/R-CMD-check-main.yaml | 6 +++--- .github/workflows/R-CMD-check-no-oldrel.yaml | 6 +++--- .github/workflows/R-CMD-check.yaml | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index e2ab6f1..776c6f9 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -43,9 +43,9 @@ jobs: any::rmarkdown - name: Keep test snapshots in the built package - # testthat fails on CI when a snapshot is missing, and .Rbuildignore - # often leaves tests/testthat/_snaps out of the build. This changes - # only the CI checkout, not the package sent to CRAN. + # By default, testthat fails on CI when a snapshot is missing, and + # .Rbuildignore often leaves tests/testthat/_snaps out of the build. + # This changes only the CI checkout, not the package sent to CRAN. shell: bash run: | if [ -f .Rbuildignore ]; then diff --git a/.github/workflows/R-CMD-check-main.yaml b/.github/workflows/R-CMD-check-main.yaml index cbb5900..87c2f93 100644 --- a/.github/workflows/R-CMD-check-main.yaml +++ b/.github/workflows/R-CMD-check-main.yaml @@ -48,9 +48,9 @@ jobs: needs: check - name: Keep test snapshots in the built package - # testthat fails on CI when a snapshot is missing, and .Rbuildignore - # often leaves tests/testthat/_snaps out of the build. This changes - # only the CI checkout, not the package sent to CRAN. + # By default, testthat fails on CI when a snapshot is missing, and + # .Rbuildignore often leaves tests/testthat/_snaps out of the build. + # This changes only the CI checkout, not the package sent to CRAN. shell: bash run: | if [ -f .Rbuildignore ]; then diff --git a/.github/workflows/R-CMD-check-no-oldrel.yaml b/.github/workflows/R-CMD-check-no-oldrel.yaml index 9b41173..69c968b 100644 --- a/.github/workflows/R-CMD-check-no-oldrel.yaml +++ b/.github/workflows/R-CMD-check-no-oldrel.yaml @@ -117,9 +117,9 @@ jobs: needs: check - name: Keep test snapshots in the built package - # testthat fails on CI when a snapshot is missing, and .Rbuildignore - # often leaves tests/testthat/_snaps out of the build. This changes - # only the CI checkout, not the package sent to CRAN. + # By default, testthat fails on CI when a snapshot is missing, and + # .Rbuildignore often leaves tests/testthat/_snaps out of the build. + # This changes only the CI checkout, not the package sent to CRAN. shell: bash run: | if [ -f .Rbuildignore ]; then diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 29d0793..bb78700 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -124,9 +124,9 @@ jobs: needs: check - name: Keep test snapshots in the built package - # testthat fails on CI when a snapshot is missing, and .Rbuildignore - # often leaves tests/testthat/_snaps out of the build. This changes - # only the CI checkout, not the package sent to CRAN. + # By default, testthat fails on CI when a snapshot is missing, and + # .Rbuildignore often leaves tests/testthat/_snaps out of the build. + # This changes only the CI checkout, not the package sent to CRAN. shell: bash run: | if [ -f .Rbuildignore ]; then