-
Notifications
You must be signed in to change notification settings - Fork 59
95 lines (80 loc) · 3.81 KB
/
Copy pathrstan.yaml
File metadata and controls
95 lines (80 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Build rstan from source against this branch's RcppParallel.
#
# The 'downstream' job in R-CMD-check.yaml is a stand-in for this: it compiles a
# small translation unit using the two TBB APIs StanHeaders needs. That catches
# the breakage this workflow exists to rule out, in seconds rather than the best
# part of an hour -- so this is deliberately manual, for when the real thing is
# worth waiting for (before a release, or after touching the Windows TBB setup).
on:
workflow_dispatch:
inputs:
r-version:
description: "R version (4.2 uses Rtools42, which has no oneTBB)"
required: true
default: "4.2"
os:
description: "Runner to build on"
required: true
default: "windows-latest"
type: choice
options:
- windows-latest
- macOS-latest
- ubuntu-latest
fit-model:
description: "Also compile and fit a tiny Stan model (slow)"
required: false
default: false
type: boolean
name: rstan
jobs:
rstan:
runs-on: ${{ inputs.os }}
name: rstan (${{ inputs.os }}, R ${{ inputs.r-version }})
# building rstan from source is slow, and slower still on Windows
timeout-minutes: 120
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
VERBOSE: 1
# rstan's own guidance for building it from source
MAKEFLAGS: -j2
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ inputs.r-version }}
use-public-rspm: true
- name: install RcppParallel from this branch
run: R CMD INSTALL --preclean .
- name: report how RcppParallel resolved TBB
run: Rscript .github/scripts/report-tbb-config.R
# binaries are fine for everything except rstan and StanHeaders, which are
# the packages that actually consume RcppParallel's flags. this is
# rstan's Imports plus its LinkingTo, minus RcppParallel (installed above)
# and StanHeaders (built from source below)
# NOTE: a bare 'Rscript' has no repository configured -- setup-r arranges
# that only for the steps it wraps -- so name one explicitly here and in
# every install.packages() call below
- name: install rstan's dependencies
run: |
Rscript -e 'options(repos = c(CRAN = Sys.getenv("RSPM", unset = "https://cloud.r-project.org"))); install.packages(c("Rcpp","RcppEigen","BH","inline","gridExtra","loo","pkgbuild","QuickJSR","ggplot2"))'
# dependencies = FALSE so that resolving StanHeaders/rstan can't quietly
# pull CRAN's RcppParallel over the one we just built -- that would turn
# this into a test of the released package instead
- name: install StanHeaders and rstan from source
run: |
Rscript -e 'options(repos = c(CRAN = Sys.getenv("RSPM", unset = "https://cloud.r-project.org"))); install.packages(c("StanHeaders","rstan"), type = "source", dependencies = FALSE, INSTALL_opts = "--no-multiarch")'
# compare against this checkout's DESCRIPTION rather than looking for a
# '.9000' suffix, so this keeps working across development version bumps
- name: check RcppParallel is still the one we built
run: |
Rscript -e 'installed <- packageVersion("RcppParallel"); expected <- package_version(read.dcf("DESCRIPTION")[1L, "Version"]); writeLines(sprintf("RcppParallel %s (expected %s)", installed, expected)); if (installed != expected) stop("RcppParallel was replaced by a different build; the rstan build did not test this branch")'
- name: load rstan
run: |
Rscript -e 'library(rstan); print(rstan::stan_version())'
- name: compile and fit a tiny model
if: ${{ inputs.fit-model }}
run: Rscript .github/scripts/rstan-fit-check.R