-
Notifications
You must be signed in to change notification settings - Fork 101
515 lines (503 loc) · 20.3 KB
/
continuous-integration.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
name: CI
on:
workflow_dispatch:
push:
branches-ignore:
- dependabot/**
tags:
- v[0-9]+\.[0-9]+\.[0-9]+
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}/${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
NODE_VERSION: 16.14.2
ARTIFACTS_CYPRESS_TESTS_NAME: cypress-tests
ARTIFACTS_CYPRESS_TESTS_PATH: web/cypress
ARTIFACTS_TASKANA_JARS_NAME: taskana-jars
ARTIFACTS_TASKANA_JARS_PATH: ~/.m2/repository/pro/taskana
ARTIFACTS_TASKANA_WEB_NAME: taskana-web
ARTIFACTS_TASKANA_WEB_PATH: web/dist
ARTIFACTS_JACOCO_REPORTS_NAME: jacoco-reports
ARTIFACTS_JACOCO_REPORTS_PATH: "**/jacoco.exec"
CACHE_WEB_NAME: web
# IMPORTANT: this cannot start with CACHE_MAVEN_NAME's value
# because the 'compile_backend' job would otherwise use this as a fallback cache.
CACHE_MAVEN_FOR_WEB_NAME: mvn-for-web
CACHE_MAVEN_NAME: maven
CACHE_SONAR_NAME: sonar
jobs:
compile_backend:
name: Compile all maven modules
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
id: cache
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Change versions to match tag
run: ci/change_version.sh -m .
- name: Compile & build
run: ./mvnw -B install -DskipTests -Dasciidoctor.skip -Djacoco.skip
- name: Populate cache
if: steps.cache.outputs.cache-hit != 'true'
run: |
./mvnw -B dependency:go-offline
./mvnw -B test -Dtest=GibtEsNet -Dsurefire.failIfNoSpecifiedTests=false
- name: Upload taskana artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }}
if-no-files-found: error
- name: Remove taskana artifacts from cache
run: rm -rf ~/.m2/repository/pro/taskana
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
compile_frontend:
name: Compile taskana-web
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache web dependencies
id: web-cache
uses: actions/cache@v3
with:
path: web/node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/yarn.lock') }}
- name: Cache maven dependencies (for web)
id: maven-cache
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }}
- name: Populate maven cache
run: ./mvnw -B dependency:go-offline -pl :taskana-web -am
if: steps.maven-cache.outputs.cache-hit != 'true'
- name: Install Dependencies
if: steps.web-cache.outputs.cache-hit != 'true'
working-directory: web
run: yarn ci
- name: Compile & build
working-directory: web
run: |
yarn lint
yarn build:prod
- name: Build maven artifact
run: ./mvnw -B install -pl :taskana-web -am
- name: Upload taskana-web dist artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }}
if-no-files-found: error
- name: Remove taskana artifacts from cache
run: rm -rf ~/.m2/repository/pro/taskana
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
test_frontend:
runs-on: ubuntu-20.04
name: Test taskana-web
needs: [ compile_frontend ]
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache web dependencies
id: web-cache
uses: actions/cache@v3
with:
path: web/node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/yarn.lock') }}
# Theoretically this step below not necessary because we reuse the cache from the 'compile_frontend' job.
# Sometimes the cache is not created, therefore this is a fallback.
- name: Install Dependencies
if: steps.web-cache.outputs.cache-hit != 'true'
working-directory: web
run: yarn ci
- name: Cache maven dependencies (for web)
id: maven-cache
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }}
# Theoretically this step below not necessary because we reuse the cache from the 'compile_frontend' job.
# Sometimes the cache is not created, therefore this is a fallback.
- name: Populate cache
run: ./mvnw -B dependency:go-offline -pl :taskana-web -am
if: steps.maven-cache.outputs.cache-hit != 'true'
- name: Test
working-directory: web
run: yarn run test -- --coverageReporters text-summary
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
test_e2e:
runs-on: ubuntu-20.04
name: Test E2E
needs: [ compile_frontend, compile_backend ]
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache web dependencies
id: web-cache
uses: actions/cache@v3
with:
path: web/node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/yarn.lock') }}
# Theoretically this step below not necessary because we reuse the cache from the 'compile_frontend' job.
# Sometimes the cache is not created, therefore this is a fallback.
- name: Install Dependencies
if: steps.web-cache.outputs.cache-hit != 'true'
working-directory: web
run: yarn ci
- name: Cache maven dependencies
id: maven-cache
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
- name: Download taskana artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }}
- name: Change versions to match tag
run: ci/change_version.sh -m .
# Theoretically this step below not necessary because we reuse the cache from the 'compile_frontend' job.
# Sometimes the cache is not created, therefore this is a fallback.
- name: Populate cache
run: ./mvnw -B dependency:go-offline -pl :taskana-rest-spring-example-boot -am
if: steps.maven-cache.outputs.cache-hit != 'true'
- name: Download taskana-web dist artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }}
- name: Build frontend
run: ./mvnw install -pl :taskana-web
- name: Cypress tests
working-directory: web
run: |
../mvnw -B spring-boot:run -P history.plugin -f .. -pl :taskana-rest-spring-example-boot &> /dev/null &
npx wait-port -t 30000 localhost:8080 && yarn run e2e-standalone --spec "cypress/integration/monitor/**"
- name: Upload Cypress tests
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACTS_CYPRESS_TESTS_NAME }}
path: ${{ env.ARTIFACTS_CYPRESS_TESTS_PATH }}
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
test_backend:
runs-on: ubuntu-20.04
name: Test ${{ matrix.module }} on ${{ matrix.database }}
needs: [ compile_backend ]
strategy:
matrix:
module:
- taskana-common
- taskana-common-security
- taskana-common-data
- taskana-common-logging
- taskana-common-test
- taskana-core
- taskana-core-test
- taskana-cdi
- taskana-cdi-example
- taskana-test-api
- taskana-spring
- taskana-spring-example
- taskana-spi-routing-dmn-router
- taskana-routing-rest
- taskana-rest-spring
- taskana-rest-spring-test-lib
- taskana-rest-spring-example-common
- taskana-loghistory-provider
- taskana-simplehistory-provider
- taskana-simplehistory-rest-spring
database:
- H2
include:
- module: taskana-core
database: POSTGRES
- module: taskana-core
database: DB2
- module: taskana-core
database: ORACLE
- module: taskana-core-test
database: POSTGRES
- module: taskana-core-test
database: DB2
- module: taskana-core-test
database: ORACLE
- module: taskana-test-api
database: POSTGRES
- module: taskana-test-api
database: DB2
- module: taskana-test-api
database: ORACLE
- module: taskana-simplehistory-provider
database: DB2
- module: taskana-simplehistory-provider
database: POSTGRES
- module: taskana-simplehistory-provider
database: ORACLE
- module: taskana-rest-spring-example-boot
database: DB2
- module: taskana-rest-spring-example-boot
database: ORACLE
- module: taskana-rest-spring-example-wildfly
database: POSTGRES
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Download taskana artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }}
- name: Change versions to match tag
run: |
ci/change_version.sh -m .
ci/update_taskana_dependency_for_wildfly.sh
- name: Generate JavaDoc for Rest Documentation
if: matrix.module == 'taskana-simplehistory-rest-spring'
run: ./mvnw -B validate -pl :taskana-rest-spring
- name: Test
run: ./mvnw -B verify -pl :${{matrix.module}} -Dcheckstyle.skip
env:
DB: ${{ matrix.database }}
- name: Upload JaCoCo Report
if: matrix.database == 'H2'
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }}
path: ${{ env.ARTIFACTS_JACOCO_REPORTS_PATH }}
if-no-files-found: ignore
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
release_artifacts:
runs-on: ubuntu-20.04
name: Release artifacts to OSS Sonatype
if: github.repository == 'Taskana/taskana' && ( startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master' ) && github.head_ref == ''
needs: [ test_frontend, test_e2e, test_backend ]
# as documented in the gpg manual (https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html)
# we should execute this command before interacting with gpg (otherwise gpg won't work)
env:
GPG_TTY: $(tty)
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # necessary for push back
# NOTE @v2 uses the token as an auth http header. Set it to
# a Personal Access Token instead of secrets.GITHUB_TOKEN
# so that tag pushes trigger repo push events.
# source: https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/7
token: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN }}
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Download taskana artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }}
- name: Download taskana-web dist artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }}
- name: Import GPG Key
run: echo -n "$GPG_KEY" | base64 --decode | gpg --batch --import
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
- name: Change versions to match tag
run: ci/change_version.sh -m .
- name: Release artifacts to OSS Sonatype
run: |
./mvnw -B deploy -P $([[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot") \
--settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip -Djacoco.skip \
-pl :taskana-parent,\
:taskana-common-parent,:taskana-common-logging,:taskana-common,:taskana-common-security,\
:taskana-common-data,:taskana-common-test,\
:taskana-lib-parent,:taskana-core,:taskana-cdi,:taskana-spring,\
:taskana-rest-parent,:taskana-web,:taskana-rest-spring,\
:taskana-history-parent,:taskana-simplehistory-provider,:taskana-simplehistory-rest-spring,:taskana-loghistory-provider,\
:taskana-routing-parent,:taskana-spi-routing-dmn-router,:taskana-routing-rest
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
- name: Update version to next snapshot and push back
run: |
ci/change_version.sh -i -m .
ci/update_taskana_dependency_for_wildfly.sh -i
ci/commitPoms.sh rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/example/wildfly/AbstractAccTest.java
env:
GH_EMAIL: ${{ secrets.GH_EMAIL }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
deploy_to_azure:
runs-on: ubuntu-20.04
name: Deploy demo app to Microsoft Azure
if: github.repository == 'Taskana/taskana' && github.ref == 'refs/heads/master' && github.head_ref == ''
needs: [ test_frontend, test_e2e, test_backend ]
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Download taskana artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }}
- name: Download taskana-web dist artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }}
path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }}
- name: Build taskana-web
run: ./mvnw -B install -pl :taskana-web
- name: Generate Javadoc
run: ./mvnw -B clean javadoc:jar -pl :taskana-core,:taskana-cdi,:taskana-spring
- name: Generate Rest Documentation
run: ./mvnw -B test asciidoctor:process-asciidoc -Dtest=*DocTest -pl :taskana-rest-spring,:taskana-simplehistory-rest-spring,:taskana-routing-rest -Dcheckstyle.skip -Djacoco.skip
- name: Build Example Application
run: ./mvnw -B install -P history.plugin -P dmn-routing.plugin -pl :taskana-rest-spring-example-boot -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip -Djacoco.skip
- name: Verify Example Application contains documentation
run: ci/verify_docs_jar.sh
- name: Login to Microsoft Azure
uses: Azure/login@v1
with:
creds: '{"clientId":"${{ secrets.CLIENT_ID }}","clientSecret":"${{ secrets.CLIENT_SECRET }}","subscriptionId":"${{ secrets.SUBSCRIPTION_ID }}","tenantId":"${{ secrets.TENANT_ID }}"}'
- name: Deploy to Microsoft Azure
uses: Azure/webapps-deploy@v2
with:
app-name: taskana
package: rest/taskana-rest-spring-example-boot/target/taskana-rest-spring-example-boot.jar
- name: Wait for Azure for 60 seconds
uses: jakejarvis/wait-action@master
with:
time: '60s'
- name: Smoke test documentation
run: ci/verify_docs_alive.sh
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
upload_to_sonar:
runs-on: ubuntu-20.04
name: Upload SonarQube analysis to sonarcloud
# no pull request and not on release
if: github.head_ref == '' && !startsWith(github.ref, 'refs/tags')
needs: [ test_frontend, test_e2e, test_backend ]
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }}
- name: Cache maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Download JaCoCo reports
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }}
- name: Install taskana
run: ./mvnw -B install -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip -Dmaven.javadoc.skip
- name: Upload SonarQube analysis
run: ./mvnw -B sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]