Skip to content

Commit 2ba2207

Browse files
committed
See if testing works on all OS
1 parent b451e86 commit 2ba2207

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ jobs:
4444
extra-packages: any::rcmdcheck
4545
needs: check
4646

47+
- name: Setup .Renviron for testing
48+
run: |
49+
echo OPENMPP_LOCAL_URL=http://localhost:4040 >> ~/.Renviron
50+
shell: bash
51+
4752
- uses: r-lib/actions/check-r-package@v2
4853
with:
49-
args: 'c("--no-manual", "--as-cran", "--no-tests")'
54+
args: 'c("--no-manual", "--as-cran")'
5055
upload-snapshots: true

tests/testthat/helper-oms.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
local_initiate_oms <- function(path) {
2+
cmd <- if (Sys.info()['sysname'] == 'Windows') './bin/oms.exe' else './bin/oms'
23
pid <-
34
withr::with_dir(
45
new = path,
5-
code = sys::exec_background(cmd = './bin/oms', std_out = FALSE)
6+
code = sys::exec_background(cmd = cmd, std_out = FALSE)
67
)
78
Sys.sleep(0.5)
89
withr::defer_parent(tools::pskill(pid))

tests/testthat/setup.R

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
local_install_openmpp <- function() {
2-
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_arm64_20241226.tar.gz'
2+
info <- Sys.info()
3+
os <- info['sysname']
4+
type <- info['machine']
5+
6+
if (os == 'Darwin' & type == 'arm64') {
7+
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_arm64_20241226.tar.gz'
8+
} else if (os == 'Darwin' & type == 'intel') {
9+
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_x86_64_20241226.tar.gz'
10+
} else if (os == 'Linux') {
11+
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_debian_20241226.tar.gz'
12+
} else if (os == 'Windows') {
13+
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_win_20241226.zip'
14+
} else {
15+
rlang::abort('No compatible OS detected.')
16+
}
317
file <- basename(url)
418
dir <- tempdir()
519
path <- paste0(dir, '/', file)
620
download.file(url, path, quiet = TRUE)
7-
untar(path, exdir = dir)
21+
22+
if (os == 'Windows') {
23+
unzip(path, exdir = dir)
24+
} else {
25+
untar(path, exdir = dir)
26+
}
27+
828
unlink(path)
929
new_path <- tools::file_path_sans_ext(path, compression = TRUE)
1030
new_path

0 commit comments

Comments
 (0)