diff --git a/.Rprofile b/.Rprofile index 63eee448..77ae067e 100644 --- a/.Rprofile +++ b/.Rprofile @@ -1,16 +1,15 @@ # Set renv profile base on R version. -renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".") -if (file.exists("./renv/profile")) { - message("Using renv profile from `renv/profile` file.") -} else if (renv_profile %in% c("4.1", "4.2", "4.3")) { - message("Set renv profile to `", renv_profile, "`") - Sys.setenv("RENV_PROFILE" = renv_profile) +if ((Sys.getenv("GITHUB_ACTIONS") == "") && (Sys.getenv("DOCKER_CONTAINER_CONTEXT") == "")) { + renv_profile <- paste(R.version$major, substr(R.version$minor, 1, 1), sep = ".") + if (file.exists("./renv/profile")) { + message("Using renv profile from `renv/profile` file.") + } else 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.") + } + source("renv/activate.R") } else { - message("This repository do not contains the renv profile for your R version.") -} - -if ((Sys.getenv("GITHUB_ACTIONS") != "") || (Sys.getenv("DOCKER_CONTAINER_CONTEXT") != "")) { options(repos = c(CRAN = "https://cran.rstudio.com")) - Sys.setenv(RENV_AUTOLOADER_ENABLED=FALSE) } -source("renv/activate.R") diff --git a/.devcontainer/4.1/devcontainer.json b/.devcontainer/4.1/devcontainer.json new file mode 100644 index 00000000..a0415f8b --- /dev/null +++ b/.devcontainer/4.1/devcontainer.json @@ -0,0 +1,77 @@ +{ + // 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" + }, + "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": true, + "installOhMyZsh": true, + "username": "rstudio", + "upgradePackages": false + + }, + "ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} + }, + "init": true, + "overrideCommand": false, + + "postCreateCommand": { + "renv": "R -q -e 'renv::activate(profile = \"4.1\"); renv::restore(); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = \".\", verbose = 1), verbose = 1);'", + "rstudio": "jq --arg folder \"$(pwd)/\" '. + { \"initial_working_directory\": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json" + }, + + "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": "ignore" + } + }, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root + "remoteUser": "rstudio" +} diff --git a/.devcontainer/4.2/devcontainer.json b/.devcontainer/4.2/devcontainer.json new file mode 100644 index 00000000..493aba1a --- /dev/null +++ b/.devcontainer/4.2/devcontainer.json @@ -0,0 +1,77 @@ +{ + // 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" + }, + "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": true, + "installOhMyZsh": true, + "username": "rstudio", + "upgradePackages": false + + }, + "ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} + }, + "init": true, + "overrideCommand": false, + + "postCreateCommand": { + "renv": "R -q -e 'renv::activate(profile = \"4.2\"); renv::restore(); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = \".\", verbose = 1), verbose = 1);'", + "rstudio": "jq --arg folder \"$(pwd)/\" '. + { \"initial_working_directory\": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json" + }, + + "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": "ignore" + } + }, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root + "remoteUser": "rstudio" +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..47a8a0f6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,77 @@ +{ + // 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", + "DOCKER_CONTAINER_CONTEXT": "" + }, + "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": true, + "installOhMyZsh": true, + "username": "rstudio", + "upgradePackages": false + }, + "ghcr.io/mikaello/devcontainer-features/modern-shell-utils:1": {} + }, + "init": true, + "overrideCommand": false, + + "postCreateCommand": { + "renv": "R -q -e 'renv::activate(profile = \"4.3\"); renv::restore(); staged.dependencies::install_deps(staged.dependencies::dependency_table(project = \".\", verbose = 1), verbose = 1);'", + "rstudio": "jq --arg folder \"$(pwd)/\" '. + { \"initial_working_directory\": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json" + }, + + "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": "ignore" + } + }, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root + "remoteUser": "rstudio" +} diff --git a/.devcontainer/rstudio-prefs.json b/.devcontainer/rstudio-prefs.json new file mode 100644 index 00000000..2d5cce84 --- /dev/null +++ b/.devcontainer/rstudio-prefs.json @@ -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 +}