Skip to content

Commit b07ee57

Browse files
authored
Merge pull request #72 from pythonhealthdatascience/dev
Dev
2 parents 73b5b8f + bd17241 commit b07ee57

File tree

2 files changed

+51
-6
lines changed

2 files changed

+51
-6
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
34
on:
45
push:
56
branches: [main]
67
workflow_dispatch:
8+
inputs:
9+
os_choice:
10+
description: 'Operating system to run on'
11+
required: true
12+
default: 'all'
13+
type: choice
14+
options:
15+
- all
16+
- ubuntu
17+
- macos
18+
- windows
719

820
name: R-CMD-check.yaml
921

1022
permissions: read-all
1123

1224
jobs:
25+
setup-matrix:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
matrix: ${{ steps.setup-matrix.outputs.matrix }}
29+
steps:
30+
- id: setup-matrix
31+
run: |
32+
if [[ "${{ github.event_name }}" == "push" || "${{ github.event.inputs.os_choice }}" == "all" ]]; then
33+
echo 'matrix={"config":[{"os":"macos-latest","r":"release"},{"os":"windows-latest","r":"release"},{"os":"ubuntu-latest","r":"release"}]}' >> $GITHUB_OUTPUT
34+
elif [[ "${{ github.event.inputs.os_choice }}" == "ubuntu" ]]; then
35+
echo 'matrix={"config":[{"os":"ubuntu-latest","r":"release"}]}' >> $GITHUB_OUTPUT
36+
elif [[ "${{ github.event.inputs.os_choice }}" == "macos" ]]; then
37+
echo 'matrix={"config":[{"os":"macos-latest","r":"release"}]}' >> $GITHUB_OUTPUT
38+
elif [[ "${{ github.event.inputs.os_choice }}" == "windows" ]]; then
39+
echo 'matrix={"config":[{"os":"windows-latest","r":"release"}]}' >> $GITHUB_OUTPUT
40+
fi
41+
1342
R-CMD-check:
43+
needs: setup-matrix
1444
runs-on: ${{ matrix.config.os }}
1545

1646
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
1747

1848
strategy:
1949
fail-fast: false
20-
matrix:
21-
config:
22-
- {os: macos-latest, r: 'release'}
23-
- {os: windows-latest, r: 'release'}
24-
- {os: ubuntu-latest, r: 'release'}
50+
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
2551

2652
env:
2753
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

tests/testthat/test-unittest.R

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,26 @@ test_that("parallel processing runs successfully", {
116116
}
117117
mockery::stub(runner, "simulation::model", test_model)
118118
param <- list(cores = 2L, number_of_runs = 5L)
119-
result <- runner(param, use_future_seeding = TRUE)
119+
120+
# Attempt parallel processing
121+
result <- tryCatch({
122+
runner(param, use_future_seeding = TRUE)
123+
}, error = function(e) {
124+
# Check if this is a parallel processing error
125+
if (grepl("Failed to find a functional cluster workers|FutureError",
126+
e$message)) {
127+
# Skip test on macOS if parallel processing fails
128+
if (Sys.info()[["sysname"]] == "Darwin") {
129+
skip(paste("Parallel processing not available on this macOS system",
130+
"- this is expected in CI environments"))
131+
}
132+
# Else throw an error
133+
stop(e, call. = FALSE)
134+
} else {
135+
# Re-throw if it's a different error
136+
stop(e, call. = FALSE)
137+
}
138+
})
120139

121140
# Check if results contain expected structure
122141
expect_true("arrivals" %in% names(result))

0 commit comments

Comments
 (0)