Type: | Package |
Title: | Test, Document, Containerise, and Deploy R Packages |
Version: | 1.0.6 |
Description: | Reproducibility is essential to the progress of research, yet achieving it remains elusive even in computational fields. Continuous Integration (CI) platforms offer a powerful way to launch automated workflows to check and document code, but often require considerable time, effort, and technical expertise to setup. We therefore developed the rworkflows suite to make robust CI workflows easy and freely accessible to all R package developers. rworkflows consists of 1) a CRAN/Bioconductor-compatible R package template, 2) an R package to quickly implement a standardised workflow, and 3) a centrally maintained GitHub Action. |
URL: | https://github.com/neurogenomics/rworkflows, https://CRAN.R-project.org/package=rworkflows |
BugReports: | https://github.com/neurogenomics/rworkflows/issues |
Encoding: | UTF-8 |
biocViews: | Software, WorkflowManagement |
Depends: | R (≥ 4.1) |
Imports: | stats, here, yaml, utils, desc, badger, renv, tools, methods, BiocManager, data.table |
Suggests: | markdown, rmarkdown, remotes, knitr, covr, testthat (≥ 3.0.0), htmltools, jsonlite, BiocStyle, BiocPkgTools, biocViews, reticulate, rvest |
VignetteBuilder: | knitr |
License: | GPL-3 |
Config/testthat/edition: | 3 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-01-23 16:09:09 UTC; bschilder |
Author: | Brian Schilder |
Maintainer: | Brian Schilder <brian_schilder@alumni.brown.edu> |
Repository: | CRAN |
Date/Publication: | 2025-01-23 16:30:02 UTC |
Bioconductor / R versions
Description
Get the respective version of R for a given version of Bioconductor.
Usage
bioc_r_versions(bioc_version = NULL, depth = NULL, return_opts = FALSE)
Arguments
bioc_version |
Version of Bioc to return info for. Can be:
|
depth |
How many levels deep into the R version to include. For example, is the R version number is "4.2.0", the following depths would return:
|
return_opts |
Return a character vector of all valid Bioc version names. |
Value
Named list of Bioc/R versions
Examples
ver <- bioc_r_versions(bioc_version="devel")
Static Bioc packages list
Description
A static snapshot of all Bioconductor packages from biocPkgList. Last updated: Sept. 06 2023
Usage
data("biocpkgtools_db")
Format
An object of class data.table
(inherits from data.frame
) with 100 rows and 53 columns.
Source
as_ascii <- function(dt,
cols=names(dt)){
cols <- cols[cols
func <- function(v){
Encoding(v) <- "latin1"
iconv(v, "latin1", "UTF-8")
}
for(col in cols){
if(is.character(dt[[col]])){
dt[[col]] <- func(dt[[col]])
}
}
return(dt)
}
biocpkgtools_db <- get_description_repo_biocpkgtools(repo="BioCsoft")
biocpkgtools_db <- as_ascii(biocpkgtools_db[seq(100)])
usethis::use_data(biocpkgtools_db, overwrite = TRUE)
Check containers exist
Description
Check that a list of containers are valid.
Usage
check_cont(cont, verbose = TRUE)
Arguments
cont |
Which Docker container to use on each OS
( |
verbose |
Print messages. |
Value
Null
Check registry
Description
Check that the registry is valid.
Usage
check_registry(registry)
Arguments
registry |
A character vector of registry names. |
Value
A single registry name.
Conda export
Description
Get a list of installed packages within a conda environment. Generates a requirements.txt file.
Usage
conda_export(
name,
save_path = tempfile(fileext = "_requirements.txt"),
preview = FALSE,
verbose = TRUE,
...
)
Arguments
name |
Name of conda environment. |
save_path |
Path to save the requirements file. If the file ends with .yml or .yaml, a conda-style yaml file will be generated. If the file ends with requirements.txt, a pip-style requirements.txt file will be generated. |
preview |
Print the requirements file to the R console. |
verbose |
Print messages. |
... |
Optional arguments, reserved for future expansion. |
Value
Path to requirements file.
Source
https://stackoverflow.com/a/55687210
Examples
## Not run:
conda_export()
## End(Not run)
Construct authors
Description
Helper function to construct an author list for a DESCRIPTION file.
Returns a template when authors
is not provided (default).
Usage
construct_authors(
authors = NULL,
template = c(utils::person(given = "yourGivenName", family = "yourFamilyName", role =
c("cre"), email = "yourEmail@email.com", comment = c(ORCID = "yourOrcidId")))
)
Arguments
authors |
A list of authors who contributed to your R package,
each provided as objects of class person.
By default, if an |
template |
Default value to return when |
Value
Named list in person format.
Examples
authors <- construct_authors()
Construct a conda yaml
Description
Construct a yaml file to be used for building a given conda
environment.
Usage
construct_conda_yml(
name = "test",
channels = list("conda-forge", "nodefaults"),
dependencies = list(),
pip = NULL,
save_path = here::here(paste0(name, "_conda.yml")),
return_path = TRUE,
preview = FALSE,
verbose = TRUE
)
Arguments
name |
Name of |
channels |
|
dependencies |
Packages to install via |
pip |
Packages to install via |
save_path |
Path to save the yaml file to. |
return_path |
Return the path to the saved yaml workflow file
(default: |
preview |
Print the yaml file to the R console. |
verbose |
Print messages. |
Value
description
Path or yaml object.
Examples
yml <- construct_conda_yml(name="myenv",
dependencies=c("anndata","scanpy"),
return_path = FALSE,
## Writing to temp only for example
save_path=tempfile(fileext="myenv_conda.yml"))
Construct containers list
Description
Construct containers list
Usage
construct_cont(
default_registry = c("ghcr.io/", "docker.io/", "mcr.microsoft.com/"),
default_cont = "bioconductor/bioconductor_docker",
default_tag = "devel",
cont = list(paste(default_cont, default_tag, sep = ":"), NULL, NULL),
versions_explicit = FALSE,
run_check_cont = FALSE,
verbose = TRUE
)
Arguments
default_registry |
The default container registry to use. Options include:
|
default_cont |
The DockerHub container to default to.
Used when it's detected that only the tag has been given in one or more
|
default_tag |
The DockerHub container tag to default to. |
cont |
Which Docker container to use on each OS
( |
versions_explicit |
Specify R/Bioc versions explicitly
(e.g. |
run_check_cont |
Check whether the requested container repo (and the tag, if specified) exist using check_cont. |
verbose |
Print messages. |
Value
Named list of containers
Examples
cont <- construct_cont()
Construct runners
Description
Construct runner configurations across multiple Operating Systems (OS) for GitHub Actions workflow.
Usage
construct_runners(
os = c("ubuntu-latest", "macOS-latest", "windows-latest"),
bioc = list("devel", "release", "release"),
r = list("auto", "auto", "auto"),
python_version = list(NULL, NULL, NULL),
versions_explicit = FALSE,
run_check_cont = FALSE,
cont = construct_cont(default_tag = bioc[[1]], run_check_cont = run_check_cont),
rspm = list(NULL, NULL, NULL),
verbose = TRUE
)
Arguments
os |
Which OS to launch GitHub Actions on. See here for all options. |
bioc |
Which Bioconductor version to use on each OS. See bioc_r_versions documentation for all options. |
r |
Which R version to use on each OS. |
python_version |
Which python version to use on each OS
(e.g. "3.10", "3.7.5", or "3.x").
( |
versions_explicit |
Specify R/Bioc versions explicitly
(e.g. |
run_check_cont |
Check whether the requested container repo (and the tag, if specified) exist using check_cont. |
cont |
Which Docker container to use on each OS
( |
rspm |
Which R repository manager to use on each OS
( |
verbose |
Print messages. |
Value
Named list of configurations for each runner OS.
Examples
runners <- construct_runners()
data.table to desc
Description
Convert data.table containing the parsed DESCROPTION file data and convert each of them to to desc format.
Usage
dt_to_desc(db, refs = NULL, verbose = TRUE)
Arguments
db |
A data.table where each row is a different R package and each column is a field from the DESCROPTION file. |
refs |
Reference for one or more GitHub repository in owner/repo format
(e.g. |
verbose |
Print messages. |
Value
A named list of desc objects.
Examples
#### Updated data ####
# db <- BiocPkgTools::biocPkgList()
#### Static data ####
db <- rworkflows::biocpkgtools_db
dl <- dt_to_desc(db=db, refs="ABSSeq")
Fill DESCRIPTION
Description
Fill out a DESCRIPTION file, such as (but not limited to) the one provided by the templateR R package template. For any given field, set its corresponding argument as follows to get certain behaviour:
NULL
:Keeps the current value.
NA
:Removes the field from the DESCRIPTION file entirely.
Usage
fill_description(
path = here::here("DESCRIPTION"),
package,
title,
description,
github_owner = NULL,
github_repo = package,
authors = construct_authors(authors = NULL),
depends = paste0("R ", "(>= ", bioc_r_versions(bioc_version = "devel", depth = 2)$r,
")"),
imports = infer_deps(path = path, which = "Imports", add_newlines = TRUE),
suggests = infer_deps(path = path, which = "Suggests", add_newlines = TRUE),
remotes = NULL,
version = NULL,
license = NULL,
encoding = NULL,
vignettebuilder = NULL,
biocviews = infer_biocviews(pkgdir = dirname(path), add_newlines = TRUE),
url = paste0("https://github.com/", github_owner, "/", github_repo),
bugreports = paste0(url, "/issues"),
save_path = path,
verbose = TRUE,
fields = list()
)
Arguments
path |
Path to the DESCRIPTION file. |
package |
The name of your R package. |
title |
The title of your R package. |
description |
The description of your R package. |
github_owner |
The owner of your R package's GitHub repository.
Can be inferred from the |
github_repo |
The name of your R package's GitHub repository. |
authors |
A list of authors who contributed to your R package,
each provided as objects of class person.
By default, if an |
depends |
R package Depends. Defaults to the version of R that the current development version of Bioconductor depends on. |
imports |
R package Imports. These dependencies will be automatically installed with your R package. |
suggests |
R package Suggests. These dependencies will NOT be automatically installed with your R package, unless otherwise specified by users during installation |
remotes |
R package Remotes |
version |
The current version of your R package (e.g 0.99.0). |
license |
R package license. See here for guidance. |
encoding |
R package Encoding. |
vignettebuilder |
R package VignetteBuilder. |
biocviews |
Standardised biocViews terms used to describe your package. Defaults to automatically recommending terms using the infer_biocviews function. Note that non-Bioconductor packages (e.g. CRAN) can also use this field. |
url |
URL where your R package is distributed from (e.g. GitHub repository, Bioconductor page, and/or CRAN page). Can be a single character string or a character vector. |
bugreports |
A URL where users of your package should go if they encounter bugs or have feature requests. |
save_path |
Path to save the updated DESCRIPTION file to.
Defaults to overwriting the input file ( |
verbose |
Print messages. |
fields |
A named list of additional fields to fill the
DESCRIPTION file with: e.g. |
Value
An object of class description.
Examples
#### Get example DESCRIPTION file ####
url <- "https://github.com/neurogenomics/templateR/raw/master/DESCRIPTION"
path <- tempfile(fileext = "DESCRIPTION")
utils::download.file(url,path)
#### Fill out DESCRIPTION file ####
d <- fill_description(
path = path,
package = "MyPackageName",
title = "This Package Does Awesome Stuff",
description = paste(
"MyPackageName does several awesome things.",
"Describe thing1.",
"Describe thing2.",
"Describe thing3."
),
github_owner = "OwnerName",
biocviews = c("Genetics", "SystemsBiology"))
Get authors
Description
Get author names from the an R package DESCRIPTION file.
Usage
get_authors(ref = NULL, add_html = FALSE)
Arguments
ref |
Reference for a GitHub repository. If |
add_html |
Add HTML styling to certain fields (e.g "authors"). |
Value
Authors as a raw text or HTML string.
Get DESCRIPTION
Description
The Liam Neeson of DESCRIPTION file functions.
I will look for you,
I will find you,
—and I will import you into a neatly parsed R object.
Uses a variety of alternative methods, including searching locally and on GitHub (whenever possible). Prioritises the fastest methods that do not involve downloading files first.
Usage
get_description(
refs = NULL,
paths = here::here("DESCRIPTION"),
db = NULL,
cache_dir = tools::R_user_dir(package = "rworkflows", which = "cache"),
force_new = FALSE,
use_wd = TRUE,
use_repos = FALSE,
repo = c("BioCsoft", "BioCann", "BioCexp", "BioCworkflows", "CRAN"),
verbose = TRUE
)
Arguments
refs |
Reference for one or more GitHub repository in owner/repo format
(e.g. |
paths |
Paths to DESCRIPTION file(s) R package(s). |
db |
A data.table of R package metadata generated by biocPkgList. |
cache_dir |
Directory where to cache downloaded files. |
force_new |
Ignore cached files and re-download them instead. |
use_wd |
Search the local working directory (and the one above it) for DESCRIPTION files. |
use_repos |
Use R standard R package repositories like CRAN and Bioc to find DESCRIPTION files. |
repo |
|
verbose |
Print messages. |
Value
A named list of packageDescription
objects.
Examples
d <- get_description(refs="neurogenomics/rworkflows")
Get DESCRIPTION files for R repos
Description
Get the DESCRIPTION file information in data.table format for all R packages in standard R repositories (CRAN, Bioc). Can return a subset of results for specific packages as well.
Usage
get_description_repo(
refs = NULL,
db = NULL,
repo = c("BioCsoft", "BioCann", "BioCexp", "BioCworkflows", "CRAN"),
version = BiocManager::version(),
verbose = TRUE
)
Arguments
refs |
Reference for one or more GitHub repository in owner/repo format
(e.g. |
db |
A data.table of R package metadata generated by biocPkgList. |
repo |
|
version |
The requested Bioconductor version. Will
default to use the BiocManager defaults (i.e., |
verbose |
Print messages. |
Value
Named list of desc objects.
Get GitHub URL: from database
Description
Extract the GitHub URLs from a tabular database of DESCRIPTION file data.
Usage
get_github_url_db(db, return_dt = FALSE)
Arguments
db |
Database. |
return_dt |
Return data.table format. |
Value
data.table or list
Get hex
Description
Get the URL of a hex sticker for a given R package (if one exists).
Usage
get_hex(
refs = NULL,
paths = here::here("DESCRIPTION"),
hex_path = "inst/hex/hex.png",
branch = c("master", "main", "dev"),
hex_height = 300,
check_url = TRUE,
add_html = TRUE,
verbose = TRUE
)
Arguments
refs |
Reference for one or more GitHub repository in owner/repo format
(e.g. |
paths |
Paths to DESCRIPTION file(s) R package(s). |
hex_path |
Path to hex sticker file. |
branch |
Name of the GitHub repository branch to use. |
hex_height |
Height of the hex sticker in pixels
(when |
check_url |
Check whether the URL actually exists. |
add_html |
Wrap the URL in an html "img" tag and
set its height with |
verbose |
Print messages. |
Value
URL
Examples
hex_url <- get_hex(refs=c("neurogenomics/rworkflows",
"neurogenomics/echolocatoR"))
GitHub Actions python versions
Description
Retrieve all python versions available for GitHub Actions runners.
Usage
gha_python_versions(
python_version = NULL,
versions_explicit = TRUE,
cache_dir = tools::R_user_dir(package = "rworkflows", which = "cache"),
verbose = TRUE
)
Arguments
python_version |
Which python version to use on each OS
(e.g. "3.10", "3.7.5", or "3.x").
( |
versions_explicit |
Specify R/Bioc versions explicitly
(e.g. |
verbose |
Print messages. |
Value
Yaml with info for all versions of python, or a character string of one or more versions of python.
Infer biocViews
Description
Infer the best terms to fill the biocViews
field in
your DESCRIPTION file based on the code within your R package.
By default, also includes any biocViews
that are already present in
the DESCRIPTION file.
Please see the
Bioconductor website for more details.
Usage
infer_biocviews(
pkgdir = here::here(),
branch = c("Software", "AnnotationData", "ExperimentData")[1],
type = c("recommended", "current", "remove"),
keep_current = TRUE,
include_branch = TRUE,
biocviews = NULL,
add_newlines = FALSE,
verbose = TRUE
)
Arguments
pkgdir |
The path of the package Directory. |
branch |
The branch which your package will belong to. It can be either 'Software', 'AnnotationData' or 'ExperimentData'. |
type |
Which element of the recommendBiocViews results list to return. If a vector is supplied, only the first value will be used. |
keep_current |
Keep any |
include_branch |
Whether to include the |
biocviews |
User-supplied |
add_newlines |
Prefix each package name with a newline character and two spaces. This is useful for formatting DESCRIPTION files. |
verbose |
Print messages. |
Value
A character vector of biocviews.
Examples
## Don't run simply bc biocViews::recommendBiocViews is unable
## to find the DESCRIPTION file when running examples.
## Not run:
biocviews <- infer_biocviews()
## End(Not run)
Infer dependencies
Description
Infers the R packages that your R package depends on.
Usage
infer_deps(
path = here::here("DESCRIPTION"),
which = c("Imports", "Suggests"),
imports_thresh = 2,
imports = NULL,
suggests = c("testthat", "rmarkdown", "markdown", "knitr", "remotes", "knitr", "covr"),
errors = c("reported", "fatal", "ignored"),
dev = FALSE,
progress = TRUE,
add_newlines = FALSE
)
Arguments
path |
The path to a |
which |
Which types of dependencies to return. |
imports_thresh |
The minimum number of times that a package has to be called within your package to assign it as an Import. If is called less times than this threshold, it will instead be assigned as a Suggest, which means it will not be installed by default. |
imports |
R packages that are exempt from the |
suggests |
R packages that are exempt from the |
errors |
How should errors that occur during dependency enumeration be handled?
|
dev |
Boolean; include development dependencies? These packages are typically required when developing the project, but not when running it (i.e. you want them installed when humans are working on the project but not when computers are deploying it). Development dependencies include packages listed in the |
progress |
Boolean; report progress output while enumerating dependencies? |
add_newlines |
Prefix each package name with a newline character and two spaces. This is useful for formatting DESCRIPTION files. |
Value
A character vector of R package names.
Examples
#### Get example DESCRIPTION file ####
url <- "https://github.com/neurogenomics/templateR/raw/master/DESCRIPTION"
path <- tempfile(fileext = "DESCRIPTION")
utils::download.file(url,path)
deps <- infer_deps(path = path)
Infer Docker registry organisation name
Description
Infer Docker registry organisation name from DESCRIPTION file.
Usage
infer_docker_org(docker_org = NULL, docker_registry, verbose = TRUE, ...)
Arguments
docker_org |
Docker registry organization name.
Can simply be your registry username instead.
If |
docker_registry |
Docker container registry to push to. Options include:
|
verbose |
Print messages. |
... |
Arguments passed on to
|
Value
Docker registry organisation name.
Examples
infer_docker_org(docker_org="myorg", docker_registry="ghcr.io")
Is GitHub Action
Description
Tests whether a function is currently being run within a GitHub Actions workflow or not.
Usage
is_gha(var = "GITHUB_ACTION", verbose = TRUE)
Arguments
var |
Environmental variable to check. |
verbose |
Print messages. |
Value
Boolean
Source
Examples
is_gha()
Message parallel
Description
Send messages to console even from within parallel processes
Usage
message_parallel(...)
Value
Null
Print messages
Description
Conditionally print messages. Allows developers to easily control verbosity of functions, and meet Bioconductor requirements that dictate the message must first be stored to a variable before passing to message.
Usage
messager(..., v = TRUE, parallel = FALSE)
Arguments
v |
Whether to print messages or not. |
parallel |
Whether to enable message print when wrapped in parallelised functions. |
Value
Null
Stop messages
Description
Conditionally print stop messages. Allows developers to easily control verbosity of functions, and meet Bioconductor requirements that dictate the stop message must first be stored to a variable before passing to stop.
Usage
stopper(..., v = TRUE)
Arguments
v |
Whether to print messages or not. |
Value
Null
Use badges
Description
Create one or more badges showing the status of your R package. Uses the package badger.
Usage
use_badges(
ref = NULL,
add_hex = TRUE,
add_actions = "rworkflows",
add_doi = NULL,
add_lifecycle = FALSE,
add_github_version = TRUE,
add_commit = TRUE,
add_code_size = TRUE,
add_license = TRUE,
add_authors = TRUE,
add_codecov = TRUE,
add_codecov_graphs = "icicle",
add_bioc_release = FALSE,
add_bioc_download_month = FALSE,
add_bioc_download_total = FALSE,
add_bioc_download_rank = FALSE,
add_cran_release = FALSE,
add_cran_checks = FALSE,
add_cran_download_month = FALSE,
add_cran_download_total = FALSE,
branch = "master",
as_list = FALSE,
sep = "\n",
hex_height = 300,
codecov_graph_width = 200,
colors = list(github = "black", bioc = "green", cran = "black", default = "blue",
lifecycle = NULL),
verbose = TRUE
)
Arguments
ref |
Reference for a GitHub repository. If |
add_hex |
Add a hex sticker.
If |
add_actions |
The name of one or more GitHub Actions to show the status for with badge_github_actions (e.g. c("rworkflows","rworkflows_static")). |
add_doi |
Add the DOI of a given package or publication
associated with the package using badge_doi.
Must be provided as a character string, e.g.:
|
add_lifecycle |
Add package lifecycle stage.
If not
See lifecycle.r-lib.org for further details. |
add_github_version |
Add package version with badge_github_version. |
add_commit |
Add the last GitHub repo commit date with badge_last_commit. |
add_code_size |
Add code size with badge_code_size. |
add_license |
Add license info with badge_license. |
add_authors |
Add author names inferred from
the |
add_codecov |
Add Codecov status with badge_codecov. See the Codecov site for more information about these badges. |
add_codecov_graphs |
Add Codecov graphs visualising results of code coverage tests. Options include:
See the Codecov site for more information about each plot type. |
add_bioc_release |
Add Bioc release version with badge_bioc_release. |
add_bioc_download_month |
Add the number of Bioc downloads last month badge_bioc_download. |
add_bioc_download_total |
Add the number of Bioc downloads total badge_bioc_download. |
add_bioc_download_rank |
Add the download rank of the package on Bioc badge_bioc_download_rank. |
add_cran_release |
Add Bioc release version with badge_cran_release. |
add_cran_checks |
Add whether package is passing all checks on CRAN with badge_cran_checks. |
add_cran_download_month |
Add the number of CRAN downloads last month badge_cran_download. |
add_cran_download_total |
Add the number of CRAN downloads total badge_cran_download. |
branch |
Name of the GitHub repository branch to use. |
as_list |
Return the header as a named list ( |
sep |
Character to separate each item in the list with using paste. |
hex_height |
Height of the hex sticker in pixels
(when |
codecov_graph_width |
Width of each Codecov graph in pixels
(when |
colors |
Colors to assign to each group of badges (when possible). |
verbose |
Print messages. |
Value
A named list of selected badges in markdown format.
Examples
badges <- rworkflows::use_badges(ref = "neurogenomics/rworkflows")
Use Codespace
Description
Generate a dev container config file to set up a GitHub Codespace.
Usage
use_codespace(
template = "devcontainer.json",
image = "ghcr.io/neurogenomics/rworkflows:dev",
features = list(`ghcr.io/devcontainers/features/conda:1` = list()),
customizations = list(vscode = list(settings = list(), extensions =
list("reditorsupport.r", "visualstudioexptteam.vscodeintellicode",
"ionutvmi.path-autocomplete"))),
save_dir = here::here(".devcontainer"),
path = file.path(save_dir, template),
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
template |
Dev container config template to use. |
image |
Base Docker image to use for the Codespace. |
features |
Named list of features to add to the Codespace. See here for details. |
customizations |
Named list of customizations to add to the Codespace. See here for details. |
save_dir |
Directory to save the file to. |
path |
Path to the file. |
force_new |
If the file already exists, overwrite it
(default: |
show |
Print the contents of the file in the R console. |
verbose |
Print messages. |
Value
Path to dev container config file.
Examples
path <- use_codespace(save_dir=tempdir())
Use Dockerfile
Description
Creates a Docker file to be used with the GitHub Actions (GHA) workflows distributed by rworkflows.
Usage
use_dockerfile(
save_dir = here::here(),
path = file.path(save_dir, "Dockerfile"),
base_image = construct_cont()[[1]],
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
save_dir |
Directory to save the Docker file to. |
path |
Path to the Docker file. |
base_image |
Base Docker image to use. |
force_new |
If a Docker file already exists, overwrite it
(default: |
show |
Print the contents of the Docker file in the R console. |
verbose |
Print messages. |
Value
Path to Docker file.
Examples
path <- use_dockerfile(save_dir=tempdir())
Use Issue Template
Description
Creates one or more Issue Templates to be used in a GitHub repository.
Usage
use_issue_template(
templates = c("bug_report.yml", "feature_request.yml", "config.yml"),
save_dir = here::here(".github", "ISSUE_TEMPLATE"),
path = file.path(save_dir, templates),
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
templates |
The names of templates to be used. |
save_dir |
Directory to save the Docker file to. |
path |
Path to the Docker file. |
force_new |
If a Docker file already exists, overwrite it
(default: |
show |
Print the contents of the Docker file in the R console. |
verbose |
Print messages. |
Value
Path to Issue Templates.
Examples
path <- use_issue_template(save_dir=tempdir())
Use README
Description
Creates an rmarkdown README file that autofills using metadata from the R package DESCRIPTION file.
Usage
use_readme(
save_dir = here::here(),
path = file.path(save_dir, "README.Rmd"),
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
save_dir |
Directory to save the file to. |
path |
Path to the file. |
force_new |
If the file already exists, overwrite it
(default: |
show |
Print the contents of the file in the R console. |
verbose |
Print messages. |
Value
Path to README file.
Examples
## use default save_dir in practice
path <- use_readme(save_dir = tempdir())
Use vignette: Docker
Description
Creates a vignette rmarkdown file demonstrates how to create a Docker/Singularity image from a container stored in Dockerhub.
Usage
use_vignette_docker(
package = names(get_description()),
docker_org = NULL,
docker_registry = "ghcr.io",
cont = construct_cont(cont = paste(docker_org, package, sep = "/"), default_registry =
docker_registry)[[1]],
title = "Docker/Singularity Containers",
vignette_index_entry = "docker",
save_dir = here::here(),
path = file.path(save_dir, "vignettes", "docker.Rmd"),
output = list(`BiocStyle::html_document` = list(md_extensions = "-autolink_bare_uris")),
port_in = 8787,
port_out = 8900,
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
package |
R package name. |
docker_org |
Docker registry organization name.
Can simply be your registry username instead.
If |
docker_registry |
Docker container registry to push to. Options include:
|
cont |
Which Docker container to use on each OS
( |
title |
Title of vignette. |
vignette_index_entry |
Index entry of the vignette, which is used when creating the navigation bar in the pkgdown site. |
save_dir |
Directory to save the file to. |
path |
Path to the file. |
output |
Vignette output style. Defaults to html_document. |
port_in |
Port number to route into the docker container. See the Docker docs for further details. |
port_out |
Port number to route out of docker container. See the Docker docs for further details. |
force_new |
If the file already exists, overwrite it
(default: |
show |
Print the contents of the file in the R console. |
verbose |
Print messages. |
Value
Path to vignette file.
Examples
path <- use_vignette_docker(package = "mypackage",
docker_org = "neurogenomics",
## use default save_dir in practice
save_dir = tempdir())
Use vignette: Get started
Description
Creates a "Get started" rmarkdown vignette file.
Usage
use_vignette_getstarted(
package = names(get_description()),
title = "Get started",
vignette_index_entry = package,
save_dir = here::here(),
path = file.path(save_dir, "vignettes", paste0(package, ".Rmd")),
output = "BiocStyle::html_document",
force_new = FALSE,
show = FALSE,
verbose = TRUE
)
Arguments
package |
R package name. |
title |
Title of vignette. |
vignette_index_entry |
Index entry of the vignette, which is used when creating the navigation bar in the pkgdown site. |
save_dir |
Directory to save the file to. |
path |
Path to the file. |
output |
Vignette output style. Defaults to html_document. |
force_new |
If the file already exists, overwrite it
(default: |
show |
Print the contents of the file in the R console. |
verbose |
Print messages. |
Value
Path to vignette file.
Examples
path <- use_vignette_getstarted(package = "mypackage",
## use default save_dir in practice
save_dir = tempdir())
Use GitHub Actions workflow
Description
Create workflow that calls an rworkflows GitHub Actions (GHA)
Usage
use_workflow(
template = "rworkflows",
name = template,
tag = "@master",
on = c("push", "pull_request"),
branches = c("master", "main", "devel", "RELEASE_**"),
runners = construct_runners(),
github_token = "${{ secrets.GITHUB_TOKEN }}",
cache_version = "cache-v1",
enable_act = FALSE,
run_bioccheck = FALSE,
run_rcmdcheck = TRUE,
as_cran = TRUE,
run_vignettes = TRUE,
has_testthat = TRUE,
has_runit = FALSE,
run_covr = TRUE,
has_latex = FALSE,
tinytex_installer = "TinyTeX-1",
tinytex_version = NULL,
pandoc_version = "2.19",
run_pkgdown = TRUE,
run_docker = FALSE,
docker_registry = "ghcr.io",
docker_user = NULL,
docker_org = docker_user,
docker_token = "${{ secrets.DOCKER_TOKEN }}",
miniforge_variant = FALSE,
miniforge_version = NULL,
activate_environment = "test",
environment_file = NULL,
channels = NULL,
save_dir = here::here(".github", "workflows"),
return_path = TRUE,
force_new = FALSE,
preview = FALSE,
verbose = TRUE
)
Arguments
template |
Workflow template name.
Optionally, you can include the suffix ":<branch>" to specify which branch you would like to download the "action.yml" file from to create the static workflow template. |
name |
An arbitrary name to call the workflow. |
tag |
Which version of the |
on |
GitHub trigger conditions. |
branches |
GitHub trigger branches. |
runners |
Runner configurations for multiple Operating Systems (OS), including R versions, Bioc versions, and container sources. Can use the construct_runners functions to assist in constructing customized runners configurations. |
github_token |
GitHub authentication token with permissions to push to the R package's GitHub repository. Also used to bypass GitHub download limits. By default, uses {{ secrets.GITHUB_TOKEN }} which is automatically set up by GitHub. However users can also choose to pass a custom GitHub secret variable (e.g. {{ secrets.PAT_GITHUB }}) which allows access to private repositories. Read here for more details. |
cache_version |
Name of the cache sudirectory to be used when reinstalling software in GHA. |
enable_act |
Whether to add extra lines to the yaml to enable local workflow checking with act. |
run_bioccheck |
Run Bioconductor checks using
|
run_rcmdcheck |
Run R CMD checks using
|
as_cran |
When running R CMD checks, use the '–as-cran' flag to apply CRAN standards |
run_vignettes |
Build and check R package vignettes. |
has_testthat |
Run unit tests and report results. |
has_runit |
Run R Unit tests. |
run_covr |
Run code coverage tests and publish results to codecov. |
has_latex |
Install a suite of LaTeX dependencies used for rendering Sweave (.rnw) and other documentation files. |
tinytex_installer |
Which release of tinytex (bundles of LaTeX
packages) to use. All options can be found
here.
Note, 'TinyTeX-2' is only available for |
tinytex_version |
Which version of tinytex to use. When set to ”, uses the latest daily build. All versions can be found here. |
pandoc_version |
Which version of pandoc to use. For details see here. |
run_pkgdown |
Knit the README.Rmd (if available), build documentation website, and deploy to gh-pages branch. |
run_docker |
Whether to build and push a Docker container to DockerHub. |
docker_registry |
Docker container registry to push to. Options include:
|
docker_user |
Docker registry username.
Not used when |
docker_org |
Docker registry organization name.
Is the same as |
docker_token |
Docker registry token.
Not used when |
miniforge_variant |
If provided, this variant of Miniforge will be
downloaded and installed. If |
miniforge_version |
If provided, this version of the given Miniforge
variant will be downloaded and installed. If |
activate_environment |
Environment name (or path) to activate on all
shells. Default is "test" which will be created in $CONDA/envs/test.
If an empty string is used, no environment is activated by default
(For "base" activation see the |
environment_file |
Path or URL to a .yml file to build the conda environment with. For more information see here. |
channels |
Conda configuration. Comma separated list of channels to use in order of priority. See here for more information. |
save_dir |
Directory to save workflow to. |
return_path |
Return the path to the saved yaml workflow file
(default: |
force_new |
If the GHA workflow yaml already exists,
overwrite with new one (default: |
preview |
Print the yaml file to the R console. |
verbose |
Print messages. |
Value
Path or yaml object.
Source
Issue reading in "on:"/"y","n" elements.
Issue writing "on:" as "'as':"
Examples
path <- use_workflow(save_dir = file.path(tempdir(),".github","workflows"))