Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyad authored Oct 6, 2023
0 parents commit 8a85b01
Show file tree
Hide file tree
Showing 62 changed files with 10,264 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
^renv$
^renv\.lock$
^.*\.Rproj$
^.*\.lycheeignore$
^\.Rproj\.user$
^pkgdown$
^_pkgdown\.yml$
^.github$
^.lintr$
^docs$
^Meta$
^codecov\.yml$
^man/dev_util_.+\.Rd$
^LICENSE\.md$
^\.github$
^admiraltemplate\.Rcheck$
^admiraltemplate.*\.tar\.gz$
^admiraltemplate.*\.tgz$
^staged_dependencies.yaml$
^README.Rmd$
^\.devcontainer$
48 changes: 48 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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", "admiral.test", "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 {
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")
76 changes: 76 additions & 0 deletions .devcontainer/4.1/devcontainer.json
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}/\"",

"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"
}
76 changes: 76 additions & 0 deletions .devcontainer/4.2/devcontainer.json
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}/\"",

"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"
}
76 changes: 76 additions & 0 deletions .devcontainer/devcontainer.json
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}/\"",

"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"
}
5 changes: 5 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

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);'

jq --arg folder "$(pwd)/" '. + { "initial_working_directory": $folder }' .devcontainer/rstudio-prefs.json > ~/.config/rstudio/rstudio-prefs.json
8 changes: 8 additions & 0 deletions .devcontainer/rstudio-prefs.json
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
}
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This a CODEOWNERS file, where you can establish code owners.
# Code owners are automatically requested for review when someone opens a pull request
# that modifies code that they own. In this instance, cicdguy will be notified of any
# changes made the files inside the .github/workflows directory.
.github/workflows/* @cicdguy
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/01_bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bug Report
description: Something is not working correctly or is not working at all!
title: "Bug: <Insert Issue Title Here>"
labels: ["bug", "programming"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
**Example:** Bug: derive_vars_dtm() is returning NA values when using preserve argument
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us what were you expecting to happen before the bug?
placeholder: "A bug happened!"
validations:
required: true
- type: textarea
id: session-info
attributes:
label: Session Information
description: Use `sessionInfo()` in the R console to gather all the details of your environment when the bug happened.
placeholder: "Place the console output here"
validations:
required: false
- type: textarea
id: logs
attributes:
label: Reproducible Example
description: We love code that can reproduce the example. Check out [reprex](https://reprex.tidyverse.org/articles/reprex-dos-and-donts.html)
placeholder: "Please give us as many details as you can! The faster we can recreate the bug, the faster we can get a fix in the works. Warning, Error Messages and Screenshots are also great."
validations:
required: false
Loading

0 comments on commit 8a85b01

Please sign in to comment.