forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 6
1366 lines (1162 loc) · 50.4 KB
/
pulsar-ci.yaml
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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# 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: Pulsar CI
on:
pull_request:
branches:
- master
- 3.1_ds
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
inputs:
collect_coverage:
description: 'Collect test coverage and upload to Codecov'
required: true
default: 'true'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAVEN_OPTS: -Xss1500k -Xmx1024m -Daether.connector.http.reuseConnections=false -Daether.connector.requestTimeout=60000 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.serviceUnavailableRetryStrategy.class=standard -Dmaven.wagon.rto=60000
# defines the retention period for the intermediate build artifacts needed for rerunning a failed build job
# it's possible to rerun individual failed jobs when the build artifacts are available
# if the artifacts have already been expired, the complete workflow can be rerun by closing and reopening the PR or by rebasing the PR
ARTIFACT_RETENTION_DAYS: 3
jobs:
preconditions:
name: Preconditions
runs-on: ubuntu-22.04
if: (github.event_name != 'schedule') || (github.repository == 'apache/pulsar')
outputs:
docs_only: ${{ steps.check_changes.outputs.docs_only }}
changed_tests: ${{ steps.changes.outputs.tests_files }}
need_owasp: ${{ steps.changes.outputs.need_owasp }}
collect_coverage: ${{ steps.check_coverage.outputs.collect_coverage }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Detect changed files
id: changes
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv
- name: Check changed files
id: check_changes
run: |
if [[ "${GITHUB_EVENT_NAME}" != "schedule" && "${GITHUB_EVENT_NAME}" != "workflow_dispatch" ]]; then
echo "docs_only=${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}" >> $GITHUB_OUTPUT
else
echo docs_only=false >> $GITHUB_OUTPUT
fi
- name: Check if coverage should be collected
id: check_coverage
run: |
echo "collect_coverage=${{
(steps.check_changes.outputs.docs_only != 'true' && github.event_name != 'workflow_dispatch'
&& (github.base_ref == 'master' || github.ref_name == 'master'))
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.collect_coverage == 'true')
}}" >> $GITHUB_OUTPUT
- name: Check if the PR has been approved for testing
if: ${{ steps.check_changes.outputs.docs_only != 'true' && github.repository == 'apache/pulsar' && github.event_name == 'pull_request' }}
env:
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
GITHUB_TOKEN: ${{ github.token }}
run: |
build/pulsar_ci_tool.sh check_ready_to_test
build-and-license-check:
needs: preconditions
name: Build and License check
env:
JOB_NAME: Build and License check
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
runs-on: ubuntu-22.04
timeout-minutes: 60
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache local Maven repository
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Check source code license headers
run: mvn -B -T 8 -ntp initialize apache-rat:check license:check
- name: Check source code style
run: mvn -B -T 8 -ntp initialize checkstyle:check
- name: Build core-modules
run: |
mvn -B -T 1C -ntp -Pcore-modules,-main clean install -DskipTests -Dlicense.skip=true -Drat.skip=true -Dcheckstyle.skip=true
# - name: Check binary licenses
# run: src/check-binary-license.sh ./distribution/server/target/apache-pulsar-*-bin.tar.gz
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Save maven build results to Github artifact cache so that the results can be reused
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh store_tar_to_github_actions_artifacts pulsar-maven-repository-binaries \
tar --exclude '.m2/repository/org/apache/pulsar/pulsar-*-distribution' \
-I zstd -cf - .m2/repository/org/apache/pulsar
cd $GITHUB_WORKSPACE
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh store_tar_to_github_actions_artifacts pulsar-server-distribution \
tar -I zstd -cf - distribution/server/target/apache-pulsar-*-bin.tar.gz
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
unit-tests:
name: CI - Unit - ${{ matrix.name }}
env:
JOB_NAME: CI - Unit - ${{ matrix.name }}
COLLECT_COVERAGE: "${{ needs.preconditions.outputs.collect_coverage }}"
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
runs-on: ubuntu-22.04
timeout-minutes: ${{ matrix.timeout || 60 }}
needs: ['preconditions', 'build-and-license-check']
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
strategy:
fail-fast: false
matrix:
include:
- name: Other
group: OTHER
timeout: 75
- name: Brokers - Broker Group 1
group: BROKER_GROUP_1
- name: Brokers - Broker Group 2
group: BROKER_GROUP_2
- name: Brokers - Broker Group 3
group: BROKER_GROUP_3
- name: Brokers - Broker Group 4
group: BROKER_GROUP_4
- name: Brokers - Client Api
group: BROKER_CLIENT_API
- name: Brokers - Client Impl
group: BROKER_CLIENT_IMPL
- name: Proxy
group: PROXY
- name: Pulsar IO
group: PULSAR_IO
timeout: 75
- name: Pulsar IO - Elastic Search
group: PULSAR_IO_ELASTIC
- name: Pulsar IO - Kafka Connect Adaptor
group: PULSAR_IO_KAFKA_CONNECT
- name: Pulsar Client
group: CLIENT
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache Maven dependencies
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK ${{ matrix.jdk || '17' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh snapshot_pulsar_maven_artifacts
- name: Run setup commands
run: |
${{ matrix.setup }}
- name: Run unit test group '${{ matrix.group }}'
run: |
CHANGED_TESTS="${{ needs.preconditions.outputs.tests_files }}" ./build/run_unit_group.sh ${{ matrix.group }}
- name: Upload coverage to build artifacts
if: ${{ needs.preconditions.outputs.collect_coverage == 'true' }}
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh upload_unittest_coverage_files ${{ matrix.group }}
- name: print JVM thread dumps when cancelled
if: cancelled()
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps
- name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
if: ${{ always() }}
uses: ./.github/actions/copy-test-reports
- name: Publish Test Report
uses: apache/pulsar-test-infra/action-junit-report@master
if: ${{ always() }}
with:
report_paths: 'test-reports/TEST-*.xml'
annotate_only: 'true'
- name: Upload Surefire reports
uses: actions/upload-artifact@v3
if: ${{ !success() }}
with:
name: Unit-${{ matrix.group }}-surefire-reports
path: surefire-reports
retention-days: 7
- name: Upload possible heap dump, core dump or crash files
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: Unit-${{ matrix.group }}-dumps
path: |
/tmp/*.hprof
**/hs_err_*.log
**/core.*
retention-days: 7
if-no-files-found: ignore
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
unit-tests-upload-coverage:
name: CI - Unit - Upload Coverage
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: ['preconditions', 'unit-tests']
if: ${{ needs.preconditions.outputs.collect_coverage == 'true' }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache Maven dependencies
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK ${{ matrix.jdk || '17' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh snapshot_pulsar_maven_artifacts
- name: Restore coverage files from build artifacts and create Jacoco reports
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_unittest_coverage_files
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh create_test_coverage_report
cd $GITHUB_WORKSPACE/target
zip -qr jacoco_test_coverage_report_unittests.zip jacoco_test_coverage_report || true
- name: Upload Jacoco report files to build artifacts
uses: actions/upload-artifact@v3
with:
name: Jacoco-coverage-report-unittests
path: target/jacoco_test_coverage_report_unittests.zip
retention-days: 3
- name: Upload to Codecov
uses: ./.github/actions/upload-coverage
with:
flags: unittests
- name: Delete coverage files from build artifacts
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh delete_unittest_coverage_files
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
pulsar-java-test-image:
name: Build Pulsar java-test-image docker image
runs-on: ubuntu-22.04
timeout-minutes: 60
needs: ['preconditions', 'build-and-license-check']
if: ${{ needs.preconditions.outputs.docs_only != 'true'}}
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache Maven dependencies
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
- name: Pick ubuntu mirror for the docker image build
run: |
# pick the closest ubuntu mirror and set it to UBUNTU_MIRROR environment variable
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh pick_ubuntu_mirror
- name: Build java-test-image docker image
run: |
# build docker image
mvn -B -am -pl tests/docker-images/java-test-image install -Pcore-modules,-main,integrationTests,docker \
-Dmaven.test.skip=true -Ddocker.squash=true -DskipSourceReleaseAssembly=true \
-Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true
- name: save docker image apachepulsar/java-test-image:latest to Github artifact cache
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_save_image_to_github_actions_artifacts apachepulsar/java-test-image:latest pulsar-java-test-image
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
integration-tests:
name: CI - Integration - ${{ matrix.name }}
runs-on: ubuntu-22.04
timeout-minutes: ${{ matrix.timeout || 60 }}
needs: ['preconditions', 'pulsar-java-test-image']
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
env:
JOB_NAME: CI - Integration - ${{ matrix.name }}
PULSAR_TEST_IMAGE_NAME: apachepulsar/java-test-image:latest
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- name: Backwards Compatibility
group: BACKWARDS_COMPAT
no_coverage: true
- name: Cli
group: CLI
- name: Messaging
group: MESSAGING
- name: LoadBalance
group: LOADBALANCE
no_coverage: true
- name: Shade on Java 8
group: SHADE_RUN
runtime_jdk: 8
setup: ./build/run_integration_group.sh SHADE_BUILD
no_coverage: true
- name: Shade on Java 11
group: SHADE_RUN
runtime_jdk: 11
setup: ./build/run_integration_group.sh SHADE_BUILD
no_coverage: true
- name: Shade on Java 17
group: SHADE_RUN
setup: ./build/run_integration_group.sh SHADE_BUILD
no_coverage: true
- name: Standalone
group: STANDALONE
- name: Transaction
group: TRANSACTION
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache Maven dependencies
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh snapshot_pulsar_maven_artifacts
- name: Load docker image apachepulsar/java-test-image:latest from Github artifact cache
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_load_image_from_github_actions_artifacts pulsar-java-test-image
- name: Run setup commands
if: ${{ matrix.setup }}
run: |
${{ matrix.setup }}
- name: Set up runtime JDK ${{ matrix.runtime_jdk }}
uses: actions/setup-java@v3
if: ${{ matrix.runtime_jdk }}
with:
distribution: 'temurin'
java-version: ${{ matrix.runtime_jdk }}
- name: Run integration test group '${{ matrix.group }}'
run: |
if [[ "${{ matrix.no_coverage }}" != "true" && "${{ needs.preconditions.outputs.collect_coverage }}" == "true" ]]; then
coverage_args="--coverage"
fi
./build/run_integration_group.sh ${{ matrix.group }} $coverage_args
- name: Upload coverage to build artifacts
if: ${{ !matrix.no_coverage && needs.preconditions.outputs.collect_coverage == 'true' }}
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh upload_inttest_coverage_files ${{ matrix.group }}
- name: print JVM thread dumps when cancelled
if: cancelled()
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps
- name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
if: ${{ always() }}
uses: ./.github/actions/copy-test-reports
- name: Publish Test Report
uses: apache/pulsar-test-infra/action-junit-report@master
if: ${{ always() }}
with:
report_paths: 'test-reports/TEST-*.xml'
annotate_only: 'true'
- name: Upload Surefire reports
uses: actions/upload-artifact@v3
if: ${{ !success() }}
with:
name: Integration-${{ matrix.group }}-surefire-reports
path: surefire-reports
retention-days: 7
- name: Upload container logs
uses: actions/upload-artifact@v3
if: ${{ !success() }}
continue-on-error: true
with:
name: Integration-${{ matrix.group }}-container-logs
path: tests/integration/target/container-logs
retention-days: 7
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
integration-tests-upload-coverage:
name: CI - Integration - Upload Coverage
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: ['preconditions', 'integration-tests']
if: ${{ needs.preconditions.outputs.collect_coverage == 'true' }}
env:
PULSAR_TEST_IMAGE_NAME: apachepulsar/java-test-image:latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache Maven dependencies
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh snapshot_pulsar_maven_artifacts
- name: Load docker image apachepulsar/java-test-image:latest from Github artifact cache
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_load_image_from_github_actions_artifacts pulsar-java-test-image
- name: Restore coverage files from build artifacts and create Jacoco reports
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_inttest_coverage_files
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh create_inttest_coverage_report
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh create_test_coverage_report
cd $GITHUB_WORKSPACE/target
zip -qr jacoco_test_coverage_report_inttests.zip jacoco_test_coverage_report jacoco_inttest_coverage_report || true
- name: Upload Jacoco report files to build artifacts
uses: actions/upload-artifact@v3
with:
name: Jacoco-coverage-report-inttests
path: target/jacoco_test_coverage_report_inttests.zip
retention-days: 3
- name: Upload to Codecov
uses: ./.github/actions/upload-coverage
with:
flags: inttests
- name: Delete coverage files from build artifacts
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh delete_inttest_coverage_files
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
delete-integration-test-docker-image-artifact:
name: "Delete integration test docker image artifact"
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: [
'preconditions',
'integration-tests',
'integration-tests-upload-coverage'
]
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Delete docker image from GitHub Actions Artifacts
run: |
gh-actions-artifact-client.js delete pulsar-java-test-image.zst
pulsar-test-latest-version-image:
name: Build Pulsar docker image
runs-on: ubuntu-22.04
timeout-minutes: 60
needs: ['preconditions', 'build-and-license-check']
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Clean Disk
uses: ./.github/actions/clean-disk
with:
mode: full
- name: Cache local Maven repository
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-all-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
- name: Pick ubuntu mirror for the docker image build
run: |
# pick the closest ubuntu mirror and set it to UBUNTU_MIRROR environment variable
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh pick_ubuntu_mirror
- name: Build latest-version-image docker image
run: |
# build docker image
# include building of Pulsar SQL, Connectors, Offloaders and server distros
mvn -B -am -pl pulsar-sql/presto-distribution,distribution/io,distribution/offloaders,distribution/server,distribution/shell,tests/docker-images/latest-version-image install \
-DUBUNTU_MIRROR="${UBUNTU_MIRROR}" -DUBUNTU_SECURITY_MIRROR="${UBUNTU_SECURITY_MIRROR}" \
-Pmain,docker -Dmaven.test.skip=true -Ddocker.squash=true \
-Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true
# check full build artifacts licenses
# - name: Check binary licenses
# run: src/check-binary-license.sh ./distribution/server/target/apache-pulsar-*-bin.tar.gz && src/check-binary-license.sh ./distribution/shell/target/apache-pulsar-shell-*-bin.tar.gz
- name: Clean up disk space
run: |
# release disk space since saving docker image consumes local disk space
#
echo "::group::Available diskspace before cleaning"
time df -BM / /mnt
echo "::endgroup::"
echo "::group::Clean build directory"
# docker build changes some files to root ownership, fix this before deleting files
sudo chown -R $USER:$GROUP .
# clean build directories
time git clean -fdx
echo "::endgroup::"
echo "::group::Available diskspace after cleaning build directory"
time df -BM / /mnt
echo "::endgroup::"
echo "::group::Delete maven repository"
# delete maven repository
time rm -rf ~/.m2/repository
echo "::endgroup::"
echo "::group::Available diskspace after cleaning maven repository"
time df -BM / /mnt
echo "::endgroup::"
- name: save docker image apachepulsar/pulsar-test-latest-version:latest to Github artifact cache
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_save_image_to_github_actions_artifacts apachepulsar/pulsar-test-latest-version:latest pulsar-test-latest-version-image
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
system-tests:
name: CI - System - ${{ matrix.name }}
runs-on: ubuntu-22.04
timeout-minutes: 60
needs: ['preconditions', 'pulsar-test-latest-version-image']
if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
env:
JOB_NAME: CI - System - ${{ matrix.name }}
PULSAR_TEST_IMAGE_NAME: apachepulsar/pulsar-test-latest-version:latest
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- name: Tiered FileSystem
group: TIERED_FILESYSTEM
- name: Tiered JCloud
group: TIERED_JCLOUD
- name: Function
group: FUNCTION
- name: Schema
group: SCHEMA
- name: Pulsar Connectors - Thread
group: PULSAR_CONNECTORS_THREAD
- name: Pulsar Connectors - Process
group: PULSAR_CONNECTORS_PROCESS
- name: Pulsar IO
group: PULSAR_IO
clean_disk: true
- name: Sql
group: SQL
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Clean Disk when needed
if: ${{ matrix.clean_disk }}
uses: ./.github/actions/clean-disk
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true
with:
limit-access-to-actor: true
- name: Cache local Maven repository
uses: actions/cache@v3
timeout-minutes: 5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/pulsar
key: ${{ runner.os }}-m2-dependencies-all-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
- name: Restore maven build results from Github artifact cache
run: |
cd $HOME
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh restore_tar_from_github_actions_artifacts pulsar-maven-repository-binaries
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh snapshot_pulsar_maven_artifacts
- name: Load docker image apachepulsar/pulsar-test-latest-version:latest from Github artifact cache
run: |
$GITHUB_WORKSPACE/build/pulsar_ci_tool.sh docker_load_image_from_github_actions_artifacts pulsar-test-latest-version-image
- name: Run setup commands
if: ${{ matrix.setup }}
run: |
${{ matrix.setup }}
- name: Run system test group '${{ matrix.group }}'
run: |
if [[ "${{ matrix.no_coverage }}" != "true" && "${{ needs.preconditions.outputs.collect_coverage }}" == "true" ]]; then
coverage_args="--coverage"
fi
./build/run_integration_group.sh ${{ matrix.group }} $coverage_args
- name: Upload coverage to build artifacts
if: ${{ !matrix.no_coverage && needs.preconditions.outputs.collect_coverage == 'true' }}
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh upload_systest_coverage_files ${{ matrix.group }}
- name: print JVM thread dumps when cancelled
if: cancelled()
run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps
- name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
if: ${{ always() }}
uses: ./.github/actions/copy-test-reports
- name: Publish Test Report
uses: apache/pulsar-test-infra/action-junit-report@master
if: ${{ always() }}
with:
report_paths: 'test-reports/TEST-*.xml'
annotate_only: 'true'
- name: Upload container logs
uses: actions/upload-artifact@v3
if: ${{ !success() }}
continue-on-error: true
with:
name: System-${{ matrix.group }}-container-logs
path: tests/integration/target/container-logs
retention-days: 7
- name: Upload Surefire reports
uses: actions/upload-artifact@v3
if: ${{ !success() }}
with:
name: System-${{ matrix.name }}-surefire-reports
path: surefire-reports
retention-days: 7
- name: Wait for ssh connection when build fails
# ssh access is enabled for builds in own forks
uses: ./.github/actions/ssh-access
if: ${{ failure() && github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
continue-on-error: true
with:
action: wait
system-tests-upload-coverage:
name: CI - System - Upload Coverage
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: ['preconditions', 'system-tests']
if: ${{ needs.preconditions.outputs.collect_coverage == 'true' }}
env:
PULSAR_TEST_IMAGE_NAME: apachepulsar/pulsar-test-latest-version:latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Tune Runner VM
uses: ./.github/actions/tune-runner-vm
- name: Setup ssh access to build runner VM
# ssh access is enabled for builds in own forks
if: ${{ github.repository != 'apache/pulsar' && github.event_name == 'pull_request' }}
uses: ./.github/actions/ssh-access
continue-on-error: true