-
Notifications
You must be signed in to change notification settings - Fork 3
349 lines (287 loc) · 9.69 KB
/
release-nightly.yaml
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
name: Nightly build, release and benchmark
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
env:
STACK_VERSION: 2.11.1
permissions:
id-token: write
attestations: write
contents: write
jobs:
build-linux:
name: Build static Linux binary and release
runs-on: ubuntu-latest
container: quay.io/benz0li/ghc-musl:9.8.2
outputs:
tag: ${{ steps.tag.outputs.value }}
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: install stack
run: |
curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64-static.tar.gz -OL
tar xf stack-$STACK_VERSION-linux-x86_64-static.tar.gz
cp stack-$STACK_VERSION-linux-x86_64-static/stack /usr/local/bin
- name: add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Stack permissions bug workaround
run: "chown -R $(id -un):$(id -gn) ~"
# Without this the git command used by githash TemplateHaskell fails with permission error
# https://github.com/anoma/juvix/issues/2294
- name: Git permissions workaround
run: "chown -R $(id -un):$(id -gn) ."
- name: Install cargo
run: apk add --update cargo
- name: Install clang
run: apk add --update clang
- name: Install llvm
run: apk add --update llvm
- name: Runtime build
run: make runtime LIBTOOL=llvm-ar
- name: build Juvix
run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections' --flag juvix:static
- run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
- name: set current date to date.now output variable
id: date
run: echo "now=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: set Juvix version to juvix-version.current output variable
id: juvix-version
run: echo "current=$(juvix --version | head -n 1 | sed -E 's/[^0-9]+(.*)/\1/')" >> $GITHUB_OUTPUT
- name: set tag.value to tag for release
id: tag
run: echo "value=nightly-${{ steps.date.outputs.now }}-${{ steps.juvix-version.outputs.current }}" >> $GITHUB_OUTPUT
- name: create release tar
run: |
cp "${{ env.HOME }}/.local/bin/juvix" /tmp/juvix
cd /tmp
tar zcf juvix-linux-x86_64.tar.gz juvix
- name: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: '/tmp/juvix-linux*'
- name: create draft nightly release and upload artifacts
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag.outputs.value }}
commit: "main"
name: "Nightly Build ${{ steps.date.outputs.now }} ${{ steps.juvix-version.outputs.current }}"
artifacts: /tmp/juvix-linux*
artifactErrorsFailBuild: true
allowUpdates: true
draft: true
build-darwin-x86_64:
runs-on: macos-13
name: Build macOS x86_64 binary
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- name: install stack
run: |
brew install haskell-stack
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS)
run: |
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "LIBTOOL=$(brew --prefix llvm@15)/bin/llvm-ar" >> $GITHUB_ENV
- name: Make runtime
run: |
make CC=$CC LIBTOOL=$LIBTOOL runtime
- name: Stack setup
id: stack
uses: freckle/stack-action@v4
with:
test: false
- name: Install Juvix
run: |
make CC=$CC LIBTOOL=$LIBTOOL install
- run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
- name: create release tar
run: |
tar zcf juvix-darwin-x86_64.tar.gz -C "${{ env.HOME }}/.local/bin" juvix
- name: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: 'juvix-darwin*'
- uses: actions/upload-artifact@v3
with:
name: darwin-x86_64-binary
path: juvix-darwin*
if-no-files-found: error
build-darwin-aarch64:
runs-on: macos-14
name: Build macOS aarch64 binary
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
- name: install stack
run: |
brew install haskell-stack
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS)
run: |
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "LIBTOOL=$(brew --prefix llvm@15)/bin/llvm-ar" >> $GITHUB_ENV
- name: Make runtime
run: |
make CC=$CC LIBTOOL=$LIBTOOL runtime
- name: Stack setup
id: stack
uses: freckle/stack-action@v4
with:
test: false
- name: Install Juvix
run: |
make CC=$CC LIBTOOL=$LIBTOOL install
- run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
- name: create release tar
run: |
tar zcf juvix-darwin-aarch64.tar.gz -C "${{ env.HOME }}/.local/bin" juvix
- name: attest release tar
uses: actions/attest-build-provenance@v1
with:
subject-path: 'juvix-darwin*'
- uses: actions/upload-artifact@v3
with:
name: darwin-aarch64-binary
path: juvix-darwin*
if-no-files-found: error
publish-release:
needs: [build-linux, build-darwin-x86_64, build-darwin-aarch64]
runs-on: ubuntu-latest
name: Publish Release
steps:
- uses: actions/download-artifact@v3
with:
name: darwin-x86_64-binary
path: /tmp
- uses: actions/download-artifact@v3
with:
name: darwin-aarch64-binary
path: /tmp
- name: upload macOS release binary
uses: ncipollo/release-action@v1
with:
tag: ${{needs.build-linux.outputs.tag}}
omitNameDuringUpdate: true
artifactErrorsFailBuild: true
artifacts: /tmp/juvix-darwin*
draft: true
allowUpdates: true
- name: make nightly release latest
uses: ncipollo/release-action@v1
with:
tag: ${{needs.build-linux.outputs.tag}}
omitNameDuringUpdate: true
makeLatest: true
allowUpdates: true
bench:
needs: publish-release
name: Run benchmarks
runs-on: ubuntu-20.04
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
repository: anoma/juvix
ref: main
path: main
- name: checkout nightly repo
uses: actions/checkout@v3
with:
path: nightly-repo
- name: Download latest nightly Juvix binary
uses: jaxxstorm/action-install-gh-release@v1.9.0
with:
repo: anoma/juvix-nightly-builds
cache: enable
rename-to: juvix
chmod: 0755
- name: Setup OCAML
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.13.x
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-global-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}
restore-keys: |
${{ runner.os }}-9.8.2-stack-global-
- uses: actions/cache@v3
name: Cache .stack-work
with:
path: main/.stack-work
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-work-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}-${{ hashFiles('main/**/*.hs') }}
restore-keys: |
${{ runner.os }}-9.8.2-stack-work-
- uses: haskell/actions/setup@v2
name: Setup Haskell
with:
ghc-version: 9.8.2
enable-stack: true
stack-version: 'latest'
- name: Install gnuplot
run: sudo apt install gnuplot
- name: Cache LLVM and Clang (Linux)
id: cache-llvm
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
./llvm
key: ${{ runner.os }}-llvm-13
- name: Install LLVM and Clang (Linux)
uses: KyleMayes/install-llvm-action@v1
with:
version: "13.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Download and extract wasi-sysroot
run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sysroot-15.0.tar.gz -OL
tar xfv wasi-sysroot-15.0.tar.gz
- name: Set WASI_SYSROOT_PATH
run: |
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- name: Setup Juvix runtime
run: |
cd main
make runtime
- name: Run benchmarks
run: |
eval $(opam env)
wasmer --version
juvix --version
ocamlc --version
ocamlopt --version
clang --version
cd main
stack bench --system-ghc
- name: Copy benchmark results
run: cp -r main/.benchmark-results/. nightly-repo/benchmark-results
- uses: EndBug/add-and-commit@v9
with:
message: Add benchmark results
add: benchmark-results/**/*.svg benchmark-results/**/*.csv
cwd: ./nightly-repo