From 2edb9759045f57a94bd5d8352115e51467904544 Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 15:36:40 +0100
Subject: [PATCH 1/9] fix(vignettes): replace read.dcf("../DESCRIPTION") with
packageDescription
R CMD check tangles each vignette to a .R file and sources it from a temp
working directory, where ../DESCRIPTION does not resolve. Use
utils::packageDescription("rworkflows", ...) in the package's own vignettes,
and a __PKG__ placeholder in inst/templates/{templateR,docker}.Rmd that
use_vignette_getstarted()/use_vignette_docker() substitute at write time.
Also guard those generators against a NULL/empty `package` (the previous
default silently produced a malformed file) and update the use_vignette_docker
demo in rworkflows.Rmd to pass package = "mypackage" so the chunk no longer
relies on a discoverable DESCRIPTION at vignette runtime.
---
R/use_vignette_docker.R | 9 ++++++++-
R/use_vignette_getstarted.R | 8 +++++++-
inst/templates/docker.Rmd | 4 ++--
inst/templates/templateR.Rmd | 4 ++--
vignettes/bioconductor.Rmd | 4 ++--
vignettes/depgraph.Rmd | 2 +-
vignettes/docker.Rmd | 4 ++--
vignettes/repos.Rmd | 2 +-
vignettes/rworkflows.Rmd | 7 ++++---
9 files changed, 29 insertions(+), 15 deletions(-)
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/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/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())
```
From 7e0ccbb18c4de535f5a6f3bf2a0c9a190302ef98 Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 15:39:57 +0100
Subject: [PATCH 2/9] chore(deps): bump actions/checkout to v6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
action.yml and rworkflows_static.yml were on v4; the bundled example
was on v3. v6.0.2 is the current latest.
v5 moved the action onto Node.js 24 (requires runner >= v2.327.1, which
all GitHub-hosted runners satisfy). v6 (PR actions/checkout#2286) writes
git auth credentials to a separate .gitauth file instead of .git/config.
Neither change affects this action — post-checkout we only run
`git config --global --add safe.directory '*'` and pass GITHUB_TOKEN
through the env, not from .git/config.
---
.github/workflows/rworkflows_static.yml | 2 +-
action.yml | 2 +-
inst/example/check_rworkflows-merged.yml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
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/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
From ac61194527029b3b0faf77e655e0bde974290ad1 Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 15:54:33 +0100
Subject: [PATCH 3/9] test: drop is_gha() gates in favour of
skip_if_offline(host=...)
Replace `if(!is_gha()) skip_if_offline()` with `skip_if_offline(host=X)`
where X is the host the test actually contacts:
- bioconductor.org for bioc_r_versions / construct_runners / construct_cont /
check_r_version / check_bioc_version
- github.com for get_description / get_authors / get_hex / use_badges /
use_workflow / infer_deps / fill_description / get_yaml / url_exists
- raw.githubusercontent.com for gha_python_versions
- conda.anaconda.org for the construct_conda_yml conda_create block
For is_gha() gates that weren't about offline (infer_biocviews,
get_description d7 == d1 expectation, get_hex hex3 == hex1 expectation,
construct_conda_yml OS guard) the gate is removed and the assertion runs
unconditionally; the get_description Bioc-repo block now skips on
bioconductor.org instead of requiring is_gha() | is_rstudio().
All 195 tests pass with 0 skips locally.
---
tests/testthat/test-bioc_r_versions.R | 3 +-
tests/testthat/test-check_bioc_version.R | 3 +-
tests/testthat/test-check_cont.R | 6 +-
tests/testthat/test-check_r_version.R | 3 +-
tests/testthat/test-construct_conda_yml.R | 10 ++--
tests/testthat/test-construct_cont.R | 4 +-
tests/testthat/test-construct_runners.R | 3 +-
tests/testthat/test-fill_description.R | 3 +-
tests/testthat/test-get_authors.R | 3 +-
tests/testthat/test-get_description.R | 67 ++++++++++-------------
tests/testthat/test-get_hex.R | 11 +---
tests/testthat/test-get_yaml.R | 2 +-
tests/testthat/test-gha_python_versions.R | 3 +-
tests/testthat/test-infer_biocviews.R | 20 ++-----
tests/testthat/test-infer_deps.R | 3 +-
tests/testthat/test-url_exists.R | 3 +-
tests/testthat/test-use_badges.R | 2 +-
tests/testthat/test-use_workflow.R | 2 +-
18 files changed, 56 insertions(+), 95 deletions(-)
diff --git a/tests/testthat/test-bioc_r_versions.R b/tests/testthat/test-bioc_r_versions.R
index 9348a8d2..dca32f78 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()
+ 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..fa020f67 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()
+ 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..eed847eb 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()
- }
+ 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..59e8703a 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()
+ 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..a7c268a3 100644
--- a/tests/testthat/test-construct_conda_yml.R
+++ b/tests/testthat/test-construct_conda_yml.R
@@ -31,9 +31,8 @@ test_that("construct_conda_yml works", {
#### Construct an actual conda env ####
if("reticulate" %in% rownames(installed.packages()) &&
- conda_installed() &&
- is_gha() &&
- .Platform$OS.type != "windows"){
+ conda_installed() &&
+ .Platform$OS.type != "windows"){
envname <- "testenv"
if(condaenv_exists(envname)){
reticulate::conda_remove(envname = envname)
@@ -46,9 +45,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()
+
+ 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..956f34bf 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()
+ 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..5d81cb45 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()
+ 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..9ee4c74f 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()
+ 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..40710125 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()
+ 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..880bed6e 100644
--- a/tests/testthat/test-get_description.R
+++ b/tests/testthat/test-get_description.R
@@ -1,4 +1,4 @@
-skip_if_offline()
+testthat::skip_if_offline(host = "github.com")
test_that("get_description works", {
run_tests <- function(dl){
@@ -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]])
- }
+ 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..30a0f3db 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()
+ testthat::skip_if_offline(host = "github.com")
#### When repo name provided ####
hex1 <- get_hex(refs="neurogenomics/rworkflows")
@@ -11,12 +10,8 @@ test_that("get_hex works", {
#### 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.")
- }
+ testthat::expect_equal(hex3[[1]],
+ hex1[[1]])
#### When neither refs nor paths provided ####
hex4 <- get_hex(refs=NULL,
paths=NULL)
diff --git a/tests/testthat/test-get_yaml.R b/tests/testthat/test-get_yaml.R
index ca928cd0..077bf60a 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()
+ 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..58d38685 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()
+ 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..1dc1fdf9 100644
--- a/tests/testthat/test-infer_biocviews.R
+++ b/tests/testthat/test-infer_biocviews.R
@@ -5,21 +5,11 @@ test_that("infer_biocviews works", {
# 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"))
- }
+ testthat::expect_equal(infer_biocviews(include_branch = FALSE),
+ c("Software","WorkflowManagement"))
+ biocviews_manual = c("Software","Genetics","Transcriptomics")
+ testthat::expect_equal(infer_biocviews(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..4311b7b5 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()
+ 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..2ddacba8 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()
+ 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..20ebc3dc 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()
+ 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..199485e6 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()
+ testthat::skip_if_offline(host = "github.com")
path <- use_workflow(save_dir = file.path(tempdir(),".github","workflows"))
testthat::expect_true(file.exists(path))
From fb4012c8737733954316e0bc740dd1aadda03654 Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 16:09:32 +0100
Subject: [PATCH 4/9] docs(NEWS): record vignette/checkout/test changes under
1.0.12
Add bullets under the existing 1.0.12 section for: the vignette read.dcf
fix and packageDescription/__PKG__ rewrite, the use_vignette_* package
guard, the actions/checkout v6 bump, and the test refactor that swapped
is_gha() gates for skip_if_offline(host=...).
---
NEWS.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/NEWS.md b/NEWS.md
index 7d3fa648..caeeab8d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -35,6 +35,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 +54,19 @@ 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 `if(!is_gha()) skip_if_offline()` gates with
+ host-specific `skip_if_offline(host=...)` calls
+ (`bioconductor.org`, `github.com`, `raw.githubusercontent.com`,
+ `ghcr.io`, `conda.anaconda.org`) so individual tests skip when their
+ actual remote is unreachable rather than relying on a GHA escape hatch.
# rworkflows 1.0.11
From 6953b78da887befeca7ea38d124a0346519c300c Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 16:23:35 +0100
Subject: [PATCH 5/9] test(conda): keep is_gha() gate on env-creation block
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Restore the is_gha() guard on the construct_conda_yml conda env-creation
block that was dropped in ac61194. The block creates a real conda env
under ~/miniforge3/envs/testenv and is intentionally GHA-only — running
it on a developer machine leaves persistent state behind, and the
test's own `condaenv_exists()` cleanup misses orphaned env directories,
so subsequent runs fail with `prefix already exists`. is_gha() is the
right gate here because the test is genuinely targeting the GHA
environment (where setup-miniconda provides conda on PATH and the
runner is fresh).
Update the NEWS bullet to reflect that is_gha() is retained for this
single test; everywhere else the gates are now host-specific
skip_if_offline().
---
NEWS.md | 14 ++++++++++----
tests/testthat/test-construct_conda_yml.R | 5 +++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index caeeab8d..723394d1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -62,11 +62,17 @@ and vignettes.
* 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 `if(!is_gha()) skip_if_offline()` gates with
- host-specific `skip_if_offline(host=...)` calls
+* 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`, `conda.anaconda.org`) so individual tests skip when their
- actual remote is unreachable rather than relying on a GHA escape hatch.
+ `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.
+ `is_gha()` is retained only 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/tests/testthat/test-construct_conda_yml.R b/tests/testthat/test-construct_conda_yml.R
index a7c268a3..cefddd5f 100644
--- a/tests/testthat/test-construct_conda_yml.R
+++ b/tests/testthat/test-construct_conda_yml.R
@@ -31,8 +31,9 @@ test_that("construct_conda_yml works", {
#### Construct an actual conda env ####
if("reticulate" %in% rownames(installed.packages()) &&
- conda_installed() &&
- .Platform$OS.type != "windows"){
+ conda_installed() &&
+ is_gha() &&
+ .Platform$OS.type != "windows"){
envname <- "testenv"
if(condaenv_exists(envname)){
reticulate::conda_remove(envname = envname)
From aa4e984878c259852aa1f623dc27bddc29bcfc65 Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 16:34:13 +0100
Subject: [PATCH 6/9] test: gate skip_if_offline behind !is_gha() so GHA always
runs network tests
---
tests/testthat/test-bioc_r_versions.R | 2 +-
tests/testthat/test-check_bioc_version.R | 2 +-
tests/testthat/test-check_cont.R | 2 +-
tests/testthat/test-check_r_version.R | 2 +-
tests/testthat/test-construct_conda_yml.R | 2 +-
tests/testthat/test-construct_cont.R | 2 +-
tests/testthat/test-construct_runners.R | 2 +-
tests/testthat/test-fill_description.R | 2 +-
tests/testthat/test-get_authors.R | 2 +-
tests/testthat/test-get_description.R | 4 ++--
tests/testthat/test-get_hex.R | 2 +-
tests/testthat/test-get_yaml.R | 2 +-
tests/testthat/test-gha_python_versions.R | 2 +-
tests/testthat/test-infer_deps.R | 2 +-
tests/testthat/test-url_exists.R | 2 +-
tests/testthat/test-use_badges.R | 2 +-
tests/testthat/test-use_workflow.R | 2 +-
17 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/tests/testthat/test-bioc_r_versions.R b/tests/testthat/test-bioc_r_versions.R
index dca32f78..2ba4b23f 100644
--- a/tests/testthat/test-bioc_r_versions.R
+++ b/tests/testthat/test-bioc_r_versions.R
@@ -1,5 +1,5 @@
test_that("bioc_r_versions works", {
- testthat::skip_if_offline(host = "bioconductor.org")
+ 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 fa020f67..e7996b52 100644
--- a/tests/testthat/test-check_bioc_version.R
+++ b/tests/testthat/test-check_bioc_version.R
@@ -1,5 +1,5 @@
test_that("check_bioc_version works", {
- testthat::skip_if_offline(host = "bioconductor.org")
+ 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 eed847eb..a061f346 100644
--- a/tests/testthat/test-check_cont.R
+++ b/tests/testthat/test-check_cont.R
@@ -1,5 +1,5 @@
test_that("check_cont works", {
- testthat::skip_if_offline(host = "ghcr.io")
+ 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 59e8703a..112a51f4 100644
--- a/tests/testthat/test-check_r_version.R
+++ b/tests/testthat/test-check_r_version.R
@@ -1,5 +1,5 @@
test_that("check_r_version works", {
- testthat::skip_if_offline(host = "bioconductor.org")
+ 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 cefddd5f..e0c9383c 100644
--- a/tests/testthat/test-construct_conda_yml.R
+++ b/tests/testthat/test-construct_conda_yml.R
@@ -47,7 +47,7 @@ test_that("construct_conda_yml works", {
save_path = save_path)
testthat::expect_true(file.exists(path2))
- testthat::skip_if_offline(host = "conda.anaconda.org")
+ 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 956f34bf..0b71a626 100644
--- a/tests/testthat/test-construct_cont.R
+++ b/tests/testthat/test-construct_cont.R
@@ -12,7 +12,7 @@ test_that("construct_cont works", {
testthat::expect_equal(cont2[[1]],
paste0(default_registry,"bioconductor/bioconductor_docker:",default_tag))
- testthat::skip_if_offline(host = "bioconductor.org")
+ 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 5d81cb45..343e6d66 100644
--- a/tests/testthat/test-construct_runners.R
+++ b/tests/testthat/test-construct_runners.R
@@ -1,5 +1,5 @@
test_that("construct_runners works", {
- testthat::skip_if_offline(host = "bioconductor.org")
+ 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 9ee4c74f..ce158c65 100644
--- a/tests/testthat/test-fill_description.R
+++ b/tests/testthat/test-fill_description.R
@@ -1,5 +1,5 @@
test_that("fill_description works", {
- testthat::skip_if_offline(host = "github.com")
+ 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 40710125..68215c51 100644
--- a/tests/testthat/test-get_authors.R
+++ b/tests/testthat/test-get_authors.R
@@ -1,5 +1,5 @@
test_that("get_authors works", {
- testthat::skip_if_offline(host = "github.com")
+ 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 880bed6e..356bf424 100644
--- a/tests/testthat/test-get_description.R
+++ b/tests/testthat/test-get_description.R
@@ -1,4 +1,4 @@
-testthat::skip_if_offline(host = "github.com")
+if (!is_gha()) testthat::skip_if_offline(host = "github.com")
test_that("get_description works", {
run_tests <- function(dl){
@@ -60,7 +60,7 @@ test_that("get_description works", {
d1[[1]])
#### Search CRAN/Bioc repos ####
- testthat::skip_if_offline(host = "bioconductor.org")
+ if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org")
#### Run first time ####
d13a <- get_description(refs="ABSSeq",
db = rworkflows::biocpkgtools_db,
diff --git a/tests/testthat/test-get_hex.R b/tests/testthat/test-get_hex.R
index 30a0f3db..16285c47 100644
--- a/tests/testthat/test-get_hex.R
+++ b/tests/testthat/test-get_hex.R
@@ -1,5 +1,5 @@
test_that("get_hex works", {
- testthat::skip_if_offline(host = "github.com")
+ if (!is_gha()) testthat::skip_if_offline(host = "github.com")
#### When repo name provided ####
hex1 <- get_hex(refs="neurogenomics/rworkflows")
diff --git a/tests/testthat/test-get_yaml.R b/tests/testthat/test-get_yaml.R
index 077bf60a..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", {
- testthat::skip_if_offline(host = "github.com")
+ 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 58d38685..c75e039c 100644
--- a/tests/testthat/test-gha_python_versions.R
+++ b/tests/testthat/test-gha_python_versions.R
@@ -1,5 +1,5 @@
test_that("gha_python_versions works", {
- testthat::skip_if_offline(host = "raw.githubusercontent.com")
+ 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_deps.R b/tests/testthat/test-infer_deps.R
index 4311b7b5..a48b8ca0 100644
--- a/tests/testthat/test-infer_deps.R
+++ b/tests/testthat/test-infer_deps.R
@@ -1,5 +1,5 @@
test_that("infer_deps works", {
- testthat::skip_if_offline(host = "github.com")
+ 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 2ddacba8..8b5f2c02 100644
--- a/tests/testthat/test-url_exists.R
+++ b/tests/testthat/test-url_exists.R
@@ -1,5 +1,5 @@
test_that("url_exists works", {
- testthat::skip_if_offline(host = "github.com")
+ 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 20ebc3dc..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", {
- testthat::skip_if_offline(host = "github.com")
+ 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 199485e6..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", {
- testthat::skip_if_offline(host = "github.com")
+ 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))
From 3fe9e44c916d8727e9c2be441599a753100c2d2f Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 16:36:58 +0100
Subject: [PATCH 7/9] docs(NEWS): note that skip_if_offline is wrapped in
!is_gha() so CI runs network tests
---
NEWS.md | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 723394d1..41ffcd33 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -68,11 +68,14 @@ and vignettes.
`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.
- `is_gha()` is retained only 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).
+ 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
From c34eeaa7b8c6d919110605eaa1a4df6c97e0e39a Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 16:41:21 +0100
Subject: [PATCH 8/9] test(infer_biocviews): gate on !is_gha() &&
skip_if_offline(host="bioconductor.org")
---
NEWS.md | 3 ++-
tests/testthat/test-infer_biocviews.R | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 41ffcd33..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.
diff --git a/tests/testthat/test-infer_biocviews.R b/tests/testthat/test-infer_biocviews.R
index 1dc1fdf9..b450162a 100644
--- a/tests/testthat/test-infer_biocviews.R
+++ b/tests/testthat/test-infer_biocviews.R
@@ -1,5 +1,6 @@
-test_that("infer_biocviews works", {
-
+test_that("infer_biocviews works", {
+ if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org")
+
# Don't run simply bc biocViews::recommendBiocViews is unable
## to find the DESCRIPTION file when running examples.
# biocviews1 <- infer_biocviews(pkgdir = "../../")
From 95e07572a3367f3b7fae17b7d8bf3d93e7b0c9fe Mon Sep 17 00:00:00 2001
From: HDash <16350928+HDash@users.noreply.github.com>
Date: Tue, 5 May 2026 17:00:00 +0100
Subject: [PATCH 9/9] test: replace here::here() with system.file() so tests
resolve under R CMD check
here::here("DESCRIPTION") doesn't anchor to the package when R CMD check
copies it to a temp dir lacking project markers, causing get_description,
get_hex, and infer_biocviews tests to fail. system.file() works in both
devtools::test() (source tree) and R CMD check (installed copy).
---
tests/testthat/test-get_description.R | 4 ++--
tests/testthat/test-get_hex.R | 6 +++---
tests/testthat/test-infer_biocviews.R | 16 +++++++++-------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/tests/testthat/test-get_description.R b/tests/testthat/test-get_description.R
index 356bf424..da02e7ef 100644
--- a/tests/testthat/test-get_description.R
+++ b/tests/testthat/test-get_description.R
@@ -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)
diff --git a/tests/testthat/test-get_hex.R b/tests/testthat/test-get_hex.R
index 16285c47..812d1cb9 100644
--- a/tests/testthat/test-get_hex.R
+++ b/tests/testthat/test-get_hex.R
@@ -8,8 +8,8 @@ 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"))
+ hex3 <- get_hex(refs=NULL,
+ paths=system.file("DESCRIPTION", package="rworkflows"))
testthat::expect_equal(hex3[[1]],
hex1[[1]])
#### When neither refs nor paths provided ####
@@ -36,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-infer_biocviews.R b/tests/testthat/test-infer_biocviews.R
index b450162a..c78a123b 100644
--- a/tests/testthat/test-infer_biocviews.R
+++ b/tests/testthat/test-infer_biocviews.R
@@ -1,15 +1,17 @@
test_that("infer_biocviews works", {
if (!is_gha()) testthat::skip_if_offline(host = "bioconductor.org")
- # 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")
-
- testthat::expect_equal(infer_biocviews(include_branch = FALSE),
+ # 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(biocviews = biocviews_manual),
+ testthat::expect_equal(infer_biocviews(pkgdir = pkgdir,
+ biocviews = biocviews_manual),
c(biocviews_manual,"WorkflowManagement"))
#### Errors ####