-
Notifications
You must be signed in to change notification settings - Fork 192
475 lines (451 loc) · 19.8 KB
/
daily-build-2201.6.x.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
name: Daily build (2201.6.x)
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # 07:30 in LK time (GMT+5:30)
jobs:
ubuntu-build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Get daily docker version
id: version
run: echo "::set-output name=version::$(date +'%Y-%m-%d')"
- name: Get project version
id: project-version
run: |
SHORT_VERSION=$((grep -w "version" | cut -d= -f2 | cut -d- -f1 | xargs) < gradle.properties)
DIST_VERSION=$((grep -w "version" | cut -d= -f2 | xargs) < gradle.properties)
LANG_VERSION=$((grep -w "ballerinaLangVersion" | cut -d= -f2 | cut -d- -f1 | xargs) < gradle.properties)
CODE_NAME=$((grep -w 'codeName' | cut -d= -f2) < gradle.properties)
RELEASE_VERSION=$DIST_VERSION-$CODE_NAME
echo "::set-output name=version::$RELEASE_VERSION"
echo "::set-output name=sversion::$SHORT_VERSION"
echo "::set-output name=langversion::$LANG_VERSION"
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x project-api-tests:test
- name: Create linux-deb
id: run_installers_deb
run: |
cd installers/linux-deb
./build-ballerina-linux-deb-x64.sh -v ${{ steps.project-version.outputs.version }} -p ./../../ballerina/build/distributions
echo "Created linux-deb successfully"
- name: Create linux-rpm
id: run_installers_rpm
run: |
cd installers/linux-rpm
./build-ballerina-linux-rpm-x64.sh -v ${{ steps.project-version.outputs.version }} -p ./../../ballerina/build/distributions
echo "Created linux-rpm successfully"
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 installers/linux-deb/target/ballerina-*-linux-x64.deb
openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm
openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip
openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip
- name: Archive Ballerina ZIP
uses: actions/upload-artifact@v2
with:
name: Ballerina ZIP
path: ballerina/build/distributions/ballerina-*-swan-lake.zip
- name: Archive Ballerina Short Name ZIP
uses: actions/upload-artifact@v2
with:
name: Ballerina Short Name ZIP
path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip
- name: Archive Linux deb
uses: actions/upload-artifact@v2
with:
name: Linux Installer deb
path: installers/linux-deb/target/ballerina-*-linux-x64.deb
- name: Archive Linux rpm
uses: actions/upload-artifact@v2
with:
name: Linux Installer rpm
path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm
- name: Archive MacOS Installer ZIP
uses: actions/upload-artifact@v2
with:
name: MacOS Installer ZIP
path: ballerina/build/distributions/ballerina-*-macos.zip
- name: Archive MacOS-ARM Installer ZIP
uses: actions/upload-artifact@v2
with:
name: MacOS-ARM Installer ZIP
path: ballerina/build/distributions/ballerina-*-macos-arm.zip
- name: Archive Windows Installer ZIP
uses: actions/upload-artifact@v2
with:
name: Windows Installer ZIP
path: ballerina/build/distributions/ballerina-*-windows.zip
- name: Archive Linux deb Hashes
uses: actions/upload-artifact@v2
with:
name: Linux deb Hashes
path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256
- name: Archive Linux rpm Hashes
uses: actions/upload-artifact@v2
with:
name: Linux rpm Hashes
path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256
- name: Archive Ballerina Zip Hashes
uses: actions/upload-artifact@v2
with:
name: Ballerina Zip Hashes
path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256
- name: Archive Ballerina Short Name Hashes
uses: actions/upload-artifact@v2
with:
name: Ballerina Short Name Hashes
path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256
- name: Install Ballerina DEB
run: sudo dpkg -i installers/linux-deb/target/ballerina-*-linux-x64.deb
- name: Update Installer Test Configs
run: |
DISPLAY_TEXT=${{ steps.project-version.outputs.langversion }}
SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties
- name: Run Installer Tests
working-directory: ./ballerina-test-automation/installer-test
run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
- name: Checkout docker repo
uses: actions/checkout@v2
with:
repository: ballerina-platform/module-ballerina-docker
path: module-ballerina-docker
- name: Copy zip artifact
run: cp ballerina/build/distributions/ballerina-22*.zip module-ballerina-docker/base/docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build the docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/docker/
load: true
push: false
tags: ballerina/ballerina:nightly-test
build-args: |
BALLERINA_DIST=ballerina-${{ steps.project-version.outputs.sversion }}.zip
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ballerina/ballerina:nightly-test'
skip-dirs: 'ballerina/runtime/examples'
format: 'table'
exit-code: '1'
timeout: "10m0s"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/docker/
push: true
tags: ballerina/ballerina:nightly-2201.6.x
build-args: |
BALLERINA_DIST=ballerina-${{ steps.project-version.outputs.sversion }}.zip
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Copy deb artifact
run: cp installers/linux-deb/target/ballerina-*-linux-x64.deb module-ballerina-docker/base/devcontainer/
- name: Build the dev container docker image
id: docker_build_devcontainer
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/devcontainer/
load: true
push: false
tags: ballerina/ballerina-devcontainer:nightly-test
build-args: |
BALLERINA_DIST=ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb
- name: Run Trivy vulnerability scanner for dev container docker image
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ballerina/ballerina-devcontainer:nightly-test'
skip-dirs: 'ballerina/runtime/examples'
format: 'table'
exit-code: '1'
timeout: "10m0s"
- name: Build and push dev container image
uses: docker/build-push-action@v2
with:
context: module-ballerina-docker/base/devcontainer/
push: true
tags: ballerina/ballerina-devcontainer:nightly-2201.6.x
build-args: |
BALLERINA_DIST=ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb
- name: Notify failure
if: ${{ failure() }}
run: |
curl -X POST \
'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data "{
\"event_type\": \"notify-build-failure\",
\"client_payload\": {
\"repoName\": \"ballerina-distribution\",
\"branch\": \"2201.6.x\"
}
}"
outputs:
project-version: ${{ steps.project-version.outputs.version }}
lang-version: ${{ steps.project-version.outputs.langversion }}
project-api-tests:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew :project-api-tests:test --stacktrace --scan --console=plain --no-daemon --continue
windows-build:
runs-on: windows-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
devCentralToken: ${{ secrets.BALLERINA_DEV_CENTRAL_ACCESS_TOKEN }}
ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }}
TEST_MODE_ACTIVE: true
run: ./gradlew.bat clean build --stacktrace --scan --console=plain --no-daemon -x test
ubuntu-rpm-installer-test:
needs: ubuntu-build
runs-on: ubuntu-latest
container: centos:latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Setup Files
run: |
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- name: Download Ballerina rpm Installer
uses: actions/download-artifact@v2
with:
name: Linux Installer rpm
- name: Install Ballerina RPM
run: |
rpm -ivh ballerina-*-linux-x64.rpm
- name: Update Installer Test Configs
run: |
DISPLAY_TEXT=${{ needs.ubuntu-build.outputs.lang-version }}
SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT
sed -i -e "s/swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties
sed -i -e "s/swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties
- name: Run Installer Tests
working-directory: ./ballerina-test-automation/installer-test
run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
macos-installer-build:
needs: ubuntu-build
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Download MacOS Intaller Zip
uses: actions/download-artifact@v2
with:
name: MacOS Installer ZIP
- name: Create macos-pkg
id: run_installers_pkg
run: |
cd installers/mac
./build-ballerina-macos-x64.sh -v ${{ needs.ubuntu-build.outputs.project-version }} -p ./../../
echo "Created macos-pkg successfully"
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg
- name: Archive MacOS pkg Hashes
uses: actions/upload-artifact@v2
with:
name: MacOS pkg Hashes
path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256
- name: Archive MacOS pkg
uses: actions/upload-artifact@v2
with:
name: MacOS Installer pkg
path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg
- name: Install Ballerina PKG
run: sudo installer -pkg installers/mac/target/pkg/ballerina-*-macos-x64.pkg -target /
- name: Update Installer Test Configs
run: |
DISPLAY_TEXT=${{ needs.ubuntu-build.outputs.lang-version }}
SWAN_LAKE_LATEST_VERSION="swan-lake-"+$DISPLAY_TEXT
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=$DISPLAY_TEXT/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=$SWAN_LAKE_LATEST_VERSION/" ballerina-test-automation/gradle.properties
- name: Run Installer Tests
working-directory: ./ballerina-test-automation/installer-test
run: ./../gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
macos-arm-installer-build:
needs: ubuntu-build
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Download MacOS-ARM Intaller Zip
uses: actions/download-artifact@v2
with:
name: MacOS-ARM Installer ZIP
- name: Create macos-arm-pkg
id: run_installers_arm_pkg
run: |
cd installers/mac
./build-ballerina-macos-x64.sh -v ${{ needs.ubuntu-build.outputs.project-version }} -p ./../../ -a arm
echo "Created macos-arm-pkg successfully"
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg
- name: Archive MacOS-ARM pkg Hashes
uses: actions/upload-artifact@v2
with:
name: MacOS-ARM pkg Hashes
path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256
- name: Archive MacOS-ARM pkg
uses: actions/upload-artifact@v2
with:
name: MacOS Installer ARM pkg
path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg
windows-installer-build:
needs: ubuntu-build
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.x'
- name: Install GUID Generator
run: dotnet tool install -g dotnet-guid --version 0.5.2
- name: Download Windows Intaller Zip
uses: actions/download-artifact@v2
with:
name: Windows Installer ZIP
- name: Create windows-msi
id: run_installers_msi
run: |
$env:Path += ";C:\Program Files (x86)\WiX Toolset v3.11\bin"
move installers\windows .\
ren windows w
cd w
.\build-ballerina-windows-x64.bat --version ${{ needs.ubuntu-build.outputs.project-version }} --path .\..\
echo "Created windows-msi successfully"
- name: Generate Hashes
run: |
openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi
- name: Archive Windows msi Hashes
uses: actions/upload-artifact@v2
with:
name: Windows msi Hashes
path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256
- name: Archive Windows msi
uses: actions/upload-artifact@v2
with:
name: Windows Installer msi
path: w\target\msi\ballerina-*-windows-x64.msi
- name: Install Ballerina msi
run: msiexec /i w\target\msi\ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi /quiet /qr
shell: cmd
- name: Update Installer Test Configs
run: |
set DISPLAY_TEXT=${{ needs.ubuntu-build.outputs.lang-version }}
set SWAN_LAKE_LATEST_VERSION=swan-lake-%DISPLAY_TEXT%
perl -pi -e "s/^\s*swan-lake-latest-version-display-text=.*/swan-lake-latest-version-display-text=%DISPLAY_TEXT%/" ballerina-test-automation/gradle.properties
perl -pi -e "s/^\s*swan-lake-latest-version=.*/swan-lake-latest-version=%SWAN_LAKE_LATEST_VERSION%/" ballerina-test-automation/gradle.properties
shell: cmd
- name: Run Installer Tests
working-directory: .\ballerina-test-automation\installer-test
run: |
$env:Path += ";C:\Program Files\Ballerina\bin"
.\..\gradlew build --stacktrace -scan --console=plain --no-daemon -DballerinaInstalled=true
env:
TEST_MODE_ACTIVE: true
trigger-notifications:
needs: [ubuntu-build, macos-installer-build, windows-installer-build]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: 2201.6.x
- name: Invoke Connector Ballerina Version Bump
run: |
ballerinaVersion=$((grep -w 'ballerinaLangVersion' | cut -d= -f2) < gradle.properties)
echo "Triggering connectors dependency bumps..." && \
curl -X POST \
https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data "{
\"event_type\": \"connector-update\",
\"client_payload\": {
\"ballerinaVersion\": \"$ballerinaVersion\"
}
}"