-
Notifications
You must be signed in to change notification settings - Fork 1
348 lines (308 loc) · 11.5 KB
/
build.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
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
name: Build and Upload JARs
on:
push:
tags:
- '*'
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
release_name: snapshot-linux
os_name: linux-x86_64
- os: windows-2022
release_name: snapshot-windows
os_name: windows-x86_64
- os: macos-15
release_name: snapshot-macos
os_name: macos-aarch64
- os: macos-12
release_name: snapshot-macos-intel
os_name: macos-x86_64
env:
SCALA_VERSION: '3.5.2'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
working-directory: ./
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
if: runner.os != 'Windows'
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 23
cache: ''
- name: Choco install pnpm on windows
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install pnpm
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
if: runner.os != 'Linux' || true
with:
java-version: '23'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: GraalVM Env - G1GC - Linux
if: runner.os == 'Linux'
shell: bash
run: |
echo "NATIVE_IMAGE_OPTIONS=--gc=G1" >> $GITHUB_ENV
- name: GraalVM Env - -march=native - mac
if: runner.os == 'macOS'
shell: bash
run: |
echo "NATIVE_IMAGE_OPTIONS=-march=native" >> $GITHUB_ENV
- name: GraalVM - Linux - musl - disabled
uses: graalvm/setup-graalvm@v1
if: runner.os == 'Linux' && false
with:
native-image-musl: 'true'
java-version: '23'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: GraalVM Env - Linux - musl - disabled
if: runner.os == 'Linux' && false
shell: bash
run: |
echo "NATIVE_IMAGE_OPTIONS=--static --libc=musl" >> $GITHUB_ENV
- name: GraalVM Env
shell: bash
run: |
echo "NATIVE_IMAGE_INSTALLED=true" >> $GITHUB_ENV
echo "GRAALVM_INSTALLED=true" >> $GITHUB_ENV
- uses: sbt/setup-sbt@v1
- name: Cache SBT (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.sbt
~/.coursier
~/.cache/coursier
key: ${{ matrix.os }}-sbt-${{ hashFiles('**/*.sbt') }}
restore-keys: |
${{ matrix.os }}-sbt-
- name: Cache SBT for Windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
C:\Users\runneradmin\.ivy2\cache
C:\Users\runneradmin\.sbt
C:\Users\runneradmin\.coursier
C:\Users\runneradmin\AppData\Local\Coursier\cache
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
restore-keys: |
${{ runner.os }}-sbt-
- name: Build CLI JAR with SBT
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 2
command: sbt cli/assembly
- name: Build LSP JAR with SBT
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 2
command: sbt lsp/assembly
- name: Build CLI Native Executable
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 2
command: sbt cliNative/nativeLink
- name: Rename CLI Native Executable
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/cli-out.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe
else
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/cli-out cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out
fi
- name: Generate JS Artifacts for CLI
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 2
shell: bash
command: |
sbt cliJS/fullLinkJS
mv cli/js/target/scala-${{ env.SCALA_VERSION }}/cli-opt/main.js cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
- name: Build Native Image for LSP
uses: nick-fields/retry@v3
with:
timeout_minutes: 50
max_attempts: 2
command: sbt lsp/nativeImage
- name: Build Native Image for CLI
uses: nick-fields/retry@v3
with:
timeout_minutes: 50
max_attempts: 2
command: sbt cli/nativeImage
- name: Test Native Image for CLI integrity
shell: bash
run: ./target/chester integrity
- name: List files for debugging
shell: bash
run: find . -type f -name "*.jar" -or -name "chester" -or -name "chester-lsp" -or -name "chester-out" -or -name "*.exe"
continue-on-error: true
- name: Install Node.js dependencies
working-directory: vscode
run: pnpm install
- name: Build VSCode Extension
working-directory: vscode
run: pnpm run package
- name: Upload Unix Artifacts
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.release_name }}
path: |
./target/chester.jar
./target/chester-lsp.jar
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
./target/chester
./target/chester-lsp
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out
./vscode/chester-language-support-*.vsix
- name: Upload Windows Artifacts
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.release_name }}
path: |
./target/chester.jar
./target/chester-lsp.jar
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
./target/chester.exe
./target/chester-lsp.exe
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe
./vscode/chester-language-support-*.vsix
- name: Create or Update GitHub Release for Unix
if: runner.os != 'Windows'
uses: ncipollo/release-action@v1
with:
tag: ${{ matrix.release_name }}
name: ${{ matrix.release_name }}
allowUpdates: true
prerelease: true
artifacts: |
./target/chester.jar,
./target/chester-lsp.jar,
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
./target/chester,
./target/chester-lsp,
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out,
./vscode/chester-language-support-*.vsix
- name: Create or Update GitHub Release for Windows
if: runner.os == 'Windows'
uses: ncipollo/release-action@v1
with:
tag: ${{ matrix.release_name }}
name: ${{ matrix.release_name }}
allowUpdates: true
prerelease: true
artifacts: |
./target/chester.jar,
./target/chester-lsp.jar,
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
./target/chester.exe,
./target/chester-lsp.exe,
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe,
./vscode/chester-language-support-*.vsix
# Add OS name to artifacts and create archives (Unix)
- name: Add OS name to artifacts and create tar.gz (Unix)
shell: bash
if: runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/')
run: |
# Rename artifacts with OS name
cp ./target/chester ./target/chester-${{ matrix.os_name }}
cp ./target/chester-lsp ./target/chester-lsp-${{ matrix.os_name }}
cp ./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out ./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out-${{ matrix.os_name }}
# Create tar.gz archive
tar -czvf chester-${{ matrix.os_name }}.tar.gz \
-C ./target chester chester-lsp
# Generate checksum for the tar.gz file
shasum -a 256 chester-${{ matrix.os_name }}.tar.gz > chester-${{ matrix.os_name }}.tar.gz.sha256
# Add OS name to artifacts and create archives (Windows)
- name: Add OS name to artifacts and create zip (Windows)
shell: pwsh
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
run: |
# Rename artifacts with OS name
cp .\target\chester.exe .\target\chester-${{ matrix.os_name }}.exe
cp .\target\chester-lsp.exe .\target\chester-lsp-${{ matrix.os_name }}.exe
cp .\cli\native\target\scala-${{ env.SCALA_VERSION }}\chester-out.exe .\cli\native\target\scala-${{ env.SCALA_VERSION }}\chester-out-${{ matrix.os_name }}.exe
# Create zip archive
Compress-Archive -Path `
.\target\chester.exe,`
.\target\chester-lsp.exe `
-DestinationPath chester-${{ matrix.os_name }}.zip
# generating checksum using Git Bash
- name: Generate checksum for Windows zip
shell: bash
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
run: |
sha256sum chester-${{ matrix.os_name }}.zip > chester-${{ matrix.os_name }}.zip.sha256
# Create or Update Releases when a tag is pushed
- name: Create or Update GitHub Release Tag for Unix
if: runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: ${{ github.ref_name }}
allowUpdates: true
prerelease: false
artifacts: |
./target/chester.jar,
./target/chester-lsp.jar,
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
./target/chester-${{ matrix.os_name }},
./target/chester-lsp-${{ matrix.os_name }},
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out-${{ matrix.os_name }},
./vscode/chester-language-support-*.vsix,
./chester-${{ matrix.os_name }}.tar.gz,
./chester-${{ matrix.os_name }}.tar.gz.sha256
- name: Create or Update GitHub Release Tag for Windows
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: ${{ github.ref_name }}
allowUpdates: true
prerelease: false
artifacts: |
./target/chester.jar,
./target/chester-lsp.jar,
./cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
./target/chester-${{ matrix.os_name }}.exe,
./target/chester-lsp-${{ matrix.os_name }}.exe,
./cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out-${{ matrix.os_name }}.exe,
./vscode/chester-language-support-*.vsix,
./chester-${{ matrix.os_name }}.zip,
./chester-${{ matrix.os_name }}.zip.sha256
- name: Run Tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 3
command: sbt testAll