Skip to content

Commit

Permalink
See if testing works on all OS
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwarkentin committed Jan 8, 2025
1 parent b451e86 commit 2ba2207
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

- name: Setup .Renviron for testing
run: |
echo OPENMPP_LOCAL_URL=http://localhost:4040 >> ~/.Renviron
shell: bash

- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--no-tests")'
args: 'c("--no-manual", "--as-cran")'
upload-snapshots: true
3 changes: 2 additions & 1 deletion tests/testthat/helper-oms.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local_initiate_oms <- function(path) {
cmd <- if (Sys.info()['sysname'] == 'Windows') './bin/oms.exe' else './bin/oms'
pid <-
withr::with_dir(
new = path,
code = sys::exec_background(cmd = './bin/oms', std_out = FALSE)
code = sys::exec_background(cmd = cmd, std_out = FALSE)
)
Sys.sleep(0.5)
withr::defer_parent(tools::pskill(pid))
Expand Down
24 changes: 22 additions & 2 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
local_install_openmpp <- function() {
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_arm64_20241226.tar.gz'
info <- Sys.info()
os <- info['sysname']
type <- info['machine']

if (os == 'Darwin' & type == 'arm64') {
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_arm64_20241226.tar.gz'
} else if (os == 'Darwin' & type == 'intel') {
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_mac_x86_64_20241226.tar.gz'
} else if (os == 'Linux') {
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_debian_20241226.tar.gz'
} else if (os == 'Windows') {
url <- 'https://github.com/openmpp/main/releases/latest/download/openmpp_win_20241226.zip'
} else {
rlang::abort('No compatible OS detected.')
}
file <- basename(url)
dir <- tempdir()
path <- paste0(dir, '/', file)
download.file(url, path, quiet = TRUE)
untar(path, exdir = dir)

if (os == 'Windows') {
unzip(path, exdir = dir)
} else {
untar(path, exdir = dir)
}

unlink(path)
new_path <- tools::file_path_sans_ext(path, compression = TRUE)
new_path
Expand Down

0 comments on commit 2ba2207

Please sign in to comment.