diff --git a/.github/workflows/rworkflows_static.yml b/.github/workflows/rworkflows_static.yml index e282ed82..2db8a07f 100644 --- a/.github/workflows/rworkflows_static.yml +++ b/.github/workflows/rworkflows_static.yml @@ -90,7 +90,7 @@ jobs: echo "NOT_CRAN=${{ !env.as_cran }}" >> $GITHUB_ENV shell: bash {0} - name: ⏬ Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: "\U0001F40D Setup Miniconda" if: env.miniforge_variant != 'false' uses: conda-incubator/setup-miniconda@v4 diff --git a/NEWS.md b/NEWS.md index 7d3fa648..abef9ea6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,7 +21,8 @@ resources: - Add `testthat::skip_if_offline()` to all tests whose call stacks may reach the internet (`test-check_bioc_version.R`, `test-fill_description.R`, - `test-get_authors.R`, `test-get_hex.R`, `test-infer_deps.R`). + `test-get_authors.R`, `test-get_hex.R`, `test-infer_biocviews.R`, + `test-infer_deps.R`). - Move the existing offline guard up in `test-construct_cont.R` so that the `versions_explicit = TRUE` branch (which calls `bioc_r_versions()`) is also skipped when offline. @@ -35,6 +36,17 @@ resources: degrade gracefully when offline. * Add `curl` to `Suggests` to support the new offline guards in examples and vignettes. +* Vignettes: replace `read.dcf("../DESCRIPTION", ...)` with + `utils::packageDescription("rworkflows", ...)` so the setup chunks no + longer fail under `R CMD check`'s `tools::checkVignettes()`, which + tangles each vignette to a `.R` file and sources it from a temp working + directory where `../DESCRIPTION` does not resolve. The same change is + applied to `inst/templates/{templateR,docker}.Rmd` via a `__PKG__` + placeholder that `use_vignette_getstarted()` / `use_vignette_docker()` + substitute at write time. +* `use_vignette_getstarted()` / `use_vignette_docker()`: raise a clear + error when `package` is `NULL` or empty (previously they silently + produced a malformed file). ## Miscellaneous @@ -43,9 +55,28 @@ and vignettes. the action runtime to Node.js 24, which is supported by GitHub-hosted runners but requires self-hosted runners on a recent `actions/runner` release. +* Bump `actions/checkout` from `@v4` to `@v6` (the bundled example + workflow goes from `@v3`). v5 moved the runtime to Node.js 24 (requires + runner >= v2.327.1, satisfied by all GitHub-hosted runners) and v6 + persists git auth credentials to a separate `.gitauth` file instead of + `.git/config`; neither change affects this action. * Forward the `ncpus` input to `grimbough/bioc-actions/setup-bioc@v1` (as its `Ncpus` input) so non-Linux R installs use the configured parallel job count instead of the action's default of 3. +* Tests: replace `is_gha()` gates that were guarding internet access + with host-specific `skip_if_offline(host=...)` calls + (`bioconductor.org`, `github.com`, `raw.githubusercontent.com`, + `ghcr.io`) so individual tests skip when their actual remote is + unreachable. This includes the `get_description` Bioc-repo block, + which previously gated on `is_gha() | is_rstudio()` to dodge CRAN + flakiness (#65); it now skips on `bioconductor.org` instead. Each + `skip_if_offline()` is then wrapped in `if (!is_gha())` so GitHub + Actions exercises the network path regardless of the offline probe; + developer machines and CRAN's check farm continue to skip when the + named host is unreachable. `is_gha()` is also retained for the + `construct_conda_yml` env-creation block, where the test is + genuinely GHA-only (creates and leaves a conda env behind, so should + not run on developer machines). # rworkflows 1.0.11 diff --git a/R/use_vignette_docker.R b/R/use_vignette_docker.R index a3f0e576..e078990b 100644 --- a/R/use_vignette_docker.R +++ b/R/use_vignette_docker.R @@ -65,6 +65,12 @@ use_vignette_docker <- function(package = names(get_description()), verbose=TRUE){ # devoptera::args2vars(use_vignette_docker, reassign = TRUE) + force(package) + if (length(package) != 1L || is.na(package) || !nzchar(package)) { + stop("`package` must be a non-empty string. ", + "Could not be inferred from a local DESCRIPTION; ", + "pass `package` explicitly.") + } #### Check if file exists already #### if(file.exists(path) & isFALSE(force_new)){ @@ -82,8 +88,9 @@ use_vignette_docker <- function(package = names(get_description()), package = "rworkflows") #### Edit the yaml header ### l <- readLines(template_path) + l <- gsub("__PKG__", package, l, fixed = TRUE) yml_lines <- seq(grep("---",l)[1], - rev(grep("---",l))[1] ) + rev(grep("---",l))[1] ) yml <- yaml::read_yaml(text = l[yml_lines]) #### Set params #### ## cont diff --git a/R/use_vignette_getstarted.R b/R/use_vignette_getstarted.R index 53b2a289..9063fe93 100644 --- a/R/use_vignette_getstarted.R +++ b/R/use_vignette_getstarted.R @@ -26,6 +26,11 @@ use_vignette_getstarted <- function(package = names(get_description()), # devoptera::args2vars(use_vignette_getstarted, reassign = TRUE) force(package) + if (length(package) != 1L || is.na(package) || !nzchar(package)) { + stop("`package` must be a non-empty string. ", + "Could not be inferred from a local DESCRIPTION; ", + "pass `package` explicitly.") + } #### Check if file exists already #### if(file.exists(path) & isFALSE(force_new)){ @@ -38,8 +43,9 @@ use_vignette_getstarted <- function(package = names(get_description()), package = "rworkflows") #### Edit the yaml header ### l <- readLines(template_path) + l <- gsub("__PKG__", package, l, fixed = TRUE) yml_lines <- seq(grep("---",l)[1], - rev(grep("---",l))[1] ) + rev(grep("---",l))[1] ) yml <- yaml::read_yaml(text = l[yml_lines]) ## vignette title yml$title <- title diff --git a/action.yml b/action.yml index 4c7543c8..6142b33d 100644 --- a/action.yml +++ b/action.yml @@ -219,7 +219,7 @@ runs: ## Checkout before Miniconda so that environment_file can reference repo files - name: ⏬ Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 🐍 Setup Miniconda if: inputs.miniforge_variant != 'false' diff --git a/inst/example/check_rworkflows-merged.yml b/inst/example/check_rworkflows-merged.yml index 93713ff9..f7561406 100644 --- a/inst/example/check_rworkflows-merged.yml +++ b/inst/example/check_rworkflows-merged.yml @@ -26,7 +26,7 @@ jobs: run: | curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - uses: ./rworkflows-merged with: run_bioccheck: true diff --git a/inst/templates/docker.Rmd b/inst/templates/docker.Rmd index 41579c4b..cfa781d6 100644 --- a/inst/templates/docker.Rmd +++ b/inst/templates/docker.Rmd @@ -1,6 +1,6 @@ --- title: "Docker/Singularity Containers" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('__PKG__', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: BiocStyle::html_document: @@ -24,7 +24,7 @@ vignette: > ```{r setup, include=FALSE} #### Package name #### -PKG <- read.dcf("../DESCRIPTION", fields = "Package")[1] +PKG <- "__PKG__" library(PKG, character.only = TRUE) ## Docker containers must be lowercase pkg <- tolower(PKG) diff --git a/inst/templates/templateR.Rmd b/inst/templates/templateR.Rmd index a6866a28..7f0d5f5f 100644 --- a/inst/templates/templateR.Rmd +++ b/inst/templates/templateR.Rmd @@ -1,6 +1,6 @@ --- title: "Get Started" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('__PKG__', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: BiocStyle::html_document @@ -12,7 +12,7 @@ vignette: > ```{r, echo=FALSE, include=FALSE} -pkg <- read.dcf("../DESCRIPTION", fields = "Package")[1] +pkg <- "__PKG__" library(pkg, character.only = TRUE) ``` diff --git a/tests/testthat/test-bioc_r_versions.R b/tests/testthat/test-bioc_r_versions.R index 9348a8d2..2ba4b23f 100644 --- a/tests/testthat/test-bioc_r_versions.R +++ b/tests/testthat/test-bioc_r_versions.R @@ -1,6 +1,5 @@ test_that("bioc_r_versions works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") ver1 <- bioc_r_versions(bioc_version="devel") testthat::expect_true(ver1$bioc>="3.17") diff --git a/tests/testthat/test-check_bioc_version.R b/tests/testthat/test-check_bioc_version.R index 9a909441..e7996b52 100644 --- a/tests/testthat/test-check_bioc_version.R +++ b/tests/testthat/test-check_bioc_version.R @@ -1,6 +1,5 @@ test_that("check_bioc_version works", { - ## Skip if offline: relies on bioc_r_versions() which fetches a remote yaml - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") testthat::expect_equal( check_bioc_version(bioc = "3.17"), diff --git a/tests/testthat/test-check_cont.R b/tests/testthat/test-check_cont.R index 94b7129d..a061f346 100644 --- a/tests/testthat/test-check_cont.R +++ b/tests/testthat/test-check_cont.R @@ -1,9 +1,5 @@ test_that("check_cont works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) { - testthat::skip_if_offline() - testthat::skip_on_cran() - } + if (!is_gha()) testthat::skip_if_offline(host = "ghcr.io") testthat::expect_no_warning( check_cont(cont = "bioconductor/bioconductor_docker:devel") diff --git a/tests/testthat/test-check_r_version.R b/tests/testthat/test-check_r_version.R index 2cf48e08..112a51f4 100644 --- a/tests/testthat/test-check_r_version.R +++ b/tests/testthat/test-check_r_version.R @@ -1,6 +1,5 @@ test_that("check_r_version works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") testthat::expect_equal( check_r_version(r = "4.1"), diff --git a/tests/testthat/test-construct_conda_yml.R b/tests/testthat/test-construct_conda_yml.R index a98b9c5b..e0c9383c 100644 --- a/tests/testthat/test-construct_conda_yml.R +++ b/tests/testthat/test-construct_conda_yml.R @@ -46,9 +46,8 @@ test_that("construct_conda_yml works", { return_path = TRUE, save_path = save_path) testthat::expect_true(file.exists(path2)) - - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + + if (!is_gha()) testthat::skip_if_offline(host = "conda.anaconda.org") # conda <- conda_path() out <- reticulate::conda_create(environment = path2, diff --git a/tests/testthat/test-construct_cont.R b/tests/testthat/test-construct_cont.R index 880a3042..0b71a626 100644 --- a/tests/testthat/test-construct_cont.R +++ b/tests/testthat/test-construct_cont.R @@ -12,9 +12,7 @@ test_that("construct_cont works", { testthat::expect_equal(cont2[[1]], paste0(default_registry,"bioconductor/bioconductor_docker:",default_tag)) - ## Don't run on CRAN servers due to ongoing internet connectivity issues - ## (versions_explicit=TRUE / run_check_cont=TRUE both require internet) - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") cont3 <- construct_cont(versions_explicit = TRUE) testthat::expect_true(grepl("bioconductor/bioconductor_docker:RELEASE_*", diff --git a/tests/testthat/test-construct_runners.R b/tests/testthat/test-construct_runners.R index 97c3e61d..343e6d66 100644 --- a/tests/testthat/test-construct_runners.R +++ b/tests/testthat/test-construct_runners.R @@ -1,6 +1,5 @@ test_that("construct_runners works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") #### Set up tests #### run_tests <- function(runners){ diff --git a/tests/testthat/test-fill_description.R b/tests/testthat/test-fill_description.R index 589e49a2..ce158c65 100644 --- a/tests/testthat/test-fill_description.R +++ b/tests/testthat/test-fill_description.R @@ -1,6 +1,5 @@ test_that("fill_description works", { - ## Skip if offline: downloads a DESCRIPTION file from GitHub - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") url <- "https://github.com/neurogenomics/templateR/raw/master/DESCRIPTION" path <- tempfile(pattern = "DESCRIPTION") diff --git a/tests/testthat/test-get_authors.R b/tests/testthat/test-get_authors.R index 7b2d487e..68215c51 100644 --- a/tests/testthat/test-get_authors.R +++ b/tests/testthat/test-get_authors.R @@ -1,6 +1,5 @@ test_that("get_authors works", { - ## Skip if offline: get_description() may fall back to GitHub for refs - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") true_auths <- "Brian Schilder, Alan Murphy, Hiranyamaya (Hiru) Dash, Nathan Skene" #### ref is NULL #### diff --git a/tests/testthat/test-get_description.R b/tests/testthat/test-get_description.R index 4bd62b43..da02e7ef 100644 --- a/tests/testthat/test-get_description.R +++ b/tests/testthat/test-get_description.R @@ -1,4 +1,4 @@ -skip_if_offline() +if (!is_gha()) testthat::skip_if_offline(host = "github.com") test_that("get_description works", { run_tests <- function(dl){ @@ -22,8 +22,8 @@ test_that("get_description works", { paths="typo") d6 <- get_description(refs=NULL, paths="typo") - d7 <- get_description(refs=NULL, - paths=here::here("DESCRIPTION") + d7 <- get_description(refs=NULL, + paths=system.file("DESCRIPTION", package="rworkflows") ) d8 <- get_description(refs=c("stats","data.table"), paths=NULL) @@ -56,43 +56,36 @@ test_that("get_description works", { testthat::expect_null(d6[[1]]) - if(is_gha() && testthat::is_testing()){ - testthat::expect_equal(d7[[1]], - d1[[1]]) - } else{ - message("Skipping test.") - } - + testthat::expect_equal(d7[[1]], + d1[[1]]) + #### Search CRAN/Bioc repos #### - ## Don't run on CRAN due to issues on their server: - ## https://github.com/neurogenomics/rworkflows/issues/65 - if (is_gha() | is_rstudio()) { - #### Run first time #### - d13a <- get_description(refs="ABSSeq", - db = rworkflows::biocpkgtools_db, - use_repos = TRUE) - testthat::expect_equal(d13a[[1]], - d1[[1]]) - #### Rerun to use stored DESCRITPION files #### - d13b <- get_description(refs="ABSSeq", - db = rworkflows::biocpkgtools_db, - use_repos = TRUE) - testthat::expect_equal(d13b[[1]], - d1[[1]]) - #### Unable to find pkg info #### - testthat::expect_null( - get_description(refs="typooo", - db = rworkflows::biocpkgtools_db, - use_repos = TRUE) - ) - #### Gather remote data #### - d13c <- get_description(refs="ABSSeq", - db = NULL, - use_repos = TRUE, - repo = "BioCsoft") - testthat::expect_equal(d13c[[1]], - d1[[1]]) - } + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") + #### Run first time #### + d13a <- get_description(refs="ABSSeq", + db = rworkflows::biocpkgtools_db, + use_repos = TRUE) + testthat::expect_equal(d13a[[1]], + d1[[1]]) + #### Rerun to use stored DESCRITPION files #### + d13b <- get_description(refs="ABSSeq", + db = rworkflows::biocpkgtools_db, + use_repos = TRUE) + testthat::expect_equal(d13b[[1]], + d1[[1]]) + #### Unable to find pkg info #### + testthat::expect_null( + get_description(refs="typooo", + db = rworkflows::biocpkgtools_db, + use_repos = TRUE) + ) + #### Gather remote data #### + d13c <- get_description(refs="ABSSeq", + db = NULL, + use_repos = TRUE, + repo = "BioCsoft") + testthat::expect_equal(d13c[[1]], + d1[[1]]) #### Search GitHub repos #### d14 <- get_description(refs="neurogenomics/orthogene", paths=NULL, diff --git a/tests/testthat/test-get_hex.R b/tests/testthat/test-get_hex.R index 29c0757b..812d1cb9 100644 --- a/tests/testthat/test-get_hex.R +++ b/tests/testthat/test-get_hex.R @@ -1,6 +1,5 @@ test_that("get_hex works", { - ## Skip if offline: get_hex() validates URLs over the network - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") #### When repo name provided #### hex1 <- get_hex(refs="neurogenomics/rworkflows") @@ -9,14 +8,10 @@ test_that("get_hex works", { testthat::expect_equal(hex2$rworkflows, hex1$`neurogenomics/rworkflows`) #### When DESCRIPTION path provided #### - hex3 <- get_hex(refs=NULL, - paths=here::here("DESCRIPTION")) - if(is_gha() && testthat::is_testing()){ - testthat::expect_equal(hex3[[1]], - hex1[[1]]) - } else { - message("Skipping test.") - } + hex3 <- get_hex(refs=NULL, + paths=system.file("DESCRIPTION", package="rworkflows")) + testthat::expect_equal(hex3[[1]], + hex1[[1]]) #### When neither refs nor paths provided #### hex4 <- get_hex(refs=NULL, paths=NULL) @@ -41,7 +36,7 @@ test_that("get_hex works", { hex1[[1]]) #### When paths length > refs length #### hex7 <- get_hex(refs="neurogenomics/rworkflows", - paths = rep(here::here("DESCRIPTION"),2)) + paths = rep(system.file("DESCRIPTION", package="rworkflows"),2)) testthat::expect_equal(hex7[[1]], hex1[[1]]) #### Can't find URL: but URL inferred #### diff --git a/tests/testthat/test-get_yaml.R b/tests/testthat/test-get_yaml.R index ca928cd0..242f08b2 100644 --- a/tests/testthat/test-get_yaml.R +++ b/tests/testthat/test-get_yaml.R @@ -1,5 +1,5 @@ test_that("get_yaml works", { - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") testthat::expect_type( rworkflows:::get_yaml(template = "rworkflows"), diff --git a/tests/testthat/test-gha_python_versions.R b/tests/testthat/test-gha_python_versions.R index 85ea1ec5..c75e039c 100644 --- a/tests/testthat/test-gha_python_versions.R +++ b/tests/testthat/test-gha_python_versions.R @@ -1,6 +1,5 @@ test_that("gha_python_versions works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "raw.githubusercontent.com") testthat::expect_equal(gha_python_versions(python_version = "3.11"),"3.11") testthat::expect_equal(gha_python_versions(python_version = "3.x"),"3.x") diff --git a/tests/testthat/test-infer_biocviews.R b/tests/testthat/test-infer_biocviews.R index 6aba84e6..c78a123b 100644 --- a/tests/testthat/test-infer_biocviews.R +++ b/tests/testthat/test-infer_biocviews.R @@ -1,25 +1,18 @@ -test_that("infer_biocviews works", { - - # Don't run simply bc biocViews::recommendBiocViews is unable - ## to find the DESCRIPTION file when running examples. - # biocviews1 <- infer_biocviews(pkgdir = "../../") - # testthat::expect_equal(biocviews1,"Software") - - if(testthat::is_testing() && - !is_gha()){ - message("Skipping test.") - } else { - testthat::expect_equal(infer_biocviews(include_branch = FALSE), - c("Software","WorkflowManagement")) - } - biocviews_manual = c("Software","Genetics","Transcriptomics") - if(testthat::is_testing() && - !is_gha()){ - message("Skipping test.") - } else { - testthat::expect_equal(infer_biocviews(biocviews = biocviews_manual), - c(biocviews_manual,"WorkflowManagement")) - } +test_that("infer_biocviews works", { + if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org") + + # Resolve a pkgdir that contains DESCRIPTION in both devtools::test() + # (source dir) and R CMD check (installed copy in temp library), since + # here::here() doesn't anchor to the package under R CMD check. + pkgdir <- dirname(system.file("DESCRIPTION", package = "rworkflows")) + + testthat::expect_equal(infer_biocviews(pkgdir = pkgdir, + include_branch = FALSE), + c("Software","WorkflowManagement")) + biocviews_manual = c("Software","Genetics","Transcriptomics") + testthat::expect_equal(infer_biocviews(pkgdir = pkgdir, + biocviews = biocviews_manual), + c(biocviews_manual,"WorkflowManagement")) #### Errors #### testthat::expect_error( diff --git a/tests/testthat/test-infer_deps.R b/tests/testthat/test-infer_deps.R index d3a0b20f..a48b8ca0 100644 --- a/tests/testthat/test-infer_deps.R +++ b/tests/testthat/test-infer_deps.R @@ -1,6 +1,5 @@ test_that("infer_deps works", { - ## Skip if offline: downloads a DESCRIPTION file from GitHub - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") #' #### Get example DESCRIPTION file #### url <- "https://github.com/neurogenomics/templateR/raw/master/DESCRIPTION" diff --git a/tests/testthat/test-url_exists.R b/tests/testthat/test-url_exists.R index 848eee01..8b5f2c02 100644 --- a/tests/testthat/test-url_exists.R +++ b/tests/testthat/test-url_exists.R @@ -1,6 +1,5 @@ test_that("url_exists works", { - ## Don't run on CRAN servers due to ongoing internet connectivity issues - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") testthat::expect_true( rworkflows:::url_exists("https://github.com/neurogenomics/rworkflows") diff --git a/tests/testthat/test-use_badges.R b/tests/testthat/test-use_badges.R index e6784363..df2bd950 100644 --- a/tests/testthat/test-use_badges.R +++ b/tests/testthat/test-use_badges.R @@ -1,5 +1,5 @@ test_that("use_badges works", { - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") run_tests <- function(badges){ testthat::expect_length(badges,1) diff --git a/tests/testthat/test-use_workflow.R b/tests/testthat/test-use_workflow.R index d2bbddd7..5456ee26 100644 --- a/tests/testthat/test-use_workflow.R +++ b/tests/testthat/test-use_workflow.R @@ -1,5 +1,5 @@ test_that("use_workflow works", { - if(!is_gha()) testthat::skip_if_offline() + if (!is_gha()) testthat::skip_if_offline(host = "github.com") path <- use_workflow(save_dir = file.path(tempdir(),".github","workflows")) testthat::expect_true(file.exists(path)) diff --git a/vignettes/bioconductor.Rmd b/vignettes/bioconductor.Rmd index 9f8a3c2d..ee35a729 100644 --- a/vignettes/bioconductor.Rmd +++ b/vignettes/bioconductor.Rmd @@ -1,6 +1,6 @@ --- title: "Bioconductor" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('rworkflows', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: rmarkdown::html_vignette @@ -12,7 +12,7 @@ vignette: > ```{r, echo=FALSE, include=FALSE} -pkg <- read.dcf("../DESCRIPTION", fields = "Package")[1] +pkg <- "rworkflows" library(pkg, character.only = TRUE) ## Skip internet-dependent chunks gracefully when offline has_net <- requireNamespace("curl", quietly = TRUE) && curl::has_internet() diff --git a/vignettes/depgraph.Rmd b/vignettes/depgraph.Rmd index 1302f081..44810517 100644 --- a/vignettes/depgraph.Rmd +++ b/vignettes/depgraph.Rmd @@ -1,6 +1,6 @@ --- title: "Dependency graph" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('rworkflows', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: rmarkdown::html_vignette diff --git a/vignettes/docker.Rmd b/vignettes/docker.Rmd index 905a7ceb..dd45d71c 100644 --- a/vignettes/docker.Rmd +++ b/vignettes/docker.Rmd @@ -1,6 +1,6 @@ --- title: Docker/Singularity Containers -author: '

Authors: `r auths <- eval(parse(text = gsub("person","c",read.dcf("../DESCRIPTION", +author: '

Authors: `r auths <- eval(parse(text = gsub("person","c",utils::packageDescription("rworkflows", fields = "Authors@R"))));paste(auths[names(auths)=="given"],auths[names(auths)=="family"], collapse = ", ")`

' date: '

Vignette updated: `r format( Sys.Date(), "%b-%d-%Y")`

' @@ -23,7 +23,7 @@ vignette: | ```{r setup, include=FALSE} #### Package name #### -PKG <- read.dcf("../DESCRIPTION", fields = "Package")[1] +PKG <- "rworkflows" library(PKG, character.only = TRUE) ## Docker containers must be lowercase pkg <- tolower(PKG) diff --git a/vignettes/repos.Rmd b/vignettes/repos.Rmd index 0e5f01ab..11c0906f 100644 --- a/vignettes/repos.Rmd +++ b/vignettes/repos.Rmd @@ -1,6 +1,6 @@ --- title: "Repositories report" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('rworkflows', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: rmarkdown::html_vignette diff --git a/vignettes/rworkflows.Rmd b/vignettes/rworkflows.Rmd index a05a4858..68e42e6c 100644 --- a/vignettes/rworkflows.Rmd +++ b/vignettes/rworkflows.Rmd @@ -1,6 +1,6 @@ --- title: "Get Started" -author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',read.dcf('../DESCRIPTION', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" +author: "

Authors: `r auths <- eval(parse(text = gsub('person','c',utils::packageDescription('rworkflows', fields = 'Authors@R'))));paste(auths[names(auths)=='given'],auths[names(auths)=='family'], collapse = ', ')`

" date: "

Vignette updated: `r format( Sys.Date(), '%b-%d-%Y')`

" output: rmarkdown::html_vignette @@ -12,7 +12,7 @@ vignette: > ```{r, echo=FALSE, include=FALSE} -pkg <- read.dcf("../DESCRIPTION", fields = "Package")[1] +pkg <- "rworkflows" library(pkg, character.only = TRUE) ## Skip internet-dependent chunks gracefully when offline has_net <- requireNamespace("curl", quietly = TRUE) && curl::has_internet() @@ -147,7 +147,8 @@ If you're using the GitHub Container Registry, `docker_org` can simply be your GH organization name or user name. ```{r} ## Use default save_dir in practice -vignette2 <- rworkflows::use_vignette_docker(docker_org = "neurogenomics", +vignette2 <- rworkflows::use_vignette_docker(package = "mypackage", + docker_org = "neurogenomics", save_dir = tempdir()) ```