Skip to content

Commit

Permalink
Use rstantools for setup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jun 5, 2024
1 parent 5d28f13 commit 09ff2e8
Show file tree
Hide file tree
Showing 74 changed files with 46 additions and 267 deletions.
53 changes: 17 additions & 36 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- use-rstantools
pull_request:
branches:
- master
Expand All @@ -20,55 +21,35 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'devel', rstan: 'CRAN'}
- {os: macOS-latest, r: 'release', rstan: 'CRAN'}
- {os: windows-latest, r: 'devel', rstan: 'CRAN'}
- {os: windows-latest, r: 'release', rstan: 'CRAN'}
- {os: ubuntu-latest, r: 'devel', rstan: 'CRAN'}
- {os: ubuntu-latest, r: 'release', rstan: 'CRAN'}
- {os: ubuntu-latest, r: 'oldrel', rstan: 'CRAN'}

- {os: macOS-latest, r: 'release', rstan: 'Preview'}
- {os: windows-latest, r: 'release', rstan: 'Preview'}
- { os: macOS-latest, r: 'devel' }
- { os: macOS-latest, r: 'release' }
- { os: macOS-latest, r: 'oldrel' }
- { os: windows-latest, r: 'devel' }
- { os: windows-latest, r: 'release' }
- { os: windows-latest, r: 'oldrel' }
- { os: ubuntu-latest, r: 'devel' }
- { os: ubuntu-latest, r: 'release' }
- { os: ubuntu-latest, r: 'oldrel' }
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
TESTTHAT_CPUS: 4

steps:
- uses: n1hility/cancel-previous-runs@v2
- uses: n1hility/cancel-previous-runs@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: R-CMD-check.yaml
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"

- uses: actions/checkout@v3
- uses: actions/checkout@main

- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r@v2-branch
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r-dependencies@v2
- uses: r-lib/actions/setup-pandoc@v2-branch
- uses: r-lib/actions/setup-r-dependencies@v2-branch
with:
cache-version: 2
extra-packages: any::rcmdcheck any::betareg any::HSAUR3 any::biglm any::gamm4 any::V8

- name: Install RStan Preview if Needed
run: |
if ("${{ matrix.config.rstan }}" == "Preview") {
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
}
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--ignore-vignettes")'
build_args: '"--no-build-vignettes"'

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
- uses: r-lib/actions/check-r-package@v2-branch
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ vignettes/*.html
vignettes/*_files
.DS_Store
revdep/*
*.o
*.cc
*.h
src/Makevars
R/stanmodels.R
37 changes: 0 additions & 37 deletions R/stanmodels.R

This file was deleted.

5 changes: 0 additions & 5 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

.onLoad <- function(libname, pkgname) {
modules <- paste0("stan_fit4", names(stanmodels), "_mod")
for (m in modules) loadModule(m, what = TRUE)
}

.onAttach <- function(...) {
ver <- utils::packageVersion("rstanarm")
packageStartupMessage("This is rstanarm version ", ver)
Expand Down
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/sh
"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()"
62 changes: 0 additions & 62 deletions configure.ac

This file was deleted.

2 changes: 2 additions & 0 deletions configure.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/sh
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()"
File renamed without changes.
4 changes: 2 additions & 2 deletions src/stan_files/bernoulli.stan → inst/stan/bernoulli.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for a Bernoulli outcome
functions {
Expand Down
4 changes: 2 additions & 2 deletions src/stan_files/binomial.stan → inst/stan/binomial.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for a binomial outcome
functions {
Expand Down
4 changes: 2 additions & 2 deletions src/stan_files/continuous.stan → inst/stan/continuous.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for a Gaussian, Gamma, inverse Gaussian, or Beta outcome
functions {
Expand Down
4 changes: 2 additions & 2 deletions src/stan_files/count.stan → inst/stan/count.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for a count outcome
functions {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/stan_files/jm.stan → inst/stan/jm.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include /pre/Columbia_copyright.stan
#include /pre/Brilleman_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/Brilleman_copyright.stan
#include /include/license.stan

// Shared parameter joint model
functions {
Expand Down
4 changes: 2 additions & 2 deletions src/stan_files/lm.stan → inst/stan/lm.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for a Gaussian outcome with no link function
functions {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/stan_files/mvmer.stan → inst/stan/mvmer.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include /pre/Columbia_copyright.stan
#include /pre/Brilleman_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/Brilleman_copyright.stan
#include /include/license.stan

// Multivariate GLM with correlated group-specific terms
functions {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/stan_files/polr.stan → inst/stan/polr.stan
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include /pre/Columbia_copyright.stan
#include /pre/license.stan
#include /include/Columbia_copyright.stan
#include /include/license.stan

// GLM for an ordinal outcome with coherent priors
functions {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions src/Makevars

This file was deleted.

31 changes: 0 additions & 31 deletions src/Makevars.win

This file was deleted.

3 changes: 0 additions & 3 deletions src/rstanarm-win.def

This file was deleted.

1 change: 0 additions & 1 deletion tests/testthat/include

This file was deleted.

1 change: 0 additions & 1 deletion tests/testthat/stan_files

This file was deleted.

4 changes: 2 additions & 2 deletions tests/testthat/test_stan_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
Sys.setenv(USE_CXX17 = 1)
set.seed(12345)

MODELS_HOME <- "stan_files"
INCLUDE_DIR <- "include"
MODELS_HOME <- system.file("stan", package = "rstanarm", mustWork = TRUE)
INCLUDE_DIR <- system.file("include", package = "rstanarm", mustWork = TRUE)

context("setup")
test_that("Stan programs are available", {
Expand Down
Loading

0 comments on commit 09ff2e8

Please sign in to comment.