-
-
Notifications
You must be signed in to change notification settings - Fork 1
327 lines (317 loc) · 10.9 KB
/
baboon-build.yml
File metadata and controls
327 lines (317 loc) · 10.9 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
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
name: Baboon Build
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs: {}
permissions:
contents: write
id-token: write
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
# 1) don't forget about os entry in prepare-release
# 2) see : https://github.com/actions/runner-images
include:
- target: linux-amd64
os: ubuntu-latest
runs-on: [ ]
- target: linux-aarch64
os: ubuntu-24.04-arm
runs-on: [ ]
#runs-on: [ "ARM64" ]
#preconfigured: true
#nix-cache-disabled: true
name: build-${{ matrix.target }}
runs-on:
- ${{ matrix.os }}
- ${{ matrix.runs-on }}
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: ${{ matrix.preconfigured != true }}
- name: Check deps and build
if: startsWith(github.ref, 'refs/tags/')
run: nix develop --command mdl --github-actions :build :test
- name: Refresh deps and build
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: nix develop --command mdl --github-actions :flake-refresh :build :test
- name: Validate binary portability (outside Nix)
run: |
chmod +x baboon-compiler/.jvm/target/graalvm-native-image/baboon
echo "=== file ==="
file baboon-compiler/.jvm/target/graalvm-native-image/baboon
echo "=== ldd ==="
ldd baboon-compiler/.jvm/target/graalvm-native-image/baboon 2>&1 || true
echo "=== smoke test ==="
baboon-compiler/.jvm/target/graalvm-native-image/baboon \
--model-dir ./test/conv-test \
:cs --output /tmp/baboon-validate-cs \
:scala --output /tmp/baboon-validate-sc
- uses: actions/upload-artifact@v4
with:
name: baboon-${{ matrix.target }}
path: |
baboon-compiler/.jvm/target/graalvm-native-image/**
build-macos:
strategy:
fail-fast: false
matrix:
# 1) don't forget about os entry in prepare-release
# 2) see : https://github.com/actions/runner-images
include:
- target: macos-amd64-13
os: macos-15-intel
runs-on: [ ]
java-version: '23'
- target: macos-aarch64-14
os: macos-14 # yes, this is aarch64
runs-on: [ ]
java-version: '23'
name: build-${{ matrix.target }}
runs-on:
- ${{ matrix.os }}
- ${{ matrix.runs-on }}
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up GraalVM (Java ${{ matrix.java-version }})
uses: graalvm/setup-graalvm@v1
with:
java-version: '${{ matrix.java-version }}'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'sbt'
native-image-job-reports: true
- name: Set up SBT
uses: sbt/setup-sbt@v1
- name: Set up Dart SDK
uses: dart-lang/setup-dart@v1
- name: Install mudyla
run: pip install git+https://github.com/7mind/mudyla.git
- name: Build (macOS)
run: mdl --github-actions --without-nix :build :test
- name: Validate binary portability
run: |
echo "=== file ==="
file baboon-compiler/.jvm/target/graalvm-native-image/baboon
echo "=== otool -L ==="
otool -L baboon-compiler/.jvm/target/graalvm-native-image/baboon
echo "=== check no nix store references ==="
if otool -L baboon-compiler/.jvm/target/graalvm-native-image/baboon | grep -q /nix/store; then
echo "ERROR: binary has Nix store dependencies"
exit 1
fi
echo "=== smoke test ==="
baboon-compiler/.jvm/target/graalvm-native-image/baboon \
--model-dir ./test/conv-test \
:cs --output /tmp/baboon-validate-cs \
:scala --output /tmp/baboon-validate-sc
- uses: actions/upload-artifact@v4
with:
name: baboon-${{ matrix.target }}
path: |
baboon-compiler/.jvm/target/graalvm-native-image/**
acceptance-tests:
name: acceptance-tests
runs-on:
- ubuntu-latest
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: true
- name: Build baboon binary
run: |
nix develop --ignore-environment \
--keep HOME \
--keep USER \
--keep CI \
--keep GITHUB_ACTIONS \
--command mdl --github-actions :build
- name: Run acceptance tests
run: |
chmod +x baboon-compiler/.jvm/target/graalvm-native-image/baboon
nix develop --ignore-environment \
--keep HOME \
--keep USER \
--keep CI \
--keep GITHUB_ACTIONS \
--command python3 test/acceptance/run_acceptance.py \
--baboon baboon-compiler/.jvm/target/graalvm-native-image/baboon \
--target ./target/acceptance \
--parallelism "$(nproc)"
- name: Run service acceptance tests
run: |
chmod +x baboon-compiler/.jvm/target/graalvm-native-image/baboon
nix develop --ignore-environment \
--keep HOME \
--keep USER \
--keep CI \
--keep GITHUB_ACTIONS \
--command python3 test/acceptance/run_service_acceptance.py \
--baboon baboon-compiler/.jvm/target/graalvm-native-image/baboon \
--target ./target/service-acceptance \
--parallelism "$(nproc)"
- name: Write step summary
if: always()
run: |
if [ -f ./target/acceptance/acceptance-summary.md ]; then
cat ./target/acceptance/acceptance-summary.md >> "$GITHUB_STEP_SUMMARY"
fi
if [ -f ./target/service-acceptance/service-summary.md ]; then
cat ./target/service-acceptance/service-summary.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload acceptance report
uses: actions/upload-artifact@v4
if: always()
with:
name: acceptance-report
path: |
target/acceptance/acceptance-report.html
target/acceptance/acceptance-results.json
target/acceptance/acceptance-summary.md
target/service-acceptance/service-report.html
target/service-acceptance/service-results.json
target/service-acceptance/service-summary.md
validate-flake:
strategy:
fail-fast: false
matrix:
include:
- target: linux-aarch64
os: ubuntu-24.04-arm
runs-on: [ ]
name: check-flake-runs-${{ matrix.target }}
runs-on:
- ${{ matrix.os }}
- ${{ matrix.runs-on }}
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: ${{ matrix.preconfigured != true }}
- name: Check deps and build
run: nix run . -- --model-dir ./test/conv-test :cs --output ./test/conv-test-cs/ConvTest/Generated :scala --output ./test/conv-test-sc/src/main/scala/generated-main
build-windows:
strategy:
fail-fast: false
matrix:
include:
- target: windows-amd64
os: windows-2022
runs-on: [ ]
java-version: '23'
name: build-${{ matrix.target }}
runs-on:
- ${{ matrix.os }}
- ${{ matrix.runs-on }}
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up GraalVM (Java ${{ matrix.java-version }})
uses: graalvm/setup-graalvm@v1
with:
java-version: '${{ matrix.java-version }}'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'sbt'
native-image-job-reports: true
- name: Install rsync
shell: pwsh
run: choco install rsync -y
- name: Set up Dart SDK
uses: dart-lang/setup-dart@v1
- name: Install mudyla
shell: bash
run: pip install git+https://github.com/7mind/mudyla.git
- name: Build (windows)
shell: bash
run: mdl --github-actions --without-nix :build :test
- uses: actions/upload-artifact@v4
with:
name: baboon-${{ matrix.target }}
path: |
baboon-compiler/.jvm/target/graalvm-native-image/**
publish-scala:
runs-on:
- ubuntu-latest
needs:
- build-linux
- build-macos
- build-windows
- validate-flake
steps:
- uses: 7mind/github-env@minimal
with:
setup-nix: true
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: binaries
pattern: baboon-*
- name: Prepare layout
run: nix develop --command mdl --github-actions --mkdist-source=./binaries --mkdist-target=. :build :mkdist
- uses: softprops/action-gh-release@v2
id: create-release
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dist-bin/**
./dist-zip/**
- uses: bitwarden/sm-action@v2
with:
access_token: ${{ secrets.TOKEN_BITWARDEN_SM }}
secrets: |
994f97a2-97a4-4fe1-806a-b1930104435f > SONATYPE_CREDENTIALS_FILE
749f4227-9f11-4ceb-9121-b1930110c3a9 > OPENSSL_KEY
a2fe5b5b-5f3f-47f8-961c-b1930110cea7 > OPENSSL_IV
- name: Build and Publish to Sonatype
env:
SCALA_VERSION: ${{ matrix.scala }}
JAVA_VERSION: ${{ matrix.java }}
SONATYPE_SECRET: .secrets/credentials.sonatype-nexus.properties
run: |
mkdir .secrets
echo "$SONATYPE_CREDENTIALS_FILE" > "$SONATYPE_SECRET"
openssl aes-256-cbc -K ${OPENSSL_KEY} -iv ${OPENSSL_IV} -in secrets.tar.enc -out secrets.tar -d
tar xvf secrets.tar
nix develop --command mdl --github-actions :gen-js :publish-scala
publish-npm:
name: publish-npm
if: startsWith(github.ref, 'refs/tags/')
runs-on:
- ubuntu-24.04-arm
needs:
- build-linux
- build-macos
- build-windows
- validate-flake
env:
CI_BRANCH_TAG: ${{ github.ref_name }}
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}
permissions:
contents: write
id-token: write
steps:
- uses: 7mind/github-env@minimal
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Publish npm package
run: nix develop --command mdl --github-actions :publish-npm