I am having a problem installing packages from Github when using Github Actions, and the resulting failure of R CMD check on Github, even for a package which works fine locally. I built a simple package which reproduces the problem. Overview:
- In the DESCRIPTION we have:
Remotes:
tidyverse/readr
My actual problem is with one of my own Github packages, but I wanted to use a high quality Github package for the example.
- My
tests/testthat/test-ex.R
file looks like:
library(readr)
expect_equal(my_function("2"),
"2")
my_function()
just returns the input. The whole packages passes R CMD check locally with no NOTES/WARNINGS/ERRORS.
- The package was created with all the (wonderful!) usethis tools, including
usethis::use_github_actions()
. But when the R CMD check runs, via Github Actions, on Github, we see this error:
* checking for unstated dependencies in βtestsβ ... WARNING
Warning: 'library' or 'require' call not declared from: βreadrβ
* checking tests ...
Running βtestthat.Rβ
ERROR
Running the tests in βtests/testthat.Rβ failed.
Last 13 lines of output:
>
> test_check("testing")
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
ββ Failed tests ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ Error ('test-ex.R:1'): (code run outside of `test_that()`) ββββββββββββββββββ
<packageNotFoundError/error/condition>
Error in `library(readr)`: there is no package called 'readr'
Backtrace:
β
1. ββbase::library(readr) at test-ex.R:1:0
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
Error: Test failures
Execution halted
It is as if tidyverse/readr
is never installed, despite its placement in the DESCRIPTION file. This is consistent with what I see in the log file:
Install/update packages
βΉ Installing lockfile '.github/pkg.lock'
β Will install 38 packages.
β Will download 37 CRAN packages (10.03 MB).
β Will download 1 package with unknown size.
I think that the "1 package with unknow size" refers to tidyverse/readr
but I don't see any evidence that it is is ever downloaded or installed.
Any ideas much appreciated!