generated from pharmaverse/admiraltemplate
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from pharmaverse/automated-renv-lock-propagat…
…ion@devel Propagate renv.lock from pharmaverse/admiralci
- Loading branch information
Showing
23 changed files
with
1,693 additions
and
866 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 |
---|---|---|
|
@@ -32,4 +32,5 @@ | |
^admiralvaccine\.Rcheck$ | ||
^admiralvaccine.*\.tar\.gz$ | ||
^admiralvaccine.*\.tgz$ | ||
^\.devcontainer$ | ||
^doc$ |
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,5 +1,47 @@ | ||
if (Sys.getenv("GITHUB_ACTIONS") == "" || (Sys.getenv("GITHUB_ACTIONS") == "true" && getRversion()$major == 3 && getRversion()$minor == 6)) { | ||
source("renv/activate.R") | ||
# Set renv profile base on R version. | ||
.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", "pharmaversesdtm", getwd()))] | ||
} | ||
|
||
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.") | ||
} | ||
} else { | ||
options(repos = c(CRAN = "https://cran.rstudio.com")) | ||
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://packagemanager.posit.co/cran/latest")) | ||
Sys.setenv("RENV_AUTOLOADER_ENABLED" = FALSE) | ||
} | ||
Sys.setenv("RENV_CONFIG_SANDBOX_ENABLED" = FALSE) | ||
Sys.setenv("RENV_CONFIG_AUTO_SNAPSHOT" = FALSE) | ||
source("renv/activate.R") |
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
// https://containers.dev/implementors/json_reference/ | ||
"name": "Admiral R-4.1 (RStudio) container", | ||
"image": "ghcr.io/pharmaverse/admiralci-4.1:latest", | ||
// Install Dev Container Features. More info: https://containers.dev/features | ||
"containerEnv": { | ||
"ROOT": "true", | ||
"PASSWORD": "rstudio", | ||
"DISABLE_AUTH": "true", | ||
"RENV_AUTOLOADER_ENABLED": "false" | ||
}, | ||
"features": { | ||
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": { | ||
"version": "none", | ||
"vscodeRSupport": "full", | ||
"installRadian": true, | ||
"installVscDebugger": true | ||
}, | ||
"ghcr.io/rocker-org/devcontainer-features/renv-cache:latest": {}, | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": false, | ||
"installOhMyZsh": true, | ||
"username": "rstudio", | ||
"upgradePackages": false | ||
}, | ||
"ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} | ||
}, | ||
"init": true, | ||
"overrideCommand": false, | ||
|
||
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", | ||
|
||
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"r.rterm.linux": "/usr/local/bin/radian", | ||
"r.bracketedPaste": true, | ||
"editor.bracketPairColorization.enabled": true, | ||
"editor.guides.bracketPairs": "active" | ||
}, | ||
"extensions": [ | ||
"vsls-contrib.codetour", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
// R extensions | ||
"ikuyadeu.r", | ||
"REditorSupport.r-lsp", | ||
// Extra extension | ||
"streetsidesoftware.code-spell-checker", | ||
"eamodio.gitlens", | ||
"cweijan.vscode-office", | ||
"donjayamanne.githistory", | ||
"GitHub.vscode-github-actions", | ||
"GitHub.vscode-pull-request-github", | ||
"GitHub.remotehub", | ||
"alefragnani.Bookmarks", | ||
"vscode-icons-team.vscode-icons" | ||
] | ||
} | ||
}, | ||
|
||
// RStudio ports | ||
"forwardPorts": [8787], | ||
"portsAttributes": { | ||
"8787": { | ||
"label": "Rstudio", | ||
"requireLocalPort": true, | ||
"onAutoForward": "openBrowser" | ||
} | ||
}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root | ||
"remoteUser": "rstudio" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
// https://containers.dev/implementors/json_reference/ | ||
"name": "Admiral R-4.2 (RStudio) container", | ||
"image": "ghcr.io/pharmaverse/admiralci-4.2:latest", | ||
// Install Dev Container Features. More info: https://containers.dev/features | ||
"containerEnv": { | ||
"ROOT": "true", | ||
"PASSWORD": "rstudio", | ||
"DISABLE_AUTH": "true", | ||
"RENV_AUTOLOADER_ENABLED": "false" | ||
}, | ||
"features": { | ||
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": { | ||
"version": "none", | ||
"vscodeRSupport": "full", | ||
"installRadian": true, | ||
"installVscDebugger": true | ||
}, | ||
"ghcr.io/rocker-org/devcontainer-features/renv-cache:latest": {}, | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": false, | ||
"installOhMyZsh": true, | ||
"username": "rstudio", | ||
"upgradePackages": false | ||
}, | ||
"ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} | ||
}, | ||
"init": true, | ||
"overrideCommand": false, | ||
|
||
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", | ||
|
||
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"r.rterm.linux": "/usr/local/bin/radian", | ||
"r.bracketedPaste": true, | ||
"editor.bracketPairColorization.enabled": true, | ||
"editor.guides.bracketPairs": "active" | ||
}, | ||
"extensions": [ | ||
"vsls-contrib.codetour", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
// R extensions | ||
"ikuyadeu.r", | ||
"REditorSupport.r-lsp", | ||
// Extra extension | ||
"streetsidesoftware.code-spell-checker", | ||
"eamodio.gitlens", | ||
"cweijan.vscode-office", | ||
"donjayamanne.githistory", | ||
"GitHub.vscode-github-actions", | ||
"GitHub.vscode-pull-request-github", | ||
"GitHub.remotehub", | ||
"alefragnani.Bookmarks", | ||
"vscode-icons-team.vscode-icons" | ||
] | ||
} | ||
}, | ||
|
||
// RStudio ports | ||
"forwardPorts": [8787], | ||
"portsAttributes": { | ||
"8787": { | ||
"label": "Rstudio", | ||
"requireLocalPort": true, | ||
"onAutoForward": "openBrowser" | ||
} | ||
}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root | ||
"remoteUser": "rstudio" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
// https://containers.dev/implementors/json_reference/ | ||
"name": "Admiral R-4.3 (RStudio) container", | ||
"image": "ghcr.io/pharmaverse/admiralci-4.3:latest", | ||
// Install Dev Container Features. More info: https://containers.dev/features | ||
"containerEnv": { | ||
"ROOT": "true", | ||
"PASSWORD": "rstudio", | ||
"DISABLE_AUTH": "true", | ||
"RENV_AUTOLOADER_ENABLED": "false" | ||
}, | ||
"features": { | ||
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": { | ||
"version": "none", | ||
"vscodeRSupport": "full", | ||
"installRadian": true, | ||
"installVscDebugger": true | ||
}, | ||
"ghcr.io/rocker-org/devcontainer-features/renv-cache:latest": {}, | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"configureZshAsDefaultShell": false, | ||
"installOhMyZsh": true, | ||
"username": "rstudio", | ||
"upgradePackages": false | ||
}, | ||
"ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} | ||
}, | ||
"init": true, | ||
"overrideCommand": false, | ||
|
||
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", | ||
|
||
"postAttachCommand": "$BROWSER \"https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/\"; echo 'To open rstudio in your browser, just type rstudio in the terminal'", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"r.rterm.linux": "/usr/local/bin/radian", | ||
"r.bracketedPaste": true, | ||
"editor.bracketPairColorization.enabled": true, | ||
"editor.guides.bracketPairs": "active" | ||
}, | ||
"extensions": [ | ||
"vsls-contrib.codetour", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
// R extensions | ||
"ikuyadeu.r", | ||
"REditorSupport.r-lsp", | ||
// Extra extension | ||
"streetsidesoftware.code-spell-checker", | ||
"eamodio.gitlens", | ||
"cweijan.vscode-office", | ||
"donjayamanne.githistory", | ||
"GitHub.vscode-github-actions", | ||
"GitHub.vscode-pull-request-github", | ||
"GitHub.remotehub", | ||
"alefragnani.Bookmarks", | ||
"vscode-icons-team.vscode-icons" | ||
] | ||
} | ||
}, | ||
|
||
// RStudio ports | ||
"forwardPorts": [8787], | ||
"portsAttributes": { | ||
"8787": { | ||
"label": "Rstudio", | ||
"requireLocalPort": true, | ||
"onAutoForward": "openBrowser" | ||
} | ||
}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root | ||
"remoteUser": "rstudio" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# move script rstudio into /usr/bin | ||
sudo cp "$(pwd)/.devcontainer/rstudio.sh" /usr/bin/rstudio | ||
sudo chmod +x /usr/bin/rstudio | ||
|
||
# Restore renv and install staged dependencies | ||
R -q -e 'renv::restore(lockfile = file.path("renv", "profiles", paste(R.version$major, substr(R.version$minor, 1, 1), sep = "."), "renv.lock")); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = ".", verbose = 1), verbose = 1);' | ||
|
||
# Define rstudio default working directory | ||
jq --arg folder "$(pwd)/" '. + { "initial_working_directory": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"save_workspace": "never", | ||
"always_save_history": false, | ||
"reuse_sessions_for_project_links": true, | ||
"posix_terminal_shell": "bash", | ||
"initial_working_directory": "/workspaces", | ||
"show_hidden_files": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
$BROWSER "https://${CODESPACE_NAME}-8787.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" | ||
|
||
exit 1 |
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
Oops, something went wrong.