Skip to content

Commit 2355f22

Browse files
authored
Fail early when renv packages are not synchronized after restore in CI (#14424)
When renv::restore() encounters network errors (e.g. package manager returning HTTP errors), it can complete without failing even though some packages were not properly installed. Downstream steps then fail with cryptic errors like missing package functions. Add renv::status() after restore and exit with status 1 if the library is not synchronized with the lockfile, surfacing the failure at the right point rather than later in the test run.
1 parent b8468bf commit 2355f22

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/test-smokes.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ jobs:
175175
cat("::group::Restoring R packages from renv.lock\n")
176176
renv::restore()
177177
cat("::endgroup::\n")
178+
cat("::group::Verifying R packages are synchronized after restore\n")
179+
status <- renv::status()
180+
if (!isTRUE(status$synchronized)) {
181+
cat("::error::R packages are not synchronized after restore - some packages may have failed to install\n")
182+
quit(status = 1)
183+
}
184+
cat("::endgroup::\n")
178185
cat("::group::Installing dev versions of knitr and rmarkdown\n")
179186
# Install dev versions for our testing
180187
# Use r-universe to avoid github api calls

0 commit comments

Comments
 (0)