Skip to content

Commit 4304e6b

Browse files
committed
Fix stack_size option bug, add testing workflow
1 parent c6e0c49 commit 4304e6b

File tree

6 files changed

+110
-7
lines changed

6 files changed

+110
-7
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
on:
22
push:
33
branches: [main, master]
4-
pull_request:
5-
branches: [main, master]
64

75
name: R-CMD-check-crossplatform
86

.github/workflows/test-rstan.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
7+
name: RStan stanc
8+
9+
jobs:
10+
rstan-stanc:
11+
runs-on: ${{ matrix.config.os }}
12+
13+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
config:
19+
- {os: macos-latest, r: 'devel'}
20+
21+
- {os: windows-11-arm, r: '4.5.1', extra-pkgs: RcppCore/RcppParallel}
22+
- {os: windows-latest, r: 'devel'}
23+
24+
- {os: ubuntu-24.04-arm, r: 'release'}
25+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
26+
27+
env:
28+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29+
MAKEFLAGS: -j4
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
36+
- uses: r-lib/actions/setup-r@v2
37+
if: matrix.config.os != 'windows-11-arm'
38+
with:
39+
r-version: ${{ matrix.config.r }}
40+
rtools-version: ${{ matrix.config.rtools }}
41+
http-user-agent: ${{ matrix.config.http-user-agent }}
42+
use-public-rspm: true
43+
44+
- name: Install R & RTools (ARM64)
45+
if: matrix.config.os == 'windows-11-arm'
46+
run: |
47+
$url = "https://www.r-project.org/nosvn/winutf8/aarch64/R-4-signed/R-${{ matrix.config.r }}-aarch64.exe"
48+
Invoke-WebRequest `
49+
-Uri https://www.r-project.org/nosvn/winutf8/aarch64/R-4-signed/R-${{ matrix.config.r }}-aarch64.exe `
50+
-OutFile ../R-${{ matrix.config.r }}-aarch64.exe
51+
Start-Process `
52+
-FilePath ../R-${{ matrix.config.r }}-aarch64.exe `
53+
-ArgumentList "/INSTALL /VERYSILENT /SUPPRESSMSGBOXES" -Wait
54+
55+
Invoke-WebRequest `
56+
-Uri https://github.com/r-hub/rtools45/releases/download/latest/rtools45-aarch64.exe `
57+
-OutFile "../rtools45-aarch64.exe"
58+
Start-Process `
59+
-FilePath "../rtools45-aarch64.exe" `
60+
-ArgumentList "/INSTALL /VERYSILENT /SUPPRESSMSGBOXES" -Wait
61+
62+
echo "C:/rtools45-aarch64/usr/bin;C:/rtools45-aarch64/aarch64-w64-mingw32.static.posix/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
63+
echo "C:/Program Files/R-aarch64/R-${{ matrix.config.r }}/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
64+
65+
- name: Install pak on Windows ARM
66+
if: matrix.config.os == 'windows-11-arm'
67+
run: |
68+
libsdir <- file.path(Sys.getenv("TMP"), "Library")
69+
dir.create(libsdir, recursive = TRUE, showWarnings = FALSE)
70+
cat(sprintf("R_LIB_FOR_PAK=%s\n", libsdir), file = Sys.getenv("GITHUB_ENV"), append = TRUE)
71+
cat(sprintf("R_LIBS_USER=%s\n", libsdir), file = Sys.getenv("GITHUB_ENV"), append = TRUE)
72+
install.packages("pak", lib = libsdir,
73+
repos = c("https://r-lib.r-universe.dev", "https://cloud.r-project.org"),
74+
Ncpus = 4);
75+
shell: Rscript {0}
76+
77+
- uses: r-lib/actions/setup-r-dependencies@v2
78+
with:
79+
extra-packages: local::. any::rstan any::rstantools ${{ matrix.config.extra-pkgs }}
80+
pak-version: ${{ matrix.config.os == 'windows-11-arm' && 'none' || 'stable' }}
81+
82+
- name: Get Package sources
83+
run: |
84+
git clone --depth 1 https://github.com/cran/ctsem.git
85+
git clone --depth 1 https://github.com/cran/blavaan.git
86+
87+
- name: Check rstan stanc works with complex packages
88+
run: |
89+
rstantools::rstan_config("ctsem")
90+
rstantools::rstan_config("blavaan")
91+
shell: Rscript {0}
92+
93+
- name: Install development rstan
94+
run: |
95+
pak::repo_add('https://stan-dev.r-universe.dev')
96+
pak::pak('rstan')
97+
shell: Rscript {0}
98+
99+
- name: Check development rstan stanc works
100+
run: |
101+
rstantools::rstan_config("ctsem")
102+
rstantools::rstan_config("blavaan")
103+
shell: Rscript {0}

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: QuickJSR
22
Title: Interface for the 'QuickJS-NG' Lightweight 'JavaScript' Engine
3-
Version: 1.8.0.9000
3+
Version: 1.8.1
44
Authors@R: c(
55
person(c("Andrew", "R."), "Johnson", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0001-7000-8065")),
@@ -23,6 +23,6 @@ Encoding: UTF-8
2323
Language: en-AU
2424
NeedsCompilation: yes
2525
Roxygen: list(markdown = TRUE)
26-
RoxygenNote: 7.3.2
26+
RoxygenNote: 7.3.3
2727
SystemRequirements: GNU make
2828
VignetteBuilder: knitr

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# QuickJSR 1.8.1
2+
* Fix issue where `stack_size` option was ignored in `JSContext$new()`
3+
14
# QuickJSR 1.8.0
25
* Update bundled QuickJS-NG engine to v0.10.1 (see https://github.com/quickjs-ng/quickjs/releases for release notes)
36

inst/include/quickjs_helpers.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ namespace quickjsr {
107107
return NULL;
108108
}
109109

110-
// Workaround for RStan stack overflow until they update
111110
if (stack_size != -1) {
112-
JS_SetMaxStackSize(rt, 0);
111+
JS_SetMaxStackSize(rt, stack_size);
113112
}
114113
js_std_set_worker_new_context_func(JS_NewCustomContext);
115114
js_std_init_handlers(rt);

man/QuickJSR-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)