-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renv / codespaces update from pharmaverse/admiralci
- Loading branch information
1 parent
1ce3b80
commit a764028
Showing
11 changed files
with
118 additions
and
6,599 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
# Set renv profile base on R version. | ||
renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".") | ||
if (file.exists("./renv/profiles")) { | ||
message("Using renv profile from `renv/profile` file.") | ||
if (renv_profile %in% c("4.1", "4.2", "4.3")) { | ||
message("Set renv profile to `", renv_profile, "`") | ||
Sys.setenv("RENV_PROFILE" = renv_profile) | ||
.get_dependencies <- function(project_dir) { | ||
|
||
admdev_loc <- find.package("admiraldev", lib.loc = .libPaths(), quiet = TRUE) | ||
adm_dev_suggests <- if(length(admdev_loc) != 0) { | ||
renv:::renv_dependencies_discover_description(admdev_loc, fields = c("Depends", "Imports", "LinkingTo", "Suggests")) | ||
} else { | ||
data.frame(Packages = character(0)) | ||
} | ||
suggests_packages <- renv:::renv_dependencies_discover_description(project_dir, fields = "Suggests") | ||
|
||
packages <- names( | ||
renv:::renv_package_dependencies( | ||
unique(c( | ||
project_dir, | ||
adm_dev_suggests[["Package"]], | ||
suggests_packages[["Package"]], | ||
c("staged.dependencies", "renv", "styler") | ||
)) | ||
) | ||
) | ||
packages[!(packages %in% c("admiral", "admiraldev", "admiralci", "admiral.test"))] | ||
} | ||
|
||
options(renv.snapshot.filter = .get_dependencies) | ||
|
||
.renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".") | ||
if (!file.exists("./renv/profile")) { | ||
if (.renv_profile %in% c("4.1", "4.2", "4.3")) { | ||
message("Set renv profile to `", .renv_profile, "`") | ||
Sys.setenv("RENV_PROFILE" = .renv_profile) | ||
} else { | ||
message("This repository do not contains the renv profile for your R version.") | ||
message("This repository do not contains the renv profile for your R version.") | ||
} | ||
} else { | ||
message( | ||
"Using renv profile from `renv/profile` file.\n", | ||
"The `", readLines("./renv/profile"), "` profile will be used." | ||
) | ||
} | ||
|
||
if (Sys.getenv("GITHUB_ACTIONS") != "") { | ||
options(repos = c(CRAN = "https://cran.rstudio.com")) | ||
Sys.setenv(RENV_AUTOLOADER_ENABLED=FALSE) | ||
options(repos = c(CRAN = "https://packagemanager.posit.co/cran/latest")) | ||
Sys.setenv("RENV_AUTOLOADER_ENABLED" = FALSE) | ||
} | ||
source("renv/activate.R") | ||
Sys.setenv("RENV_CONFIG_SANDBOX_ENABLED" = FALSE) | ||
Sys.setenv("RENV_CONFIG_AUTO_SNAPSHOT" = FALSE) | ||
# source("renv/activate.R") |
Oops, something went wrong.