Skip to content

Commit 7a4dce2

Browse files
bschilderclaude
andcommitted
Enable Miniforge in GHA, wrap conda checks in tryCatch
- Add miniforge_variant/miniforge_version to rworkflows so conda binary is available (prevents env_exists from erroring) - Wrap echoconda::env_exists() in tryCatch in all POLYFUN and multifinemap tests so they skip gracefully on CI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5be0af6 commit 7a4dce2

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

.github/workflows/rworkflows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ jobs:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555
run_docker: ${{ true }}
5656
docker_registry: ghcr.io
57+
miniforge_variant: Miniforge3
58+
miniforge_version: latest

tests/testthat/test-POLYFUN.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ test_that("POLYFUN_SUSIE works", {
22

33
testthat::skip_if_not_installed("echoconda")
44
testthat::skip_if_not_installed("Ckmeans.1d.dp")
5-
testthat::skip_if_not(
5+
conda_available <- tryCatch(
66
echoconda::env_exists(conda_env = "echoR_mini"),
7-
message = "echoR_mini conda env not available"
7+
error = function(e) FALSE
88
)
9+
testthat::skip_if_not(conda_available,
10+
message = "echoR_mini conda env not available")
911
## PolyFun submodule must be installed
1012
testthat::skip_if_not(
1113
dir.exists(system.file("tools", "polyfun", package = "echofinemap")),
@@ -44,10 +46,12 @@ test_that("POLYFUN_FINEMAP works", {
4446

4547
testthat::skip_if_not_installed("echoconda")
4648
testthat::skip_if_not_installed("Ckmeans.1d.dp")
47-
testthat::skip_if_not(
49+
conda_available <- tryCatch(
4850
echoconda::env_exists(conda_env = "echoR_mini"),
49-
message = "echoR_mini conda env not available"
51+
error = function(e) FALSE
5052
)
53+
testthat::skip_if_not(conda_available,
54+
message = "echoR_mini conda env not available")
5155
testthat::skip_if_not(
5256
dir.exists(system.file("tools", "polyfun", package = "echofinemap")),
5357
message = "PolyFun submodule not installed"

tests/testthat/test-POLYFUN_compute_priors.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
test_that("POLYFUN_compute_priors works", {
22

33
testthat::skip_if_not_installed("echoconda")
4-
testthat::skip_if_not(
4+
conda_available <- tryCatch(
55
echoconda::env_exists(conda_env = "echoR_mini"),
6-
message = "echoR_mini conda env not available"
6+
error = function(e) FALSE
77
)
8+
testthat::skip_if_not(conda_available,
9+
message = "echoR_mini conda env not available")
810
testthat::skip_if_not(
911
dir.exists(system.file("tools", "polyfun", package = "echofinemap")),
1012
message = "PolyFun submodule not installed"

tests/testthat/test-POLYFUN_help.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
test_that("POLYFUN_help works", {
22

33
testthat::skip_if_not_installed("echoconda")
4-
testthat::skip_if_not(
4+
conda_available <- tryCatch(
55
echoconda::env_exists(conda_env = "echoR_mini"),
6-
message = "echoR_mini conda env not available"
6+
error = function(e) FALSE
77
)
8+
testthat::skip_if_not(conda_available,
9+
message = "echoR_mini conda env not available")
810

911
out <- POLYFUN_help()
1012
testthat::expect_true(grepl("PolyFun",out[[2]]))

tests/testthat/test-multifinemap.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ test_that("multifinemap works with POLYFUN_SUSIE", {
135135
testthat::skip_if_not_installed("echoconda")
136136
testthat::skip_if_not_installed("Ckmeans.1d.dp")
137137
testthat::skip_if_offline()
138-
testthat::skip_if_not(
138+
conda_available <- tryCatch(
139139
echoconda::env_exists(conda_env = "echoR_mini"),
140-
message = "echoR_mini conda env not available"
140+
error = function(e) FALSE
141141
)
142+
testthat::skip_if_not(conda_available,
143+
message = "echoR_mini conda env not available")
142144
testthat::skip_if_not(
143145
dir.exists(system.file("tools", "polyfun", package = "echofinemap")),
144146
message = "PolyFun submodule not installed"

0 commit comments

Comments
 (0)