Skip to content

Commit 12d903b

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 test-get_LD and test-get_MAF_UKB so tests skip gracefully when conda env is absent Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 67e192c commit 12d903b

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.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-get_LD.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ test_that("get_LD works", {
5353

5454
#### UK Biobank ####
5555
## Requires polyfun conda env with pandas
56-
if(echoconda::env_exists(conda_env = "echoR_mini")){
56+
conda_available <- tryCatch(
57+
echoconda::env_exists(conda_env = "echoR_mini"),
58+
error = function(e) FALSE
59+
)
60+
if(conda_available){
5761
query_dat_ukb <- data.table::data.table(CHR=10,POS=c(135000001,135001001),
5862
SNP=c( "rs1234_FAKE"))
5963
LD_ukb <- echoLD::get_LD(locus_dir = locus_dir,

tests/testthat/test-get_MAF_UKB.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
test_that("get_MAF_UKB works", {
22

3-
testthat::skip_if_not(
4-
echoconda::env_exists(conda_env = "echoR_mini"),
5-
message = "echoR_mini conda env not available"
3+
conda_available <- tryCatch(
4+
echoconda::env_exists(conda_env = "echoR_mini"),
5+
error = function(e) FALSE
66
)
7+
testthat::skip_if_not(conda_available,
8+
message = "echoR_mini conda env not available")
79
query_dat<- echodata::BST1
810
query_dat$MAF <- NULL
911
run_tests <- function(query_dat, query_dat2){

0 commit comments

Comments
 (0)