forked from firebase/firebase-cpp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
983 lines (969 loc) · 44.7 KB
/
integration_tests.yml
File metadata and controls
983 lines (969 loc) · 44.7 KB
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
name: Integration tests
on:
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT
pull_request:
types: [ labeled, closed ]
workflow_dispatch:
inputs:
platforms:
description: 'CSV of Desktop, Android, iOS and/or tvOS'
default: 'Desktop,Android,iOS,tvOS'
required: true
apis:
description: 'CSV of apis to build and test'
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
operating_systems:
description: 'CSV of VMs to run on'
default: 'ubuntu-latest,windows-latest,macos-latest'
required: true
desktop_ssl_variants:
description: 'CSV of desktop SSL variants to use'
default: 'openssl,boringssl'
required: true
mobile_test_on:
description: 'Run mobile tests on real and/or virtual devices? (separated by commas)'
default: 'real,virtual'
required: true
use_expanded_matrix:
description: 'Use an expanded matrix? Note: above config will be ignored.'
default: '0'
required: true
test_packaged_sdk:
description: 'Optional: Packaging run # to build against?'
test_pull_request:
description: 'Optional: Pull request # to build and test? (With optional commit hash, separated by a colon. Specify the FULL hash.)'
env:
triggerLabelPrefix: "tests-requested: "
triggerLabelFull: "tests-requested: full"
triggerLabelQuick: "tests-requested: quick"
statusLabelInProgress: "tests: in-progress"
statusLabelFailed: "tests: failed"
statusLabelSucceeded: "tests: succeeded"
statusCommentIdentifier: "integration-test-status-comment"
pythonVersion: '3.7'
artifactRetentionDays: 2
jobs:
check_trigger:
### This job runs when the workflow was triggered by 1) PR getting labeled
### 2) PR merged & closed 3) or manumlly triggered with Pull request #.
### If triggered by label, then checks whether the label is a test-request
### trigger (cancelling the workflow if not).
### It sets outputs to control the build_* matrix (full or quick) and to tell
### subsequent steps to update the labels as well.
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request' || github.event.inputs.test_pull_request != ''
outputs:
should_update_pr: ${{ steps.set_outputs.outputs.should_update_pr }}
requested_tests: ${{ steps.set_outputs.outputs.requested_tests }}
pr_number: ${{ steps.get_pr_number.outputs.pr_number }}
steps:
### If the label isn't 1)the test-request triggers, 2) closed on merge trigger, cancel the workflow.
- name: Cancel workflow
if: (github.event.action == 'labeled' && !startsWith(github.event.label.name, env.triggerLabelPrefix)) || (github.event.action == 'closed' && github.event.pull_request.merged != true)
uses: andymckay/cancel-action@0.2
- name: Wait for above cancellation
if: (github.event.action == 'labeled' && !startsWith(github.event.label.name, env.triggerLabelPrefix)) || (github.event.action == 'closed' && github.event.pull_request.merged != true)
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- id: get_pr_number
run: |
# In this step, github_ref is only used for the status message below.
# It will be recalculated in prepare_matrix.
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "::set-output name=pr_number::${{ github.event.pull_request.number }}"
echo "::set-output name=github_ref::$GITHUB_SHA"
elif [[ "${{github.event.inputs.test_pull_request}}" == *:* ]]; then
# If specified as pr:commit_hash, split them.
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
echo "::set-output name=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
else
# Just a PR number.
echo "::set-output name=pr_number::${{ github.event.inputs.test_pull_request }}"
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
fi
- name: Cancel previous runs on the same PR
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
- name: Remove triggering label
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ github.token }}
number: "${{ steps.get_pr_number.outputs.pr_number }}"
labels: "${{ github.event.label.name }}"
### Fail the workflow if the user does not have admin access to run the tests.
- name: Check if user has permission to trigger tests
uses: lannonbr/repo-permission-check-action@2.0.0
with:
permission: "admin"
env:
GITHUB_TOKEN: ${{ github.token }}
- id: set_outputs
run: |
echo "::set-output name=should_update_pr::1"
if [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelFull }}" ]]; then
echo "::set-output name=requested_tests::full"
elif [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelQuick }}" ]]; then
echo "::set-output name=requested_tests::auto"
else
# For manual PR testing, use auto mode.
echo "::set-output name=requested_tests::auto"
fi
### Add the in-progress label and remove any previous success/fail labels.
- uses: actions/checkout@v2
with:
ref: ${{steps.get_pr_number.outputs.github_ref}}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Update PR label and comment
run: |
python scripts/gha/it_workflow.py --stage start \
--token ${{github.token}} \
--issue_number ${{steps.get_pr_number.outputs.pr_number}} \
--actor ${{github.actor}} \
--commit ${{steps.get_pr_number.outputs.github_ref}} \
--run_id ${{github.run_id}}
# To feed input into the job matrix, we first need to convert to a JSON
# list. Then we can use fromJson to define the field in the matrix for the tests job.
prepare_matrix:
runs-on: ubuntu-latest
needs: check_trigger
if: ${{ !cancelled() && !failure() }} # Run even if check_trigger was skipped.
outputs:
matrix_platform: ${{ steps.export-result.outputs.matrix_platform }}
matrix_os: ${{ steps.export-result.outputs.matrix_os }}
matrix_ssl: ${{ steps.export-result.outputs.matrix_ssl }}
apis: ${{ steps.export-result.outputs.apis }}
mobile_test_on: ${{ steps.export-result.outputs.mobile_test_on }}
android_device: ${{ steps.export-result.outputs.android_device }}
ios_device: ${{ steps.export-result.outputs.ios_device }}
tvos_device: ${{ steps.export-result.outputs.tvos_device }}
github_ref: ${{ steps.export-result.outputs.github_ref }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: false
- name: Use expanded matrix
if: github.event.inputs.use_expanded_matrix == '1' || needs.check_trigger.outputs.requested_tests == 'full'
run: |
echo "EXPANDED_MATRIX_PARAM=-e=1" >> $GITHUB_ENV
- name: Set auto-diff option if specified.
if: needs.check_trigger.outputs.requested_tests == 'auto'
run: |
echo "Autodetecting which tests to run."
if [[ -n "${{github.event.inputs.test_pull_request}}" ]]; then
# If running this manually, diff against main.
echo "AUTO_DIFF_PARAM=--auto_diff main" >> $GITHUB_ENV
else
# If running in a PR, diff against the PR's base.
echo "AUTO_DIFF_PARAM=--auto_diff ${{github.event.pull_request.base.sha}}" >> $GITHUB_ENV
fi
- id: export-result
# e.g. 'ubuntu-latest,macos-latest' -> '["ubuntu-latest","macos-latest"]'
run: |
echo "::set-output name=apis::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -o "${{github.event.inputs.apis}}" ${AUTO_DIFF_PARAM})"
echo "::set-output name=matrix_platform::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k platform -o "${{github.event.inputs.platforms}}" ${AUTO_DIFF_PARAM})"
echo "::set-output name=matrix_os::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k os -o "${{github.event.inputs.operating_systems}}" ${AUTO_DIFF_PARAM})"
# If building against a packaged SDK, only use boringssl.
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
echo "::warning ::Downloading SDK package from previous run: https://github.com/${{github.repository}}/actions/runs/${{ github.event.inputs.test_packaged_sdk }}"
# Because the mobile tests require this value to be set to 'openssl', set it to 'openssl' here. It won't actually matter later.
echo "::set-output name=matrix_ssl::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ssl_lib -o openssl )"
else
echo "::set-output name=matrix_ssl::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ssl_lib -o "${{github.event.inputs.desktop_ssl_variants}}" )"
fi
mobile_test_on=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k mobile_test_on -o "${{github.event.inputs.mobile_test_on}}")
echo "::set-output name=mobile_test_on::${mobile_test_on}"
echo "::set-output name=android_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k android_device -t ${mobile_test_on} )"
echo "::set-output name=ios_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ios_device -t ${mobile_test_on} )"
echo "::set-output name=tvos_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k tvos_device -t ${mobile_test_on} )"
if [[ -z "${{github.event.inputs.test_pull_request}}" ]]; then
echo "::warning ::Running on https://github.com/${{github.repository}}/commits/$GITHUB_SHA"
echo "::set-output name=github_ref::$GITHUB_SHA"
elif [[ "${{github.event.inputs.test_pull_request}}" == *:* ]]; then
# If specified as pr:commit_hash, split them to get the exact hash.
echo "::warning ::Running on https://github.com/${{github.repository}}/pull/$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1) on commit https://github.com/${{github.repository}}/commit/$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
echo "::set-output name=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
else
# Just the PR specified, use refs/pull/<number>/merge as the ref.
echo "::warning ::Running on https://github.com/${{github.repository}}/pull/${{github.event.inputs.test_pull_request}}"
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
fi
build_desktop:
name: build-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
needs: [check_trigger, prepare_matrix]
runs-on: ${{ matrix.os }}
# Skip this if there is an empty matrix (which can happen if "auto" was set above).
# But check cancelled() && !failure() so it runs even if check_trigger was skipped.
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Desktop') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
ssl_variant: ${{ fromJson(needs.prepare_matrix.outputs.matrix_ssl) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Set env vars (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
- name: Set env vars (macOS)
if: startsWith(matrix.os, 'macos')
run: echo "VCPKG_TRIPLET=x64-osx" >> $GITHUB_ENV
- name: Set env vars (Windows)
shell: bash
if: startsWith(matrix.os, 'windows')
run: echo "VCPKG_TRIPLET=x64-windows-static" >> $GITHUB_ENV
- name: Set env vars (all)
shell: bash
run: echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt" >> $GITHUB_ENV
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.0.2
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v2
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ env.VCPKG_TRIPLET }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
if: startsWith(matrix.os, 'macos')
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK Desktop prerequisites
run: |
python scripts/gha/install_prereqs_desktop.py
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Install OpenSSL (Windows)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'windows')
run: |
choco install openssl -r
- name: Install OpenSSL (macOS)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'macos')
run: |
brew install openssl
# brew won't overwrite MacOS system default OpenSSL, so force it here.
echo "OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1" >> $GITHUB_ENV
- name: Install OpenSSL (Linux)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'ubuntu')
run: |
sudo apt install openssl
- name: Fetch prebuilt packaged SDK from previous run
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.inputs.test_packaged_sdk != '' }}
with:
name: 'firebase_cpp_sdk.zip'
workflow: 'cpp-packaging.yml'
run_id: ${{ github.event.inputs.test_packaged_sdk }}
- name: Build integration tests
shell: bash
run: |
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
unzip -q firebase_cpp_sdk.zip -d downloaded_sdk/
additional_flags+=(--packaged_sdk downloaded_sdk/firebase_cpp_sdk)
else
# Building integration tests against the SDK source.
#
# When building the SDK from source, the default SSL is openssl.
# To build using boringssl, a cmake flag must be added:
if [[ "${{ matrix.ssl_variant }}" == "boringssl" ]]; then
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
fi
fi
python scripts/gha/build_testapps.py --p Desktop \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload Desktop integration tests artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
path: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload Desktop build results artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Cleanup Local Copies of Uploaded Artifacts
shell: bash
run: |
rm -rf testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
- name: Set CLOUDSDK_PYTHON (Windows)
shell: bash
if: startsWith(matrix.os, 'windows') && !cancelled()
run: echo "CLOUDSDK_PYTHON=${{env.pythonLocation}}\python.exe" >> $GITHUB_ENV
- name: Install Cloud SDK
if: ${{ !cancelled() }}
uses: google-github-actions/setup-gcloud@master
- name: Upload Desktop Artifacts to GCS
shell: bash
if: ${{ !cancelled() }}
run: |
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
shell: bash
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
pushd ${{env.GCS_UPLOAD_DIR}}
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_android:
name: build-android-${{ matrix.os }}
needs: [check_trigger, prepare_matrix]
runs-on: ${{ matrix.os }}
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Android') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.0.2
- name: Cache NDK
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
if: startsWith(matrix.os, 'macos')
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK Android prerequisites
shell: bash
run: |
build_scripts/android/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK from previous run
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.inputs.test_packaged_sdk != '' }}
with:
name: 'firebase_cpp_sdk.zip'
workflow: 'cpp-packaging.yml'
run_id: ${{ github.event.inputs.test_packaged_sdk }}
- name: Build integration tests
shell: bash
run: |
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
cd downloaded_sdk
unzip -q ../firebase_cpp_sdk.zip
cd ..
additional_flags+=(--packaged_sdk downloaded_sdk/firebase_cpp_sdk)
fi
python scripts/gha/build_testapps.py --p Android \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "android-${{ matrix.os }}" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload Android integration tests artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: testapps-android-${{ matrix.os }}
path: testapps-android-${{ matrix.os }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload Android build results artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-android-${{ matrix.os }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-android-${{ matrix.os }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_ios:
name: build-ios-macos-latest
needs: [check_trigger, prepare_matrix]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'iOS') && contains(needs.prepare_matrix.outputs.matrix_os, 'macos-latest') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK iOS prerequisites
run: build_scripts/ios/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK from previous run
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.inputs.test_packaged_sdk != '' }}
with:
name: 'firebase_cpp_sdk.zip'
workflow: 'cpp-packaging.yml'
run_id: ${{ github.event.inputs.test_packaged_sdk }}
- name: Build integration tests
shell: bash
run: |
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
cd downloaded_sdk
unzip -q ../firebase_cpp_sdk.zip
cd ..
additional_flags+=(--packaged_sdk downloaded_sdk/firebase_cpp_sdk)
fi
python scripts/gha/build_testapps.py --p iOS \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--ios_sdk ${{ needs.prepare_matrix.outputs.mobile_test_on }} \
--artifact_name "ios-macos-latest" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload iOS integration tests artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: testapps-ios-macos-latest
path: testapps-ios-macos-latest
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload iOS build results artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-ios-macos-latest*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-ios-macos-latest.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_tvos:
name: build-tvos-macos-latest
needs: [check_trigger, prepare_matrix]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'tvOS') && contains(needs.prepare_matrix.outputs.matrix_os, 'macos-latest') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK tvOS prerequisites
run: build_scripts/tvos/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK from previous run
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.inputs.test_packaged_sdk != '' }}
with:
name: 'firebase_cpp_sdk.zip'
workflow: 'cpp-packaging.yml'
run_id: ${{ github.event.inputs.test_packaged_sdk }}
- name: Build integration tests
shell: bash
run: |
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
cd downloaded_sdk
unzip -q ../firebase_cpp_sdk.zip
cd ..
additional_flags+=(--packaged_sdk downloaded_sdk/firebase_cpp_sdk)
fi
python scripts/gha/build_testapps.py --p tvOS \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "tvos-macos-latest" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload tvOS integration tests artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: testapps-tvos-macos-latest
path: testapps-tvos-macos-latest
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload tvOS build results artifact
uses: actions/upload-artifact@v2.2.2
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-tvos-macos-latest*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-tvos-macos-latest.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_desktop:
name: test-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
needs: [check_trigger, prepare_matrix, build_desktop]
runs-on: ${{ matrix.os }}
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Desktop') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
ssl_variant: ${{ fromJson(needs.prepare_matrix.outputs.matrix_ssl) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download Desktop integration tests artifact
uses: actions/download-artifact@v2.0.8
with:
path: testapps
name: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Setup integration test deps
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}" --artifact testapps
- name: Run Desktop integration tests
run: python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}"
- name: Upload Desktop test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v2.2.2
with:
name: log-artifact
path: testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_android:
name: test-android-${{ matrix.build_os }}-${{ matrix.android_device }}
needs: [check_trigger, prepare_matrix, build_android]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Android') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
build_os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
android_device: ${{ fromJson(needs.prepare_matrix.outputs.android_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download Android integration tests artifact
uses: actions/download-artifact@v2.0.8
with:
path: testapps
name: testapps-android-${{ matrix.build_os }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- id: get-device-type
run: |
echo "::set-output name=device_type::$( python scripts/gha/print_matrix_configuration.py -d -k ${{ matrix.android_device }} )"
- name: Run Android integration tests on Emulator locally
if: steps.get-device-type.outputs.device_type == 'virtual'
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--android_device "${{ matrix.android_device }}" \
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
--ci
- name: Install Cloud SDK
if: steps.get-device-type.outputs.device_type == 'real'
uses: google-github-actions/setup-gcloud@master
- name: Run Android integration tests on Real Device via FTL
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--android_device "${{ matrix.android_device }}" \
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
- name: Upload Android test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v2.2.2
with:
name: log-artifact
path: testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_ios:
name: test-ios-macos-latest-${{ matrix.ios_device }}
needs: [check_trigger, prepare_matrix, build_ios]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'iOS') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
ios_device: ${{ fromJson(needs.prepare_matrix.outputs.ios_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download iOS integration tests artifact
uses: actions/download-artifact@v2.0.8
with:
path: testapps
name: testapps-ios-macos-latest
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- id: get-device-type
run: |
echo "::set-output name=device_type::$( python scripts/gha/print_matrix_configuration.py -d -k ${{ matrix.ios_device }} )"
- name: Run iOS integration tests on Simulator locally
if: steps.get-device-type.outputs.device_type == 'virtual'
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--ios_device "${{ matrix.ios_device }}" \
--logfile_name "ios-macos-latest-${{ matrix.ios_device }}" \
--ci
- name: Install Cloud SDK
if: steps.get-device-type.outputs.device_type == 'real'
uses: google-github-actions/setup-gcloud@master
- name: Run iOS integration tests on Real Device via FTL
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--ios_device "${{ matrix.ios_device }}" \
--logfile_name "ios-macos-latest-${{ matrix.ios_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
- name: Upload iOS test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v2.2.2
with:
name: log-artifact
path: testapps/test-results-ios-macos-latest-${{ matrix.ios_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-ios-macos-latest-${{ matrix.ios_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_tvos:
name: test-tvos-macos-latest-${{ matrix.tvos_device }}
needs: [check_trigger, prepare_matrix, build_tvos]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'tvOS') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
tvos_device: ${{ fromJson(needs.prepare_matrix.outputs.tvos_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download tvOS integration tests artifact
uses: actions/download-artifact@v2.0.8
with:
path: testapps
name: testapps-tvos-macos-latest
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Run tvOS integration tests on Simulator locally
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--tvos_device "${{ matrix.tvos_device }}" \
--logfile_name "tvos-macos-latest-${{ matrix.tvos_device }}" \
--ci
- name: Upload tvOS test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v2.2.2
with:
name: log-artifact
path: testapps/test-results-tvos-macos-latest-${{ matrix.tvos_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-tvos-macos-latest-${{ matrix.tvos_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
summarize_results:
name: "summarize-results"
needs: [check_trigger, prepare_matrix, test_desktop, test_android, test_ios, test_tvos]
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Download log artifacts
uses: actions/download-artifact@v2.0.8
with:
path: test_results
name: log-artifact
# Use a different token to remove the "in-progress" label,
# to allow the removal to trigger the "Check Labels" workflow.
- name: Generate token for GitHub API
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr }}
run: |
python scripts/gha/it_workflow.py --stage end \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}} \
--new_token ${{steps.generate-token.outputs.token}}
- name: Update Daily Report
if: ${{ github.event_name == 'schedule' }}
run: |
python scripts/gha/it_workflow.py --stage report \
--token ${{github.token}} \
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize results into GitHub log
run: python scripts/gha/summarize_test_results.py --dir test_results --github_log