This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 252
740 lines (736 loc) · 26 KB
/
master.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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Submarine
# Trigger the workflow on push or pull request
on: [push, pull_request]
env:
VERSION: "0.9.0-SNAPSHOT"
BUILD_FLAG: "clean install -ntp -DskipTests -am"
TEST_FLAG: "test -DskipRat -ntp"
SUBMARINE_AUTH_SECRET: "SUBMARINE_SECRET_12345678901234567890"
jobs:
generate-k8s-versions-array:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
# Version updates for k8s can be found at https://kubernetes.io/releases/patch-releases/ or
# https://kubernetes.io/releases/
# We mainly support the last 3-4 releases of kubernetes
steps:
- id: set-matrix
run: |
echo "::set-output name=matrix::[\"v1.22.17\", \"v1.23.17\", \"v1.24.12\", \"v1.25.3\"]"
submarine-operator-verify:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
working-directory: "github.com/apache/submarine"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
path: ${{ env.working-directory }}
- name: Setup Golang 1.17.2
uses: actions/setup-go@v2
with:
go-version: "1.17.2"
- name: Check golang version
working-directory: ${{ env.working-directory }}/submarine-cloud-v3
run: go version
- name: Install Dependencies
working-directory: ${{ env.working-directory }}/submarine-cloud-v3
run: go mod vendor
- name: Verify Codegen
working-directory: ${{ env.working-directory }}/submarine-cloud-v3
run: ./hack/verify-codegen.sh
- name: Verify fmt and vet
working-directory: ${{ env.working-directory }}/submarine-cloud-v3
run: make fmt && make vet
submarine-operator-v3-e2e-test:
needs: generate-k8s-versions-array
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
k8s-version: ${{fromJSON(needs.generate-k8s-versions-array.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Setup Golang 1.17.2
uses: actions/setup-go@v2
with:
go-version: "1.17.2"
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Check version
run: |
mvn --version
java -version
go version
helm version
kind version
- name: Create kind cluster
run: kind create cluster --config ./.github/config/kind-config-kind.yaml --wait 3m --image kindest/node:${{ matrix.k8s-version }}
- name: Download Istio 1.17.1
run: |
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.17.1 sh -
cd istio-1.17.1
echo "$PWD/bin" >> $GITHUB_PATH
- name: Install Istio
run: istioctl install -y --set values.global.proxy.resources.requests.cpu=10m
- name: Show K8s cluster information
run: |
kubectl cluster-info
kubectl version
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
- name: Build Image locally
run: |
.github/scripts/build-image-locally-v3.sh
- name: Install Golang Dependencies
working-directory: submarine-cloud-v3
run: go mod vendor
- name: Install Submarine operator
working-directory: submarine-cloud-v3
# run: make deploy
# GA env variable VERSION overrides the variable in makefile,
# which results in the wrong image name.
# Running commands manually instead.
run: |
cd config/manager
kustomize edit set image controller=apache/submarine:operator-0.9.0-SNAPSHOT
kustomize build ../default | kubectl apply -f -
- name: Install Helm Dependencies
run: |
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
helm dependency update ./helm-charts/submarine
helm install --wait --set dev=true --set storageClass.provisioner=rancher.io/local-path --set storageClass.volumeBindingMode=WaitForFirstConsumer --set seldon-core-operator.istio.gateway=submarine-cloud-v3-system/seldon-gateway submarine ./helm-charts/submarine -n submarine-cloud-v3-system
- name: Run end-to-end test
working-directory: submarine-cloud-v3
run: go test ./controllers/ -v -ginkgo.v
- name: Failure status
run: |
kubectl describe nodes
kubectl get all -A
kubectl get events -A --sort-by='{.lastTimestamp}'
kubectl logs -l control-plane=controller-manager -n submarine-cloud-v3-system
kubectl logs -l app=notebook-controller -n submarine-cloud-v3-system
kubectl logs -l control-plane=kubeflow-training-operator -n submarine-cloud-v3-system
kubectl describe submarine -A
if: ${{ failure() }}
- name: Delete temporary build artifacts before caching
run: |
#Never cache local artifacts
rm -rf ~/.m2/repository/org/apache/submarine
if: always()
submarine-e2e:
runs-on: ubuntu-latest
timeout-minutes: 60
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: "password"
ports:
- 3306:3306
# wait until mysql is health
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 10s --health-retries 10
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Cache jacoco.exec
uses: actions/cache@v2
with:
path: ./submarine-test/test-e2e/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
chromedriver --version
python3 -V
- name: Prepare default mysql-data
run: |
pip install mysql-connector-python
python3 ./dev-support/database/init-database.py
- name: Build with Maven
run: |
echo ">>> mvn ${BUILD_FLAG} -B"
mvn ${BUILD_FLAG} -B
- name: Test
env:
TEST_FLAG: "verify -DskipRat -ntp"
TEST_MODULES: "-pl :submarine-test-e2e"
run: |
echo ">>> mvn ${TEST_FLAG} ${TEST_MODULES} -B"
mvn ${TEST_FLAG} ${TEST_MODULES} -B
submarine-k8s:
needs: generate-k8s-versions-array
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
k8s-version: ${{fromJson(needs.generate-k8s-versions-array.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Free Disk Space
run: bash ./.github/scripts/free-disk-space.sh
- name: Cache jacoco.exec
uses: actions/cache@v2
with:
path: ./submarine-test/test-k8s/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Check version
run: |
mvn --version
java -version
helm version
kind version
- name: Create kind cluster
run: kind create cluster --config ./.github/config/kind-config-kind.yaml --wait 3m --image kindest/node:${{ matrix.k8s-version }}
- name: Download Istio 1.17.1
run: |
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.17.1 sh -
cd istio-1.17.1
echo "$PWD/bin" >> $GITHUB_PATH
- name: Install Istio
run: istioctl install -y --set values.global.proxy.resources.requests.cpu=10m
- name: Show K8s cluster information
run: |
kubectl cluster-info
kubectl version
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
- name: Build with Maven
run: |
echo ">>> mvn ${BUILD_FLAG} -B"
mvn ${BUILD_FLAG} -B
- name: Build Image locally
run: |
.github/scripts/build-image-locally-v3.sh
sh .github/scripts/build-image-experiment-prehandler.sh
- name: Start submarine
run: bash ./.github/scripts/start-submarine.sh
- name: Test
env:
TEST_FLAG: "verify -DskipRat -ntp"
TEST_MODULES: "-pl :submarine-test-k8s"
run: |
echo ">>> mvn ${TEST_FLAG} ${TEST_MODULES} -B"
mvn ${TEST_FLAG} ${TEST_MODULES} -B
- name: Failure status
run: |
kubectl describe nodes
kubectl get pods
kubectl -n default get events --sort-by='{.lastTimestamp}'
if: ${{ failure() }}
- name: Delete temporary build artifacts before caching
run: |
#Never cache local artifacts
rm -rf ~/.m2/repository/org/apache/submarine
if: always()
submarine-commons-runtime:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Cache jacoco.exec
uses: actions/cache@v2
with:
path: ./submarine-commons/commons-runtime/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
- name: Build
env:
MODULES: "-pl :submarine-commons-runtime"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test
env:
TEST_MODULES: "-pl :submarine-commons-runtime"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
mvn $TEST_FLAG $TEST_MODULES -B
submarine-client:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Cache jacoco.exec
uses: actions/cache@v2
with:
path: ./submarine-client/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
- name: Build
env:
MODULES: "-pl :submarine-client"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test
env:
TEST_MODULES: "-pl :submarine-client"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
mvn $TEST_FLAG $TEST_MODULES -B
submarine-server:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: "password"
ports:
- 3306:3306
# wait until mysql is health
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 10s --health-retries 10
minio:
image: bitnami/minio:2022.2.24
env:
MINIO_ACCESS_KEY: "submarine_minio"
MINIO_SECRET_KEY: "submarine_minio"
MINIO_DEFAULT_BUCKETS: "submarine"
ports:
- 9000:9000
# wait until minio is health
options: --health-cmd "curl http://localhost:9000/minio/health/live" --health-interval 10s --health-timeout 10s --health-retries 10
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Cache server-database jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-server/server-database/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache server-core jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-server/server-core/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache serve jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-serve/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
- name: Prepare default mysql-data
run: |
python3 -V
sudo apt-get install python3-mysql.connector
python3 ./dev-support/database/init-database.py
- name: Build submarine-server-database
env:
MODULES: "-pl :submarine-server-database"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test submarine-server-database
env:
TEST_MODULES: "-pl :submarine-server-database"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
mvn $TEST_FLAG $TEST_MODULES -B
- name: Build submarine-server-core
env:
MODULES: "-pl :submarine-server-core"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test submarine-server-core
env:
TEST_MODULES: "-pl :submarine-server-core"
# TODO(cdmikechen) There are some databases that are hardcoded to cause data judgement anomalies,
# here is a temporary fix for this issue.
# This variable should be removed when SUBMARINE-1297 is resolved.
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
export SUBMARINE_S3_ENDPOINT=http://localhost:9000 && export JDBC_URL="jdbc:mysql://127.0.0.1:3306/submarine_test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&allowMultiQueries=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC&useTimezone=true&useLegacyDatetimeCode=true"
mvn $TEST_FLAG $TEST_MODULES -B
- name: Build submarine-serve
env:
MODULES: "-pl :submarine-serve"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test submarine-serve
env:
TEST_MODULES: "-pl :submarine-serve"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
mvn $TEST_FLAG $TEST_MODULES -B
submarine-workbench:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
- name: Maven Build
env:
MODULES: "-pl :submarine-workbench-web"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test with chrome
working-directory: ./submarine-workbench/workbench-web
run: |
export NODE_OPTIONS=--openssl-legacy-provider
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- name: Test with firefox
working-directory: ./submarine-workbench/workbench-web
run: |
export NODE_OPTIONS=--openssl-legacy-provider
npm run test -- --no-watch --no-progress --browsers=FirefoxHeadless
submarine-workbench-v2:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Check version
run: node --version
- name: Install dependencies
working-directory: ./submarine-workbench-v2
run: yarn
- name: Run test
working-directory: ./submarine-workbench-v2
run: yarn test --run --coverage
submarine-submitter:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Cache submarine-server jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submitter-k8s jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/submitter-k8s/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submitter-k8s-agent jacoco.exec
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/submarine-k8s-agent/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Check version
run: |
mvn --version
java -version
- name: Build
env:
MODULES: "-pl :submarine-server-submitter,:submarine-submitter-k8s,:submarine-k8s-agent,:submarine-k8s-utils"
run: |
echo ">>> mvn $BUILD_FLAG $MODULES -B"
mvn $BUILD_FLAG $MODULES -B
- name: Test
env:
# There are some `submitter-k8s` packages under the `submarine-server-submitter` that also needs to be tested
TEST_MODULES: "-pl :submarine-server-submitter,:submarine-submitter-k8s,:submarine-k8s-agent,:submarine-k8s-utils"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
export SUBMARINE_UID="dfea05c4-dbf2-43cc-833c-62ff329566a5"
mvn $TEST_FLAG $TEST_MODULES -B
rat:
name: Check License
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "11"
- run: mvn org.apache.rat:apache-rat-plugin:check
linter:
name: Check Style
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Setup Golang 1.16.2
uses: actions/setup-go@v2
with:
go-version: "1.16.2"
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Check version
run: |
mvn --version
java -version
go version
node --version
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Java Style
if: always()
run: ./dev-support/style-check/lint-java.sh
- name: Scala Style
if: always()
run: ./dev-support/style-check/lint-scala.sh
- name: Angular Style
if: always()
run: ./dev-support/style-check/lint-angular.sh
- name: Go Style
if: always()
run: ./dev-support/style-check/lint-go.sh
- name: React Style
if: always()
working-directory: ./submarine-workbench-v2
run: |
yarn add prettier@^2.6.2
yarn checkformat
sonarcloud-and-codecov:
name: SonarCloud and Codecov
runs-on: ubuntu-latest
needs:
- submarine-e2e
- submarine-k8s
- submarine-submitter
- submarine-server
- submarine-client
- submarine-commons-runtime
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache test-e2e data
uses: actions/cache@v2
with:
path: ./submarine-test/test-e2e/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache test-k8s data
uses: actions/cache@v2
with:
path: ./submarine-test/test-k8s/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache commons-cluster data
uses: actions/cache@v2
with:
path: ./submarine-commons/commons-cluster/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache commons-runtime data
uses: actions/cache@v2
with:
path: ./submarine-commons/commons-runtime/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-client data
uses: actions/cache@v2
with:
path: ./submarine-client/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-server-database data
uses: actions/cache@v2
with:
path: |
./submarine-server/server-database/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-server-core data
uses: actions/cache@v2
with:
path: |
./submarine-server/server-core/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-serve data
uses: actions/cache@v2
with:
path: |
./submarine-serve/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-submitter data
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-submitter-k8s data
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/submitter-k8s/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache submarine-k8s-agent data
uses: actions/cache@v2
with:
path: |
./submarine-server/server-submitter/submarine-k8s-agent/target/jacoco.exec
key: ${{ runner.os }}-docker-${{ github.sha }}
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build the project with JDK 11
run: mvn install -DskipTests
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: target/artifacts
- name: Calculate combined coverage
run: ./dev-support/cicd/coverage.sh
- name: Build and analyze with JDK 11 # sonar-maven-plugin only support JDK 11
if: github.repository == 'apache/submarine' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: mvn -B verify -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_submarine
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
files: ./target/coverage/all.xml
- name: Delete temporary build artifacts before caching
run: |
#Never cache local artifacts
rm -rf ~/.m2/repository/org/apache/submarine
if: always()