From 0da3a638f63c54724e32ef8b45aab6e22e4b7ba3 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 15:22:07 +0100 Subject: [PATCH 1/6] Try and make code coverage work --- .github/workflows/test-coverage.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index c11be552..6531c06b 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -36,6 +36,7 @@ jobs: - name: Test coverage run: | covr::codecov( + token = "${{ secrets.CODECOV_TOKEN }} quiet = FALSE, clean = FALSE, install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") From 2d53921d10a46a0fec37d284c8df3aa5a8be9235 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 15:30:01 +0100 Subject: [PATCH 2/6] Fix syntax --- .github/workflows/test-coverage.yaml | 2 +- DESCRIPTION | 2 +- drivers/windows/DESCRIPTION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 6531c06b..e6197939 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -36,7 +36,7 @@ jobs: - name: Test coverage run: | covr::codecov( - token = "${{ secrets.CODECOV_TOKEN }} + token = "${{ secrets.CODECOV_TOKEN }}", quiet = FALSE, clean = FALSE, install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") diff --git a/DESCRIPTION b/DESCRIPTION index f3fa57e1..529df083 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: hipercow Title: High Performance Computing -Version: 1.0.31 +Version: 1.0.32 Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), email = "rich.fitzjohn@gmail.com"), person("Wes", "Hinsley", role = "aut"), diff --git a/drivers/windows/DESCRIPTION b/drivers/windows/DESCRIPTION index 82dfa31b..a2ceee3c 100644 --- a/drivers/windows/DESCRIPTION +++ b/drivers/windows/DESCRIPTION @@ -1,6 +1,6 @@ Package: hipercow.windows Title: DIDE HPC Support for Windows -Version: 1.0.31 +Version: 1.0.32 Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), email = "rich.fitzjohn@gmail.com"), person("Wes", "Hinsley", role = "aut"), From 126065a3d6a7494638ce681c5931c6bbeecb2d4c Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 16:57:42 +0100 Subject: [PATCH 3/6] Logic switch --- R/envvars.R | 3 +-- R/task-create.R | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/R/envvars.R b/R/envvars.R index 8e4d3ae7..a4c62244 100644 --- a/R/envvars.R +++ b/R/envvars.R @@ -161,11 +161,10 @@ envvars_apply <- function(envvars, envir) { } envvars_export <- function(envvars, path) { + file.create(path) if (!is.null(envvars)) { vars <- envvars[!envvars$secret, ] writeLines(sprintf("%s=%s", vars$name, vars$value), path) - } else { - file.create(path) } } diff --git a/R/task-create.R b/R/task-create.R index ab60dd20..ca1bdfcd 100644 --- a/R/task-create.R +++ b/R/task-create.R @@ -542,10 +542,9 @@ task_export_envvars <- function(root, dst, envvars, inherit_envvars) { envvars_export(envvars, dst) } else { src <- file.path(path_task(root$path$tasks, inherit_envvars), RENVIRON) + fs::file_create(dst) if (fs::file_exists(src)) { - fs::file_copy(src, dst) - } else { - fs::file_create(dst) + fs::file_copy(src, dst, overwrite = TRUE) } } } From 0ff092b221a45691521123b52d1c72cdb27db424 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 17:31:27 +0100 Subject: [PATCH 4/6] Fix with single write --- R/envvars.R | 7 ++++--- R/task-create.R | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/R/envvars.R b/R/envvars.R index a4c62244..94eed57e 100644 --- a/R/envvars.R +++ b/R/envvars.R @@ -161,11 +161,12 @@ envvars_apply <- function(envvars, envir) { } envvars_export <- function(envvars, path) { - file.create(path) + lines <- NULL if (!is.null(envvars)) { vars <- envvars[!envvars$secret, ] - writeLines(sprintf("%s=%s", vars$name, vars$value), path) - } + lines <- sprintf("%s=%s", vars$name, vars$value) + } + writeLines(lines, path) } diff --git a/R/task-create.R b/R/task-create.R index ca1bdfcd..ee6805bc 100644 --- a/R/task-create.R +++ b/R/task-create.R @@ -542,10 +542,11 @@ task_export_envvars <- function(root, dst, envvars, inherit_envvars) { envvars_export(envvars, dst) } else { src <- file.path(path_task(root$path$tasks, inherit_envvars), RENVIRON) - fs::file_create(dst) + lines <- NULL if (fs::file_exists(src)) { - fs::file_copy(src, dst, overwrite = TRUE) + lines <- readLines(src) } + writeLines(lines, dst) } } From 794a9c319aaa175b6a7436d3c2e6b10f08f2ec28 Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 17:33:10 +0100 Subject: [PATCH 5/6] Whitespace --- R/envvars.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/envvars.R b/R/envvars.R index 94eed57e..b602b865 100644 --- a/R/envvars.R +++ b/R/envvars.R @@ -165,7 +165,7 @@ envvars_export <- function(envvars, path) { if (!is.null(envvars)) { vars <- envvars[!envvars$secret, ] lines <- sprintf("%s=%s", vars$name, vars$value) - } + } writeLines(lines, path) } From 29ce6b216aa7d9377213afa870450ebf9f6e44ff Mon Sep 17 00:00:00 2001 From: Wes Hinsley Date: Tue, 9 Jul 2024 17:56:46 +0100 Subject: [PATCH 6/6] use character(0) instead of NULL --- R/envvars.R | 2 +- R/task-create.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/envvars.R b/R/envvars.R index b602b865..1e7cdbb8 100644 --- a/R/envvars.R +++ b/R/envvars.R @@ -161,7 +161,7 @@ envvars_apply <- function(envvars, envir) { } envvars_export <- function(envvars, path) { - lines <- NULL + lines <- character(0) if (!is.null(envvars)) { vars <- envvars[!envvars$secret, ] lines <- sprintf("%s=%s", vars$name, vars$value) diff --git a/R/task-create.R b/R/task-create.R index ee6805bc..e7f3e2f3 100644 --- a/R/task-create.R +++ b/R/task-create.R @@ -542,7 +542,7 @@ task_export_envvars <- function(root, dst, envvars, inherit_envvars) { envvars_export(envvars, dst) } else { src <- file.path(path_task(root$path$tasks, inherit_envvars), RENVIRON) - lines <- NULL + lines <- character(0) if (fs::file_exists(src)) { lines <- readLines(src) }