Skip to content

Commit 01f4d84

Browse files
authored
Merge pull request #152 from neurogenomics/static-fix
Fix static workflow: Dependency installation failure
2 parents 6f91fae + 745d81c commit 01f4d84

9 files changed

Lines changed: 92 additions & 35 deletions

File tree

.github/workflows/rworkflows_static.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ env:
3030
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3131
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
3232
ncpus: 2.0
33+
timeout: 2000.0
34+
force_install: ${{ false }}
35+
run_telemetry: ${{ true }}
36+
free_diskspace: ${{ false }}
3337
cache_version: cache-v1
3438
miniforge_variant: ${{ false }}
3539
activate_environment: test
@@ -44,18 +48,20 @@ jobs:
4448
matrix:
4549
config:
4650
- os: ubuntu-latest
51+
bioc: devel
4752
r: auto
48-
bioc: release
49-
cont: ghcr.io/bioconductor/bioconductor_docker:latest
50-
python-version: 3.11
53+
cont: ghcr.io/bioconductor/bioconductor_docker:devel
54+
rspm: ~
5155
- os: macOS-latest
52-
r: latest
5356
bioc: release
54-
python-version: 3.11
57+
r: auto
58+
cont: ~
59+
rspm: ~
5560
- os: windows-latest
56-
r: latest
5761
bioc: release
58-
python-version: 3.11
62+
r: auto
63+
cont: ~
64+
rspm: ~
5965
env:
6066
R_REMOTES_NO_ERRORS_FROM_WARNINGS: ${{ true }}
6167
RSPM: ${{ matrix.config.rspm }}
@@ -81,13 +87,6 @@ jobs:
8187
echo "TZ=UTC" >> $GITHUB_ENV
8288
echo "NOT_CRAN=${{ !env.as_cran }}" >> $GITHUB_ENV
8389
shell: bash {0}
84-
- name: "\U0001F4DA Set R library home on Linux"
85-
if: runner.os == 'Linux'
86-
run: |
87-
mkdir -p /__w/_temp/Library
88-
echo ".libPaths('/__w/_temp/Library')" >> ~/.Rprofile
89-
git config --global --add safe.directory '*'
90-
shell: bash {0}
9190
- name: ⏬ Checkout repository
9291
uses: actions/checkout@v4
9392
- name: "\U0001F40D Setup Miniconda"
@@ -101,6 +100,13 @@ jobs:
101100
activate-environment: ${{ env.activate_environment }}
102101
environment-file: ${{ env.environment_file }}
103102
channels: ${{ env.channels }}
103+
- name: "\U0001F4DA Set R library home on Linux"
104+
if: runner.os == 'Linux'
105+
run: |
106+
mkdir -p /__w/_temp/Library
107+
echo ".libPaths('/__w/_temp/Library')" >> ~/.Rprofile
108+
git config --global --add safe.directory '*'
109+
shell: bash {0}
104110
- name: "\U0001F6E0 Setup R and Bioconductor"
105111
if: runner.os != 'Linux'
106112
uses: grimbough/bioc-actions/setup-bioc@v1
@@ -211,7 +217,7 @@ jobs:
211217
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"), Ncpus=as.integer(Sys.getenv("ncpus")))
212218
## For running the checks
213219
message(paste('****', Sys.time(), 'installing rcmdcheck ****'))
214-
install.packages(c("rcmdcheck","rmarkdown","BiocManager"), dependencies = TRUE)
220+
install.packages(c("rmarkdown","BiocManager"), dependencies = TRUE)
215221
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies****'))
216222
message(paste('**** Using', Sys.getenv("ncpus"), 'cores for installation.'))
217223
repos <- BiocManager::repositories()

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rworkflows
22
Type: Package
33
Title: Test, Document, Containerise, and Deploy R Packages
4-
Version: 1.0.10
4+
Version: 1.0.11
55
Authors@R:
66
c(person(given = "Brian",
77
family = "Schilder",

NEWS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# rworkflows 1.0.11
2+
3+
## Bug Fixes
4+
5+
* Fix `use_workflow(template="rworkflows_static")` not generating the `timeout`,
6+
`force_install`, `run_telemetry`, and `free_diskspace` environment variables. (#146)
7+
* Add `as.integer()` coercion to all R `options(timeout=...)` calls for robustness.
8+
These were causing `download.file()` to fail with `cannot download any files`
9+
when the timeout was not properly converted to a numeric value.
10+
111
# rworkflows 1.0.10
212

313
## Miscellaneous

R/fill_yaml.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ fill_yaml <- function(## function-level args
3636
codecov_token,
3737
docker_user,
3838
docker_org,
39-
docker_token,
40-
ncpus,
41-
cache_version,
39+
docker_token,
40+
ncpus,
41+
timeout,
42+
force_install,
43+
run_telemetry,
44+
free_diskspace,
45+
cache_version,
4246
miniforge_variant,
4347
miniforge_version,
4448
activate_environment,

R/use_workflow.R

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@
103103
#' @param ncpus Number of CPUs to use for R package installation. Higher values
104104
#' can speed up the dependency installation process but may result in spurious
105105
#' errors. (default = \code{2})
106+
#' @param timeout The maximum time to wait for long R processes like
107+
#' dependency installations, downloads, and code checks. (default = \code{2000})
108+
#' @param force_install Whether to force install packages. If \code{true}, all
109+
#' packages will be reinstalled, bypassing the cache.
110+
#' @param run_telemetry Whether to run the workflow telemetry action:
111+
#' https://github.com/catchpoint/workflow-telemetry-action
112+
#' @param free_diskspace Whether to free up additional disk space by deleting
113+
#' non-essential software.
106114
#' @param miniforge_variant If provided, this variant of Miniforge will be
107115
#' downloaded and installed. If \code{miniforge_variant=false},
108116
#' Miniforge will not be installed at all.
@@ -163,9 +171,13 @@ use_workflow <- function(## action-level args
163171
### General
164172
github_token="${{ secrets.GITHUB_TOKEN }}",
165173
cache_version="cache-v1",
166-
enable_act=FALSE,
167-
ncpus=2,
168-
### Checks
174+
enable_act=FALSE,
175+
ncpus=2,
176+
timeout=2000,
177+
force_install=FALSE,
178+
run_telemetry=TRUE,
179+
free_diskspace=FALSE,
180+
### Checks
169181
run_bioccheck=FALSE,
170182
run_rcmdcheck=TRUE,
171183
as_cran=TRUE,
@@ -271,9 +283,13 @@ use_workflow <- function(## action-level args
271283
environment_file=environment_file,
272284
channels=channels,
273285
cache_version=cache_version,
274-
enable_act=enable_act,
275-
ncpus=ncpus)
276-
#### Preview ####
286+
enable_act=enable_act,
287+
ncpus=ncpus,
288+
timeout=timeout,
289+
force_install=force_install,
290+
run_telemetry=run_telemetry,
291+
free_diskspace=free_diskspace)
292+
#### Preview ####
277293
if(isTRUE(preview)){
278294
preview_yaml(yml=yml)
279295
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://cran.r-project.org/web/licenses/GPL-3)
77
[![](https://img.shields.io/badge/doi-https://doi.org/10.5281/zenodo.10048573-blue.svg)](https://doi.org/https://doi.org/10.5281/zenodo.10048573)
88
<br>
9-
[![](https://img.shields.io/badge/devel%20version-1.0.8-black.svg)](https://github.com/neurogenomics/rworkflows)
9+
[![](https://img.shields.io/badge/devel%20version-1.0.11-black.svg)](https://github.com/neurogenomics/rworkflows)
1010
[![](https://img.shields.io/github/languages/code-size/neurogenomics/rworkflows.svg)](https://github.com/neurogenomics/rworkflows)
1111
[![](https://img.shields.io/github/last-commit/neurogenomics/rworkflows.svg)](https://github.com/neurogenomics/rworkflows/commits/master)
1212
<br> [![R build
@@ -320,7 +320,7 @@ utils::sessionInfo()
320320
## [22] pillar_1.11.1 RColorBrewer_1.1-3 rlang_1.1.7
321321
## [25] badger_0.2.5 xfun_0.56 fs_1.6.6
322322
## [28] S7_0.2.1 otel_0.2.0 cli_3.6.5
323-
## [31] magrittr_2.0.4 rworkflows_1.0.10 digest_0.6.39
323+
## [31] magrittr_2.0.4 rworkflows_1.0.11 digest_0.6.39
324324
## [34] grid_4.6.0 rstudioapi_0.18.0 rappdirs_0.3.4
325325
## [37] lifecycle_1.0.5 vctrs_0.7.1 data.table_1.18.2.1
326326
## [40] evaluate_1.0.5 glue_1.8.0 farver_2.1.2

action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ runs:
349349
force_install: ${{ inputs.force_install }}
350350
ncpus: ${{ inputs.ncpus }}
351351
run: |
352-
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"), Ncpus=as.integer(Sys.getenv("ncpus")))
352+
options(crayon.enabled = TRUE, timeout=as.integer(Sys.getenv("timeout")), Ncpus=as.integer(Sys.getenv("ncpus")))
353353
## For running the checks
354354
message(paste('****', Sys.time(), 'installing rcmdcheck ****'))
355355
install.packages(c("rmarkdown","BiocManager"), dependencies = TRUE)
@@ -366,7 +366,7 @@ runs:
366366
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
367367
ncpus: ${{ inputs.ncpus }}
368368
run: |
369-
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"), Ncpus=as.integer(Sys.getenv("ncpus")))
369+
options(crayon.enabled = TRUE, timeout=as.integer(Sys.getenv("timeout")), Ncpus=as.integer(Sys.getenv("ncpus")))
370370
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies****'))
371371
repos <- BiocManager::repositories()
372372
remotes::install_local(repos=repos, dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE, force=FALSE)
@@ -426,7 +426,7 @@ runs:
426426
timeout: ${{ inputs.timeout }}
427427
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
428428
run: |
429-
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
429+
options(crayon.enabled = TRUE, timeout=as.integer(Sys.getenv("timeout")))
430430
if(!require("rcmdcheck", quietly=TRUE)) install.packages("rcmdcheck")
431431
as_cran <- if(Sys.getenv("AS_CRAN")=='true') "--as-cran" else NULL
432432
run_build_vignettes <- if(Sys.getenv("run_vignettes")=='true') NULL else "--no-build-vignettes"
@@ -450,7 +450,7 @@ runs:
450450
timeout: ${{ inputs.timeout }}
451451
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
452452
run: |
453-
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
453+
options(crayon.enabled = TRUE, timeout=as.integer(Sys.getenv("timeout")))
454454
BiocGenerics:::testPackage()
455455
shell: Rscript {0}
456456

@@ -464,7 +464,7 @@ runs:
464464
timeout: ${{ inputs.timeout }}
465465
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
466466
run: |
467-
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
467+
options(crayon.enabled = TRUE, timeout=as.integer(Sys.getenv("timeout")))
468468
#### Install deps ####
469469
if(!require("BiocManager", quietly=TRUE)) install.packages("BiocManager")
470470
if(!require("BiocCheck", quietly=TRUE)) BiocManager::install("BiocCheck")

man/use_workflow.Rd

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-use_workflow.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ test_that("use_workflow works", {
3939
force_new = TRUE,
4040
tinytex_installer = "TinyTeX",
4141
save_dir = tempdir())
42-
testthat::expect_equal(yml$on,yml3$on)
43-
testthat::expect_equal(length(yml$jobs[[1]]$steps),1)
44-
testthat::expect_gte(length(yml3$jobs[[1]]$steps),20)
42+
testthat::expect_equal(yml$on,yml3$on)
43+
testthat::expect_equal(length(yml$jobs[[1]]$steps),1)
44+
testthat::expect_gte(length(yml3$jobs[[1]]$steps),20)
45+
#### Test that new env vars are properly set for rworkflows_static ####
46+
testthat::expect_equal(yml3$env$timeout, 2000)
47+
testthat::expect_equal(yml3$env$force_install, "${{ false }}")
48+
testthat::expect_equal(yml3$env$run_telemetry, "${{ true }}")
49+
testthat::expect_equal(yml3$env$free_diskspace, "${{ false }}")
4550

4651
#### Modify conda args ####
4752
environment_file <- construct_conda_yml(dependencies = c("python>=3.9","anndata"),

0 commit comments

Comments
 (0)