Run the pure R tests on CRAN and check that configuration in CI - #1288
Merged
Merged
Conversation
tests/testthat.R skipped the whole suite unless NOT_CRAN was set. Six files need no CmdStan at all (the build record, stan_build_info(), JSON writing, print_stan_file() and the stanc option handling), and four more are pure apart from a few tests, so CRAN can run those. The runner now always calls test_check(), every file that needs CmdStan starts with skip_on_cran(), and the six CmdStan tests inside the mixed files skip themselves. On CRAN that is 441 tests in about five seconds. The make mock is no help here: it stands in for make and the executable's info call, but stanc still runs for real. A new workflow, "CRAN check", runs R CMD check --as-cran on ubuntu-latest with NOT_CRAN unset and no CmdStan installed, so a test that forgets its skip fails on the PR instead of on CRAN. The same configuration passes locally with the home directory and the CMDSTAN variable pointed away from the local installation: 0 failures, 55 skips, no warnings. That check's new-submission NOTE also listed three bookdown.org links in register_knitr_engine()'s help page that now redirect to pkg.yihui.org; they point at the new pages, in the vignette too. Part of #1059.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v1.0 #1288 +/- ##
=======================================
Coverage ? 93.11%
=======================================
Files ? 19
Lines ? 7316
Branches ? 0
=======================================
Hits ? 6812
Misses ? 504
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
r-lib/actions/setup-r exports NOT_CRAN=true, so the first run of the workflow evaluated the vignettes and failed when the internals vignette asked for a CmdStan path. CRAN leaves the variable unset, so the check step now sets it to false, which the vignettes' EVAL parameter and skip_on_cran() both read as "on CRAN". Checked locally with rcmdcheck building the vignettes and no CmdStan visible: 0 errors, 0 warnings. Building the vignettes also surfaced two URLs the earlier check did not reach: the qs2 repository moved to qsbase/qs2, and the CRAN policies link loses its anchor, which R's URL check treats as a non-canonical CRAN URL. Part of #1059.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submission Checklist
Summary
I asked Claude to generate this summary:
tests/testthat.Rskipped the whole suite unlessNOT_CRANwas set. Sixtest files need no CmdStan at all and four more are pure apart from a few
tests, so this PR lets CRAN run them:
tests/testthat.Ralways callstest_check().skip_on_cran(), which skipsthe rest of the file (41 files). The six CmdStan tests inside the four
mixed files (
test-build-info.R,test-cpp-options.R,test-example.R,test-knitr.R) skip themselves.R CMD check --as-cranonubuntu-latest with
NOT_CRANunset and no CmdStan installed, so a testthat forgets its skip fails here instead of on CRAN.
On CRAN this is 441 tests in about five seconds. The make mock does not
help here: it stands in for
makeand the executable'sinfocall, butstanc still runs for real, so every mocked compile still needs an
installation. The same configuration passes locally with the home
directory and
CMDSTANpointed away from the local install: 0 failures,55 skips, 0 warnings, and the check itself reports only the usual
new-submission NOTE.
Vignettes and examples were already CRAN-safe (every vignette evaluates
only under
NOT_CRAN, every example is in\dontrun{}), so nothingchanges there.
That check's new-submission NOTE also listed three bookdown.org links in
register_knitr_engine()'s help page that now redirect to pkg.yihui.org.They point at the new pages now, in the R Markdown vignette too.
Part of #1059.
Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Jonah Gabry
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: