-
-
Notifications
You must be signed in to change notification settings - Fork 47
187 lines (148 loc) · 4.9 KB
/
binaries.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
name: Build binaries
on:
workflow_dispatch: {}
env:
OCAML_VERSION: 4.14.1
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
sdk: ""
profile: static
name: ubuntu
- os: macos-13
sdk: "10.11"
profile: release
name: macos-x86_64
- os: macos-latest
sdk: "11.0"
profile: release
name: macos-arm64
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.name }} stanc
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download older SDK
if: matrix.sdk != ''
run: |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${{matrix.sdk}}.sdk.tar.xz
tar -xvf MacOSX${{matrix.sdk}}.sdk.tar.xz
sudo mv MacOSX${{matrix.sdk}}.sdk /Library/Developer/CommandLineTools/SDKs
echo "MACOSX_DEPLOYMENT_TARGET=${{matrix.sdk}}" >> $GITHUB_ENV
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX${{matrix.sdk}}.sdk/" >> $GITHUB_ENV
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: ${{ matrix.name != 'macos-x86_64' }}
- if: matrix.name == 'macos-x86_64'
run: opam pin -y dune 3.6.0 --no-action
- run: bash -x scripts/install_build_deps.sh
- name: Build ${{ matrix.name }}
run: opam exec -- dune subst; opam exec -- dune build --profile ${{ matrix.profile }}
- run: mv _build/default/src/stanc/stanc.exe ${{ matrix.name }}-stanc
- name: Upload ${{ matrix.name }} stanc
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-stanc
path: ${{ matrix.name }}-stanc
build-universal:
needs: build
runs-on: macos-latest
name: Build MacOS universal stanc
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Run lipo
run: |
ls
lipo -create -output macos-stanc macos-*-stanc
lipo -archs macos-stanc
- name: Upload macos-stanc
uses: actions/upload-artifact@v4
with:
name: macos-stanc
path: macos-stanc
xbuild-windows:
runs-on: ubuntu-latest
name: Build Windows stanc (cross-compiler)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install cross-compiler
run: sudo apt-get update; sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
cache-prefix: v1-windows
dune-cache: true
ocaml-compiler: ocaml-windows64.${{ env.OCAML_VERSION }}
opam-repositories: |
windows: http://github.com/ocaml-cross/opam-cross-windows.git
default: https://github.com/ocaml/opam-repository.git
- run: bash -x scripts/install_build_deps_windows.sh
- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -x windows
- run: mv _build/default.windows/src/stanc/stanc.exe windows-stanc
- name: Upload Windows stanc
uses: actions/upload-artifact@v4
with:
name: windows-stanc
path: windows-stanc
build-js:
runs-on: ubuntu-latest
name: Build stanc.js
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: true
cache-prefix: v1-js
- run: bash -x scripts/install_build_deps.sh
- run: bash -x scripts/install_js_deps.sh
- run: opam exec -- dune build --profile release src/stancjs
- run: mv _build/default/src/stancjs/stancjs.bc.js stanc.js
- name: Upload stanc.js
uses: actions/upload-artifact@v4
with:
name: stanc.js
path: stanc.js
test-builds:
needs: [build, build-universal, xbuild-windows]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: ubuntu
- os: macos-latest
name: macos
- os: macos-13
name: macos
- os: windows-latest
name: windows
runs-on: ${{ matrix.os }}
name: Test built stanc on ${{ matrix.os }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.name }}-stanc
- name: Update permissions
if: matrix.name != 'windows'
run: chmod +x ${{ matrix.name }}-stanc
- name: Run tests
run: |
mv ${{ matrix.name }}-stanc stanc.exe
./stanc.exe --help