forked from eclipse-che4z/che-che4z-lsp-for-hlasm
-
Notifications
You must be signed in to change notification settings - Fork 1
532 lines (512 loc) · 18.8 KB
/
CI.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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
#
# Copyright (c) 2019 Broadcom.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Broadcom, Inc. - initial API and implementation
#
name: CI
on:
push:
branches:
- master
- development
- release-next
- ci_other_arms
pull_request:
branches:
- master
- development
workflow_dispatch:
env:
CLIENT_DIR: clients/vscode-hlasmplugin
defaults:
run:
shell: sh
jobs:
formal-checks:
name: Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run clang-format
run: clang-format-14 -style=file -n $(find . -name \*.h -print -o -name \*.cpp -print) 2>&1 | tee clang-format-output.txt
- name: Check format
run: |
if [ -s clang-format-output.txt ]
then
exit 1
fi
- name: Check license headers
run: cmake/check_license.sh
- name: PR to master is allowed only from a release branch
if: github.event_name == 'pull_request' && github.base_ref == 'master' && github.head_ref != 'release-next'
run: exit 1
release-info:
name: Update version and changelogs
runs-on: ubuntu-22.04
permissions:
contents: write
issues: write
pull-requests: write
needs: [formal-checks]
steps:
- uses: actions/checkout@v4
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
- name: Get release context
if: ${{ !(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release-next') }}
run: |
git fetch --filter=tree:0 --unshallow origin HEAD
git fetch --tags --filter=tree:0 `node -e 'console.log(require("./clients/vscode-hlasmplugin/package.json").repository.url)'` master:master
- name: Name PR merge commit
if: github.event.pull_request
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
[ -z "$TITLE" ] || git commit --amend -m "$TITLE"
git checkout -b $GITHUB_REF
env:
TITLE: ${{ github.event.pull_request.title }}
- name: Update version
run: npx semantic-release --dry-run
working-directory: ${{ env.CLIENT_DIR }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HLASM_ALPHA_BUILD: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release-next') && '0' || '1' }}
- name: Upload Release Info
uses: actions/upload-artifact@v4
with:
name: release-info
path: |
CHANGELOG.md
${{ env.CLIENT_DIR }}/package.json
${{ env.CLIENT_DIR }}/CHANGELOG.md
generate_grammar:
name: Generate grammar
runs-on: ubuntu-22.04
needs: [formal-checks]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache
with:
path: build/generated_parser
key: ${{ hashFiles('**/CMakeLists.txt', 'cmake/**', 'parser_library/src/parsing/grammar/**') }}
- name: Set up JDK 11
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Generate grammar
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir build && cd build
cmake -DBUILD_VSIX=Off -DBUILD_TESTING=Off ../
cmake --build . --target generate_grammar
- name: Upload generated files
uses: actions/upload-artifact@v4
with:
name: grammar
path: build/generated_parser/hlasmparser_*.*
sanitizer-builds:
name: Build with sanitizers
runs-on: ubuntu-22.04
needs: [generate_grammar]
strategy:
matrix:
include:
- flags: address,undefined
- flags: thread
steps:
- uses: actions/checkout@v4
- name: Download generated files
uses: actions/download-artifact@v4
with:
name: grammar
path: build/generated_parser
- name: Requirements install
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Configure
run: cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.flags }}" -DWITH_LIBCXX=Off -DUSE_PRE_GENERATED_GRAMMAR="generated_parser" ../
working-directory: build
- name: Build
run: cmake --build .
working-directory: build
- name: Test
run: |
./server_test
./library_test
./hlasm_utils_test
working-directory: build/bin
aarch64-linux-musl:
name: Create Linux arm64 docker images
runs-on: alpine:3.19
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache
with:
path: toolchain.tar.gz
key: ${{ hashFiles('scripts/toolchain.linux_arm64.sh') }}
- name: Build image
if: steps.cache.outputs.cache-hit != 'true'
run: ./scripts/toolchain.linux_arm64.sh
build-matrix:
name: Build
runs-on: ${{ matrix.os }}
needs: [generate_grammar, aarch64-linux-musl]
strategy:
matrix:
include:
- os: ubuntu-22.04
native: linux_x64
container: alpine:3.16
dbg-strip: objcopy --only-keep-debug language_server language_server.dbg && objcopy --strip-unneeded language_server && objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: linux_arm64
container: alpine:3.19
dbg-strip: aarch64-linux-musl-objcopy --only-keep-debug language_server language_server.dbg && aarch64-linux-musl-objcopy --strip-unneeded language_server && aarch64-linux-musl-objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: wasm
container: emscripten/emsdk:3.1.46
artifacts-ext: .*
- os: windows-2022
native: win32_x64
artifacts-ext: .exe
- os: windows-2022
native: win32_arm64
artifacts-ext: .exe
skip-test: true
- os: macos-13
native: darwin_x64
- os: macos-14
native: darwin_arm64
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Download generated files
uses: actions/download-artifact@v4
with:
name: grammar
path: build/generated_parser
- name: Requirements install
run: if [ -f ./scripts/prereq.${{ matrix.native }}.sh ]; then ./scripts/prereq.${{ matrix.native }}.sh; fi
- name: Download toolchain
if: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) != '' }}
uses: actions/cache/restore@v4
with:
path: toolchain.tar.gz
key: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) }}
fail-on-cache-miss: true
- name: Extract toolchain
if: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) != '' }}
run: |
tar xzf toolchain.tar.gz
echo "$PWD/toolchain/bin" >> $GITHUB_PATH
- name: Configure
run: ../scripts/config.${{ matrix.native }}.sh
working-directory: build
- name: Build
run: cmake --build . $([ -f ../scripts/build-extra.${{ matrix.native }}.conf ] && cat ../scripts/build-extra.${{ matrix.native }}.conf || true)
working-directory: build
- name: Server Test
if: ${{ !matrix.skip-test }}
run: |
if [ -f ../../scripts/test-runner.${{ matrix.native }}.sh ]; then
../../scripts/test-runner.${{ matrix.native }}.sh ./library_test
../../scripts/test-runner.${{ matrix.native }}.sh ./server_test
../../scripts/test-runner.${{ matrix.native }}.sh ./hlasm_utils_test
else
./library_test
./server_test
./hlasm_utils_test
fi
working-directory: build/bin
- name: Strip debug info
if: ${{ matrix.dbg-strip }}
run: ${{ matrix.dbg-strip }}
working-directory: build/bin
- name: Actions artifact
uses: actions/upload-artifact@v4
with:
name: language_server_${{ matrix.native }}
path: build/bin/language_server${{ matrix.artifacts-ext }}
- name: Actions artifact
if: ${{ matrix.dbg-pattern }}
uses: actions/upload-artifact@v4
with:
name: language_server_${{ matrix.native }}_dbg
path: ${{ matrix.dbg-pattern }}
test-matrix:
name: Test
runs-on: ${{ matrix.os }}
needs: [build-matrix]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
native: linux_x64
chmod: true
- os: windows-2019
native: win32_x64
chmod: false
- os: macos-11
native: darwin_x64
chmod: true
- os: ubuntu-22.04
native: linux_x64
chmod: true
- os: ubuntu-22.04
native: linux_arm64
chmod: true
- os: windows-2022
native: win32_x64
chmod: false
- os: macos-12
native: darwin_x64
chmod: true
- os: macos-13
native: darwin_x64
chmod: true
- os: macos-14
native: darwin_arm64
chmod: true
env:
XVFB: ${{ startsWith(matrix.native, 'linux') && 'xvfb-run -a' || '' }}
defaults:
run:
working-directory: ${{ env.CLIENT_DIR }}
steps:
- uses: actions/checkout@v4
- name: Download native language server
uses: actions/download-artifact@v4
with:
name: language_server_${{ matrix.native }}
path: ${{ env.CLIENT_DIR }}/bin/${{ matrix.native }}/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Set executable flag
if: ${{ matrix.chmod }}
run: chmod +x bin/${{ matrix.native }}/language_server
- name: Setup emulation
if: ${{ hashFiles(format('scripts/emulation.{0}.sh', matrix.native)) != '' }}
run: ./scripts/emulation.${{ matrix.native }}.sh
- name: NPM CI
run: npm ci
- name: Extension Test
run: ${{ env.XVFB }} npm run test
- name: Extension Test WASM
run: ${{ env.XVFB }} npm run test:wasm
- name: Extension Test Insiders
run: ${{ env.XVFB }} npm run test:insiders
VSIX-web:
name: Test and VSIX (Web)
runs-on: ubuntu-22.04
needs: [build-matrix, release-info]
steps:
- uses: actions/checkout@v4
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Download Release Info
uses: actions/download-artifact@v4
with:
name: release-info
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
- name: Inject telemetry key
run: |
export TEL_KEY=`node -e "console.log(Buffer.from('${{ secrets.TELEMETRY_KEY }}').toString('base64'))"`
sed -i "s/const TELEMETRY_KEY_ENCODED = TELEMETRY_DEFAULT_KEY/const TELEMETRY_KEY_ENCODED = '$TEL_KEY'/" src/telemetry.ts
working-directory: ${{ env.CLIENT_DIR }}
- name: NPM Compile
run: npm run compile:web
working-directory: ${{ env.CLIENT_DIR }}
- name: NPM Test
run: npm run test:web
working-directory: ${{ env.CLIENT_DIR }}
- name: Package VSIX
run: npx vsce package ${{ github.ref == 'refs/heads/master' && ' ' || '--pre-release' }} --no-dependencies --target web -o hlasm-language-support-web.vsix --baseContentUrl "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/"
working-directory: ${{ env.CLIENT_DIR }}
- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: hlasm-language-support-web.vsix
path: ${{ env.CLIENT_DIR }}/hlasm-language-support-web.vsix
VSIX:
runs-on: ubuntu-22.04
needs: [build-matrix, release-info]
steps:
- uses: actions/checkout@v4
- name: Download windows language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_x64
path: ${{ env.CLIENT_DIR }}/bin/win32_x64/
- name: Download windows language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_arm64
path: ${{ env.CLIENT_DIR }}/bin/win32_arm64/
- name: Download linux language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_linux_x64
path: ${{ env.CLIENT_DIR }}/bin/linux_x64/
- name: Download linux language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_linux_arm64
path: ${{ env.CLIENT_DIR }}/bin/linux_arm64/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Download MacOS language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_darwin_x64
path: ${{ env.CLIENT_DIR }}/bin/darwin_x64/
- name: Download MacOS language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_darwin_arm64
path: ${{ env.CLIENT_DIR }}/bin/darwin_arm64/
- name: Download Release Info
uses: actions/download-artifact@v4
with:
name: release-info
- name: Set executable flag
run: |
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_arm64/language_server
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
- name: Inject telemetry key
run: |
export TEL_KEY=`node -e "console.log(Buffer.from('${{ secrets.TELEMETRY_KEY }}').toString('base64'))"`
sed -i "s/const TELEMETRY_KEY_ENCODED = TELEMETRY_DEFAULT_KEY/const TELEMETRY_KEY_ENCODED = '$TEL_KEY'/" src/telemetry.ts
working-directory: ${{ env.CLIENT_DIR }}
- name: NPM Compile
run: npm run compile
working-directory: ${{ env.CLIENT_DIR }}
- name: Package VSIX
run: npx vsce package ${{ github.ref == 'refs/heads/master' && ' ' || '--pre-release' }} --no-dependencies -o hlasm-language-support.vsix --baseContentUrl "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/"
working-directory: ${{ env.CLIENT_DIR }}
- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: hlasm-language-support.vsix
path: ${{ env.CLIENT_DIR }}/hlasm-language-support.vsix
release:
name: Release VSIXs
runs-on: ubuntu-22.04
permissions:
contents: write
issues: write
pull-requests: write
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'push' && github.ref == 'refs/heads/release-next')
needs: [VSIX, VSIX-web, test-matrix, sanitizer-builds, theia-test]
steps:
- uses: actions/checkout@v4
- name: Download VSIX
uses: actions/download-artifact@v4
with:
name: hlasm-language-support.vsix
path: ${{ env.CLIENT_DIR }}
- name: Download Web VSIX
uses: actions/download-artifact@v4
with:
name: hlasm-language-support-web.vsix
path: ${{ env.CLIENT_DIR }}
- name: Download Release Info
uses: actions/download-artifact@v4
with:
name: release-info
- name: Commit changes
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git add CHANGELOG.md ${{ env.CLIENT_DIR }}/package.json ${{ env.CLIENT_DIR }}/CHANGELOG.md
git commit -m "chore: Update version & changelog [skip ci]"
git push origin master
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
- name: Release new version
run: npx semantic-release
working-directory: ${{ env.CLIENT_DIR }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge master into development
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
git stash
git fetch
git checkout origin/development
git merge origin/master
cd ${{ env.CLIENT_DIR }}
sed -i '2s/^/\n## ****Unreleased****\n/' CHANGELOG.md
git add package.json CHANGELOG.md
git commit -m "chore: Prepare for next development cycle [skip ci]"
- name: Push changes
if: github.event_name == 'push'
run: git push origin HEAD:development
- name: Delete PRs head branches
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: git push origin --delete release-next
theia-test:
name: Theia Integration Test
runs-on: ubuntu-22.04
needs: VSIX
strategy:
matrix:
theia: ["ghcr.io/eclipse-theia/theia-blueprint/blueprint:1.35.0"]
# theiaide images not supported anymore
container:
image: ${{ matrix.theia }}
options: --user root
steps:
- name: Workaround for git safe.directory feature
run: chown root:root .
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Chromium
run: apt-get update && apt-get install -y chromium
- name: Download VSIX
uses: actions/download-artifact@v4
with:
name: hlasm-language-support.vsix
path: ${{ env.CLIENT_DIR }}/plugin/
- name: npm ci
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
- name: Run Theia Tests
run: npm run test:theia /home/theia/applications/browser/
working-directory: ${{ env.CLIENT_DIR }}