-
-
Notifications
You must be signed in to change notification settings - Fork 269
188 lines (163 loc) · 6.83 KB
/
main.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
# Github Actions workflow to check and build StanHeaders and RStan
# yamllint disable rule:line-length
name: R-CMD-check
'on':
push:
branches:
- develop
- experimental
- StanHeaders_*
pull_request:
branches:
- develop
- experimental
- StanHeaders_*
jobs:
R-CMD-check:
if: "! contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: true
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'oldrel'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'oldrel'}
- {os: ubuntu-20.04, r: 'devel'}
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-20.04, r: 'oldrel'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
options(install.packages.check.source = "no")
options(pkgType = ifelse(grepl("linux", R.version$os), "source", "binary"))
install.packages('remotes')
install.packages('V8')
saveRDS(remotes::dev_package_deps(pkg = "./rstan/rstan", dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('./rstan/rstan/DESCRIPTION'))")
sudo -s eval "$sysreqs"
shell: bash
- name: Install dependencies
run: |
remotes::install_deps(pkg = "./rstan/rstan", dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_cran("rstantools", type = "source")
remotes::install_cran("sessioninfo")
if (utils::packageVersion("sessioninfo") >= "1.2.1") {
sessioninfo::session_info(pkgs = "installed", include_base = TRUE)
} else {
options(width = 200)
sessioninfo::session_info(rownames(installed.packages()), include_base = TRUE)
}
shell: Rscript {0}
- name: Install StanHeaders
run: |
try(system("sh sh_b.sh --no-build-vignettes --no-manual"))
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Verify Math Version
run: |
readLines(system.file("include","stan","math","version.hpp", package="StanHeaders"))
shell: Rscript {0}
- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
if (R.version$major < 4 && isTRUE(.Platform$OS.type == "windows")) {
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
path_makevars <- ifelse(.Platform$OS.type == "windows", "Makevars.win", "Makevars")
M <- file.path(dotR, path_makevars)
if (!file.exists(M)) file.create(M)
cat("\nCXX14FLAGS=-O3",
"CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y",
"CXX11FLAGS=-O3",
file = M, sep = "\n", append = TRUE)
}
rcmdcheck::rcmdcheck(path = "./rstan/rstan", args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Show testthat output
if: always()
run: |
rm -rf check/rstan.Rcheck/rstan check/rstan.Rcheck/*pkg_src
find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
- name: Extract version and check StanHeaders source package
run: |
set -x
echo "STANHEADERS_VERSION=$(grep '^Version' StanHeaders/DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV
echo "RSTAN_VERSION=$(grep '^Version' rstan/rstan/DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV
if [[ ! -f StanHeaders_*.tar.gz ]]; then
sh sh_b.sh --no-build-vignettes --no-manual || true
fi
mkdir -p build || true
cp -v StanHeaders_*.tar.gz build/ || true
ls -R build/
shell: bash
- name: Build RStan source package
if: matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'devel'
run: |
src_rstan <- pkgbuild::build("./rstan/rstan", dest_path = tempdir(), vignettes = FALSE, manual = FALSE)
file.copy(src_rstan, "build")
shell: Rscript {0}
- name: Build binary packages
run: |
bin1 <- pkgbuild::build("./build/StanHeaders_${{ env.STANHEADERS_VERSION }}.tar.gz", dest_path = tempdir(), vignettes = FALSE, manual = FALSE, binary = TRUE)
bin2 <- pkgbuild::build("./rstan/rstan", dest_path = tempdir(), vignettes = FALSE, manual = FALSE, binary = TRUE)
dir.create("build_bin")
file.copy(c(bin1, bin2), "build_bin")
shell: Rscript {0}
- name: Upload StanHeaders source package
if: matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'devel'
uses: actions/upload-artifact@v4
with:
name: StanHeaders_${{ env.STANHEADERS_VERSION }}.tar.gz
path: build/StanHeaders_${{ env.STANHEADERS_VERSION }}.tar.gz
- name: Upload RStan source package
if: matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'devel'
uses: actions/upload-artifact@v4
with:
name: rstan_${{ env.RSTAN_VERSION }}.tar.gz
path: build/rstan_${{ env.RSTAN_VERSION }}.tar.gz
- name: Upload binary packages
uses: actions/upload-artifact@v4
with:
name: R-${{ matrix.config.r }}_${{ matrix.config.os }}
path: build_bin