-
-
Notifications
You must be signed in to change notification settings - Fork 93
246 lines (221 loc) · 7.44 KB
/
tarball.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: CmdStan tarball builder
'on':
workflow_dispatch:
inputs:
tarball_name:
description: 'CmdStan build name'
required: true
default: ''
cmdstan_repo:
description: 'CmdStan repo'
required: true
default: 'stan-dev/cmdstan'
cmdstan_branch:
description: 'CmdStan branch'
required: true
default: 'develop'
stan_repo:
description: 'Stan repo'
required: true
default: 'stan-dev/stan'
stan_branch:
description: 'Stan branch'
required: true
default: 'develop'
math_repo:
description: 'Math repo'
required: true
default: 'stan-dev/math'
math_branch:
description: 'Math branch'
required: true
default: 'develop'
stanc3_repo:
description: 'Stanc3 repo'
required: true
default: 'stan-dev/stanc3'
stanc3_branch:
description: 'Stanc3 branch'
required: true
default: 'master'
jobs:
linux:
runs-on: ubuntu-20.04
container:
image: ocaml/opam2:alpine-3.9-ocaml-4.07
options: --user root
steps:
- name: Checkout stanc3
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.stanc3_repo }}
ref: ${{ github.event.inputs.stanc3_branch }}
- name: opam caching
id: opam-cache
uses: actions/cache@v2
with:
path: "~/.opam"
key: linux-stanc-binary-4.12.0
- name: Install dependencies
run: |
opam init --disable-sandboxing -y
opam switch 4.12.0 || opam switch create 4.12.0
eval $(opam env)
opam repo add internet https://opam.ocaml.org
opam update
bash -x scripts/install_build_deps.sh
- name: Build static Linux binaries
run: |
eval $(opam env)
dune subst
dune build @install --profile static
mv _build/default/src/stanc/stanc.exe ${{ github.job }}-stanc
- name: Upload Linux stanc
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}-stanc
path: ${{ github.job }}-stanc
windows:
runs-on: ubuntu-20.04
container:
image: ubuntu:bionic
options: --user root
steps:
- name: Checkout stanc3
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.stanc3_repo }}
ref: ${{ github.event.inputs.stanc3_branch }}
- name: opam caching
id: opam-cache
uses: actions/cache@v2
with:
path: "~/.opam"
key: windows-stanc-binary-4.12.0
- name: Install dependencies
run: |
apt-get update -qq
apt-get install -y --no-install-recommends ca-certificates rsync git build-essential m4 sudo \
unzip pkg-config libpcre3-dev mingw-w64 gcc wget gawk bubblewrap
wget https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux
sudo install opam-2.0.4-x86_64-linux /usr/local/bin/opam
opam init $1 --disable-sandboxing -y
eval $(opam env)
opam switch stanc || opam switch create stanc ocaml-base-compiler.4.12.0
eval $(opam env)
bash -x scripts/install_build_deps_windows.sh
eval $(opam env)
opam pin -y js_of_ocaml-ppx 3.11.0
opam install -y js_of_ocaml-ppx
- name: Build Windows binaries
run: |
eval $(opam env)
dune subst
dune build -x windows
mv _build/default.windows/src/stanc/stanc.exe ${{ github.job }}-stanc
- name: Upload Windows stanc
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}-stanc
path: ${{ github.job }}-stanc
mac:
runs-on: macOS-latest
steps:
- name: Checkout stanc3
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.stanc3_repo }}
ref: ${{ github.event.inputs.stanc3_branch }}
- name: opam caching
id: opam-cache
uses: actions/cache@v2
with:
path: "~/.opam"
key: macOS-stanc-binary-4.12.0
- name: Install dependencies
run: |
brew install gpatch
brew install opam
opam init --disable-sandboxing -y
eval $(opam env)
opam switch 4.12.0 || opam switch create 4.12.0
eval $(opam env)
bash -x scripts/install_build_deps.sh
- name: Build MacOS binaries
run: |
eval $(opam env)
dune subst
dune build @install
mv _build/default/src/stanc/stanc.exe ${{ github.job }}-stanc
- name: Upload MacOS binaries
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}-stanc
path: ${{ github.job }}-stanc
build:
needs: [linux, windows, mac]
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.cmdstan_repo }}
ref: ${{ github.event.inputs.cmdstan_branch }}
path: cmdstan
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.stan_repo }}
ref: ${{ github.event.inputs.stan_branch }}
path: cmdstan/stan
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.math_repo }}
ref: ${{ github.event.inputs.math_branch }}
path: cmdstan/stan/lib/stan_math
- name: Building
run: |
cd cmdstan
make build
make clean-all
- name: install git-archive-all
run: |
pip install git-archive-all
- name: Package tarball part 1
run: |
cd cmdstan
git-archive-all cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz
mv cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz ../cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz
cd ..
mkdir cmdstan-${{ github.event.inputs.tarball_name }}
tar -xvzf cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz
- name: Download MacOS binaries
uses: actions/download-artifact@v2
with:
name: mac-stanc
path: bins/mac-stanc
- name: Download Linux binaries
uses: actions/download-artifact@v2
with:
name: linux-stanc
path: bins/linux-stanc
- name: Download Windows binaries
uses: actions/download-artifact@v2
with:
name: windows-stanc
path: bins/windows-stanc
- name: Package tarball part 2
run: |
mkdir cmdstan-${{ github.event.inputs.tarball_name }}/bin
mv bins/linux-stanc/linux-stanc cmdstan-${{ github.event.inputs.tarball_name }}/bin/linux-stanc
mv bins/windows-stanc/windows-stanc cmdstan-${{ github.event.inputs.tarball_name }}/bin/windows-stanc
mv bins/mac-stanc/mac-stanc cmdstan-${{ github.event.inputs.tarball_name }}/bin/mac-stanc
tar -cvzf cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz cmdstan-${{ github.event.inputs.tarball_name }}
ls -l
- name: Upload tarball
uses: actions/upload-artifact@v2
with:
name: cmdstan-${{ github.event.inputs.tarball_name }}
path: 'cmdstan-${{ github.event.inputs.tarball_name }}.tar.gz'