-
Notifications
You must be signed in to change notification settings - Fork 57
421 lines (412 loc) · 15.3 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
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
# Copyright (c) 2023 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: build
on:
workflow_dispatch:
inputs:
with_telemetry:
description: "Build with telemetry"
required: true
default: 'false'
skip_ui_tests:
description: "Skip UI tests"
required: true
default: 'false'
pull_request:
branches:
- development
- master
push:
branches:
- development
- master
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies for COBOL LS
working-directory: clients/cobol-lsp-vscode-extension
run: npm ci
- name: Check code formatting for COBOL LS
working-directory: clients/cobol-lsp-vscode-extension
run: npm run lint-format
- name: Check code quality for COBOL LS
working-directory: clients/cobol-lsp-vscode-extension
run: npm run lint-quality
zipSources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies for COBOL LS API
working-directory: clients/cobol-dialect-api
run: NODE_ENV=production npm ci
- name: Install dependencies for COBOL LS
working-directory: clients/cobol-lsp-vscode-extension
run: NODE_ENV=production npm ci
- name: Install dependencies for IDMS dialect
working-directory: clients/idms-dialect-support
run: NODE_ENV=production npm ci
- name: Install dependencies for DaCo dialect
working-directory: clients/daco-dialect-support
run: NODE_ENV=production npm ci
- uses: actions/upload-artifact@v4
with:
name: clients-for-bd-scan
path: clients/**
if-no-files-found: error
generateNativeConfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
components: 'native-image'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
## uncomment me if you need native image job reports
# native-image-job-reports: 'true'
cache: 'maven'
- name: Generate assisted configuration for GraalVM native build
working-directory: server
run: mvn -e -B -Pnative -Dagent=true -Dtest=\!PositiveTest* -DfailIfNoTests=false test
- name: Upload native build configuration
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: native-build-configuration
path: server/engine/target/native/agent-output/test/*
buildPlatformIndependedPart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build Server and Dialects Jars
working-directory: server
run: mvn clean verify --no-transfer-progress
- name: Upload performance data
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: test-perfomance-data
path: server/engine/target/perf.csv
- name: Upload jar files
uses: actions/upload-artifact@v4
with:
name: jar
path: server/engine/target/server.jar
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Build VS Code extension dialect API
working-directory: clients/cobol-dialect-api
run: |
npm ci
npm run compile
- name: Upload cobol dialect API library
uses: actions/upload-artifact@v4
with:
name: lib
path: clients/cobol-dialect-api/lib/*
- name: Unit Test COBOL LS extension
working-directory: clients/cobol-lsp-vscode-extension
run: |
npm ci
npm run test
- name: Package IDMS vsix
working-directory: clients/idms-dialect-support
run: |
npm ci
cp ../../server/dialect-idms/target/dialect-idms.jar ./server/jar
npm run package
cp *.vsix ../../.
- name: Package DaCo vsix
working-directory: clients/daco-dialect-support
run: |
npm ci
cp ../../server/dialect-daco/target/dialect-daco.jar ./server/jar
npm run package
cp *.vsix ../../.
- name: Upload IDMS vsix
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: vsix-idms-dialect
path: 'cobol-language-support-for-idms*.vsix'
- name: Upload DaCo vsix
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: vsix-daco-dialect
path: 'cobol-language-support-for-daco*.vsix'
- name: SonarCloud Scan
if: github.ref == 'refs/heads/development'
uses: sonarsource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
buildWeb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unit Test COBOL LS Web extension
working-directory: clients/cobol-lsp-vscode-extension
run: |
npm ci
npm run test:web
- name: Package COBOL LS vsix for Web
working-directory: clients/cobol-lsp-vscode-extension
run: |
npm ci
npm run package:web
cp *.vsix ../../.
- name: Upload Web vsix
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: vsix-cobol-language-support-web
path: 'cobol-language-support-web*.vsix'
buildNative:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
arch: [x64, arm64]
include:
- os: ubuntu-latest
arch: x64
container: alpine:3.17
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
needs: [generateNativeConfig]
steps:
# Generate environment variable
- shell: pwsh
if: matrix.os == 'windows-latest'
run: echo "target=win32-${{ matrix.arch }}" >> $env:GITHUB_ENV
- shell: sh
if: startsWith( matrix.os, 'macos')
run: echo "target=darwin-${{ matrix.arch }}" >> $GITHUB_ENV
- shell: sh
if: matrix.os == 'ubuntu-latest'
run: echo "target=linux-${{ matrix.arch }}" >> $GITHUB_ENV
# Setup envierment
# - name: switch xcode to 12.5.1
# if: matrix.os == 'macos-11'
# run: |
# sudo xcode-select -s /Applications/Xcode_12.5.1.app/Contents/Developer
# xcodebuild -version
- uses: al-cheb/[email protected]
if: matrix.os == 'windows-latest'
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64'
with:
java-version: '17'
components: 'native-image'
distribution: 'graalvm-community'
native-image-musl: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
## uncomment me if you need native image job reports
# native-image-job-reports: 'true'
cache: 'maven'
- uses: graalvm/setup-graalvm@v1
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'x64'
with:
java-version: '17'
components: 'native-image'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
## uncomment me if you need native image job reports
# native-image-job-reports: 'true'
cache: 'maven'
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Retrieve native build configurations
uses: actions/download-artifact@v4
with:
name: native-build-configuration
path: native-build-configuration
- name: Verify musl setup
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64'
run: ./.github/scripts/verify_musl_setup.sh
shell: bash {0}
- name: Add graalVM configuration to server
run: |
cp -rp native-build-configuration/session-* server/engine/src/main/resources/META-INF/native-image/
rm server/engine/src/main/resources/META-INF/native-image/session-*/jni-config.json
shell: bash
- name: Build with Maven
working-directory: server
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'x64'
run: mvn -e -B -Pnative -DskipTests clean package
- name: Build with Maven for Linux
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64'
working-directory: server
run: mvn -e -B -Plinux-native -DskipTests clean package
- name: Prepare windows artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: staging-${{ env.target }}
path: |
server/engine/target/*.exe
server/engine/target/*.dll
server/engine/target/*.txt
if-no-files-found: error
- name: Prepare non-windows artifacts
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: staging-${{ env.target }}
path: server/engine/target/engine
if-no-files-found: error
packageNative:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
arch: [x64, arm64]
include:
- os: ubuntu-latest
arch: x64
container: alpine:3.17
- os: macos-13
arch: x64
- os: macos-14
arch: arm64
runs-on: ${{ matrix.os }}
needs: [buildNative,buildPlatformIndependedPart]
steps:
# Generate environment variable
- shell: pwsh
if: matrix.os == 'windows-latest'
run: echo "target=win32-${{ matrix.arch }}" >> $env:GITHUB_ENV
- shell: sh
if: startsWith( matrix.os, 'macos')
run: echo "target=darwin-${{ matrix.arch }}" >> $GITHUB_ENV
- shell: sh
if: matrix.os == 'ubuntu-latest'
run: echo "target=linux-${{ matrix.arch }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Retrieve native build
uses: actions/download-artifact@v4
with:
name: staging-${{ env.target }}
path: staging/${{ env.target }}
- name: Retrieve server jars
uses: actions/download-artifact@v4
with:
name: jar
path: jar
- name: Deploy server jar
working-directory: clients/cobol-lsp-vscode-extension
run: cp ../../jar/server.jar ./server/jar
- name: Deploy windows executable
working-directory: clients/cobol-lsp-vscode-extension
if: startsWith( matrix.os, 'windows')
run: |
cp ../../staging/${{ env.target }}/engine.exe ./server/native
cp ./server/native/* ../../tests/native-executable-tests/server/windows/
- name: Deploy macos executable
working-directory: clients/cobol-lsp-vscode-extension
if: startsWith( matrix.os, 'mac')
run: |
cp -p ../../staging/${{ env.target }}/engine ./server/native/server-mac
chmod +x ./server/native/server-mac
cp ./server/native/server-mac ../../tests/native-executable-tests/server/mac/
- name: Deploy linux executable
working-directory: clients/cobol-lsp-vscode-extension
if: startsWith( matrix.os, 'ubuntu')
run: |
cp -p ../../staging/${{ env.target }}/engine ./server/native/server-linux
chmod +x ./server/native/server-linux
cp ./server/native/server-linux ../../tests/native-executable-tests/server/linux/
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Download VS Code extension dialect API
uses: actions/download-artifact@v4
with:
name: lib
path: clients/cobol-dialect-api
- name: update version for PR
working-directory: clients/cobol-lsp-vscode-extension
if: github.event_name == 'pull_request'
run: |
node -e "const fs=require('fs');const fileName='./package.json';var content=require(fileName);content.version=content.version+'\+pr-'+${{ github.event.pull_request.number }};fs.writeFileSync(fileName,JSON.stringify(content,null,2));"
- name: Build COBOL LS extension
run: npm ci
working-directory: clients/cobol-lsp-vscode-extension
- name: Inject telemetry key to COBOL LS extension
if: github.event.inputs.with_telemetry == 'true'
shell: bash
run: |
sed -i ${{ startsWith( matrix.os, 'macos') && '""' || '' }} "s/const TELEMETRY_KEY_ENCODED: string = TELEMETRY_DEFAULT_CONTENT/const TELEMETRY_KEY_ENCODED: string = '${{ secrets.TELEMETRY_INSTRUMENTATION_KEY }}'/" src/services/reporter/TelemetryReporterImpl.ts
working-directory: clients/cobol-lsp-vscode-extension
- name: Package COBOL LS vsix for ${{ env.target }}
working-directory: clients/cobol-lsp-vscode-extension
run: |
npm run package -- --target ${{ env.target }}
cp *.vsix ../../.
- uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: vsix-cobol-language-support-${{ env.target }}
path: 'cobol-language-support*.vsix'
- name: Retrieve idms dialect
uses: actions/download-artifact@v4
with:
name: vsix-idms-dialect
path: dialects-idms
- name: Restore idms jar and dist folder
run: |
unzip -j dialects-idms/*.vsix extension/dist/extension.js extension/dist/extension.js.map -d clients/idms-dialect-support/dist/
unzip -j dialects-idms/*.vsix extension/server/jar/dialect-idms.jar -d clients/idms-dialect-support/server/jar
shell: bash
- name: Retrieve daco dialect
uses: actions/download-artifact@v4
with:
name: vsix-daco-dialect
path: dialects-daco
- name: Restore daco jar and dist folder
run: |
unzip -j dialects-daco/*.vsix extension/dist/extension.js extension/dist/extension.js.map -d clients/daco-dialect-support/dist/
unzip -j dialects-daco/*.vsix extension/server/jar/dialect-daco.jar -d clients/daco-dialect-support/server/jar
shell: bash
- name: Run integration tests
if: github.event.inputs.skip_ui_tests != 'true'
uses: coactions/setup-xvfb@v1
with:
run: |
npm run compile
npm run test:integration
working-directory: clients/cobol-lsp-vscode-extension
- name: Run native executable test code
working-directory: tests/native-executable-tests
run: |
npm ci
npm run test