-
Notifications
You must be signed in to change notification settings - Fork 114
1562 lines (1541 loc) · 73.5 KB
/
integration_tests.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
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
name: Integration tests
on:
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT. for all testapps except firestore
- cron: "0 10 * * *" # 10am UTC = 2am PST / 3am PDT. for firestore test against release iOS/Android SDK
- cron: "0 11 * * *" # 11am UTC = 3am PST / 4am PDT. for firestore desktop test aginst tip-of-tree iOS repo
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: 'analytics,app_check,auth,database,dynamic_links,firestore,functions,gma,installations,messaging,remote_config,storage'
required: true
operating_systems:
description: 'CSV of VMs to run on'
default: 'ubuntu-20.04,windows-latest,macos-13'
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.)'
firestore_dep_source:
description: 'Optional: Where to get firestore iOS SDK from: "RELEASED", "TIP" or "<git-commit> from firestore-ios-sdk"'
env:
triggerLabelPrefix: "tests-requested: "
triggerLabelFull: "tests-requested: full"
triggerLabelQuick: "tests-requested: quick"
pythonVersion: '3.8'
xcodeVersion: '15.1'
artifactRetentionDays: 2
GITHUB_TOKEN: ${{ github.token }}
# All self-hosted ARM Mac runners should have this label. Due to how
# our custom reporting works, it must be exactly two words separated
# by a hyphen. The first word must be "macos". The second word will
# be omitted from the summary log.
runnerLabelMacArm64: "macos-m1custom"
jobs:
check_and_prepare:
runs-on: ubuntu-20.04
outputs:
trigger: ${{ steps.set_outputs.outputs.trigger }}
github_ref: ${{ steps.set_outputs.outputs.github_ref }}
pr_number: ${{ steps.set_outputs.outputs.pr_number }}
matrix_platform: ${{ steps.matrix_config.outputs.matrix_platform }}
matrix_os: ${{ steps.matrix_config.outputs.matrix_os }}
matrix_arch_macos: ${{ steps.matrix_config.outputs.matrix_arch_macos }}
matrix_arch_windows_linux: ${{ steps.matrix_config.outputs.matrix_arch_windows_linux }}
matrix_arch_combined: ${{ steps.matrix_config.outputs.matrix_arch_combined }}
matrix_ssl: ${{ steps.matrix_config.outputs.matrix_ssl }}
apis: ${{ steps.matrix_config.outputs.apis }}
mobile_test_on: ${{ steps.matrix_config.outputs.mobile_test_on }}
android_device: ${{ steps.matrix_config.outputs.android_device }}
xcode_version: ${{ steps.matrix_config.outputs.xcode_version }}
ios_device: ${{ steps.matrix_config.outputs.ios_device }}
tvos_device: ${{ steps.matrix_config.outputs.tvos_device }}
# Copy the runner label here because matrix specifiers cannot see env.
runner_label_macos_arm64: ${{ env.runnerLabelMacArm64 }}
steps:
### 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"
### It sets "github_ref,trigger,pr_number,requested_tests" outputs to control the following jobs and steps
### trigger value: manual_trigger, scheduled_trigger, label_trigger, postsubmit_trigger
- id: set_outputs
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.test_pull_request }}" != "nightly-packaging" ]]; then
# Triggered manually
echo "trigger=manual_trigger" >> $GITHUB_OUTPUT
if [[ "${{ github.event.inputs.use_expanded_matrix }}" == "1" ]]; then
echo "requested_tests=expanded" >> $GITHUB_OUTPUT
fi
if [[ -z "${{github.event.inputs.test_pull_request}}" ]]; then
# test_pull_request not specified
echo "github_ref=$GITHUB_SHA" >> $GITHUB_OUTPUT
elif [[ "${{github.event.inputs.test_pull_request}}" == *:* ]]; then
# If specified as pr:commit_hash, split them.
echo "github_ref=$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)" >> $GITHUB_OUTPUT
echo "pr_number=$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)" >> $GITHUB_OUTPUT
else
# Just the PR specified, use refs/pull/<number>/merge as the ref.
echo "github_ref=refs/pull/${{github.event.inputs.test_pull_request}}/merge" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.inputs.test_pull_request }}" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event.inputs.test_pull_request }}" == "nightly-packaging" ]]; then
# Triggered by scheduled packaging SDK workflow.
echo "trigger=scheduled_trigger" >> $GITHUB_OUTPUT
echo "github_ref=$GITHUB_SHA" >> $GITHUB_OUTPUT
echo "requested_tests=expanded" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "trigger=scheduled_trigger" >> $GITHUB_OUTPUT
echo "github_ref=$GITHUB_SHA" >> $GITHUB_OUTPUT
echo "requested_tests=expanded" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "github_ref=$GITHUB_SHA" >> $GITHUB_OUTPUT
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "${{ env.triggerLabelPrefix }}"* ]]; then
echo "trigger=label_trigger" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
if [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelQuick }}" ]]; then
echo "requested_tests=auto" >> $GITHUB_OUTPUT
else
echo "requested_tests=expanded" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
echo "trigger=postsubmit_trigger" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "requested_tests=auto" >> $GITHUB_OUTPUT
fi
fi
### If it's not a defined trigger, cancel workflow
### e.g. Triggered by non-"test-request" label; triggered by not merged PR close event.
- name: Cancel workflow
if: ${{ !steps.set_outputs.outputs.trigger }}
uses: andymckay/cancel-action@0.2
- name: Wait for workflow cancellation
if: ${{ !steps.set_outputs.outputs.trigger }}
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- name: Cancel previous runs on the same PR
if: steps.set_outputs.outputs.trigger == 'label_trigger'
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
ref: ${{steps.set_outputs.outputs.github_ref}}
fetch-depth: 0
submodules: false
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
uses: nick-invision/retry@v2
with:
timeout_minutes: 1
max_attempts: 3
shell: bash
command: pip install -r scripts/gha/python_requirements.txt
- id: matrix_config
env:
HEAD_REF: ${{github.event.pull_request.head.ref}}
BASE_REF: ${{github.event.pull_request.base.ref}}
run: |
if [[ "${{ steps.set_outputs.outputs.requested_tests }}" == "expanded" ]]; then
TEST_MATRIX_PARAM=-e=1
echo "::warning ::Running on the expanded matrix"
elif [[ "${{ steps.set_outputs.outputs.requested_tests }}" == "minimal" ]]; then
TEST_MATRIX_PARAM=-m=1
echo "::warning ::Running on the minimal matrix"
elif [[ "${{ steps.set_outputs.outputs.requested_tests }}" == "auto" ]]; then
# auto-diff only apply when running in a PR.
# diff against the PR's base. "git merge-base main branch_name" will give the common ancestor of both branches.
MERGE_BASE=$(git merge-base "origin/${HEAD_REF}" "origin/${BASE_REF}" || true)
# If origin/<branch> is no longer valid, then just run all tests.
if [[ -n "${MERGE_BASE}" ]]; then
echo "::warning ::Auto-diff origin/${HEAD_REF}..${MERGE_BASE}"
git diff --name-only "origin/${HEAD_REF}..${MERGE_BASE}"
TEST_MATRIX_PARAM="--auto_diff origin/${HEAD_REF}..${MERGE_BASE}"
fi
fi
# 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.
if [[ "${{ github.event.schedule }}" == "0 9 * * *" ]]; then
# at 1am PST/2am PDT. Running integration tests and generate test report for all testapps except firestore
apis="analytics,app_check,auth,database,dynamic_links,functions,gma,installations,messaging,remote_config,storage"
echo "::warning ::Running main nightly tests"
elif [[ "${{ github.event.schedule }}" == "0 10 * * *" || "${{ github.event.schedule }}" == "0 11 * * *" ]]; then
# at 2am PST/3am PDT and 3am PST/4am PDT. Running integration tests for firestore and generate test report.
echo "::warning ::Running Firestore nightly tests"
apis="firestore"
else
echo "::warning ::Running pull request tests"
apis=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -o "${{github.event.inputs.apis}}" ${TEST_MATRIX_PARAM} )
fi
if [[ "${{ github.event.schedule }}" == "0 11 * * *" ]]; then
# at 3am PST/4am PDT. Running firestore desktop integration test aginst tip-of-tree ios repo
echo "::warning ::Running against Firestore tip-of-tree"
matrix_platform="Desktop"
matrix_os=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k os -o "ubuntu-20.04,macos-13")
else
matrix_platform=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k platform -o "${{github.event.inputs.platforms}}" --apis ${apis} )
matrix_os=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k os -o "${{github.event.inputs.operating_systems}}")
fi
echo "apis=${apis}" >> $GITHUB_OUTPUT
echo "matrix_platform=${matrix_platform}" >> $GITHUB_OUTPUT
echo "matrix_os=${matrix_os}" >> $GITHUB_OUTPUT
echo "matrix_arch_macos=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k architecture_macos)" >> $GITHUB_OUTPUT
echo "matrix_arch_windows_linux=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k architecture_windows_linux)" >> $GITHUB_OUTPUT
# Combine architecture_macos and architecture_windows_linux to get a list of all architectures for the build matrix.
matrix_arch_combined=`echo $( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k architecture_macos | sed 's/[]\[,]//g') \
$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k architecture_windows_linux | sed 's/[]\[,]//g' ) \
| sed 's/ /\n/g' | sort | uniq`
matrix_arch_combined_json=["$(echo ${matrix_arch_combined} | sed 's/ /,/g')"]
echo "matrix_arch_combined=${matrix_arch_combined_json}" >> $GITHUB_OUTPUT
# If building against a packaged SDK, consider it as using boringssl, as the packaged SDK uses boringssl under the hood.
# This avoids trying to install openssl on the system when compiling against the packaged SDK.
# As an added bonus, we ensure that the packaged SDK works even without openssl explicitly installed.
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 }}"
echo "matrix_ssl=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k ssl_lib -o boringssl )" >> $GITHUB_OUTPUT
else
echo "matrix_ssl=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k ssl_lib -o "${{github.event.inputs.desktop_ssl_variants}}" )" >> $GITHUB_OUTPUT
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 "mobile_test_on=${mobile_test_on}" >> $GITHUB_OUTPUT
echo "android_device=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k android_device -t ${mobile_test_on} )" >> $GITHUB_OUTPUT
echo "xcode_version=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k xcode_version)" >> $GITHUB_OUTPUT
echo "ios_device=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k ios_device -t ${mobile_test_on} )" >> $GITHUB_OUTPUT
echo "tvos_device=$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${TEST_MATRIX_PARAM} -k tvos_device -t ${mobile_test_on} )" >> $GITHUB_OUTPUT
- name: Update PR label and comment
if: steps.set_outputs.outputs.pr_number
shell: bash
run: |
#Add the in-progress label and remove any previous labels.
python scripts/gha/it_workflow.py --stage start \
--token ${{github.token}} \
--issue_number ${{steps.set_outputs.outputs.pr_number}} \
--actor ${{github.actor}} \
--commit ${{steps.set_outputs.outputs.github_ref}} \
--run_id ${{github.run_id}}
build_desktop:
name: build-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
needs: [check_and_prepare]
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.check_and_prepare.outputs.matrix_platform, 'Desktop') && needs.check_and_prepare.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_os) }}
arch: ${{ fromJson(needs.check_and_prepare.outputs.matrix_arch_combined) }}
ssl_variant: ${{ fromJson(needs.check_and_prepare.outputs.matrix_ssl) }}
# Because matrix_arch_combined combines Mac, Linux, and Windows, we need
# a few exclusions. These are standard exclusions used in several
# places.
exclude:
# Do not attempt to use arm64 on Windows or Linux.
- os: windows-latest
arch: arm64
- os: ubuntu-20.04
arch: arm64
# Do not attempt to use x86 on Mac.
- os: macos-13
arch: x86
# Until we support building openssl from source, we can't use the
# system's openssl when cross-compiling, except on Linux. Builds all
# happen on x64 machines, so arm64 and x86 are technically
# cross-compiling.
- os: windows-latest
ssl_variant: openssl
arch: x86
- os: macos-13
ssl_variant: openssl
arch: arm64
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: setup default Xcode version (macos)
if: ${{ runner.os == 'macOS' }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
# Remove default Xcode version to prevent the wrong SDK from being used.
rm -rf /Applications/Xcode.app
- name: Install Desktop SDK & integration tests prerequisites
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 15
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p Desktop -a '${{ matrix.arch }}' -s '${{ matrix.ssl_variant }}'
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.1
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v3
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: 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
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
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
if [[ "${{ github.event.schedule }}" == "0 11 * * *" ]]; then
# at 3am PST/4am PDT. Running firestore desktop integration test aginst tip-of-tree ios repo
additional_flags+=(--cmake_flag=-DFIRESTORE_DEP_SOURCE=TIP)
elif [[ "${{ github.event.inputs.firestore_dep_source }}" ]]; then
additional_flags+=(--cmake_flag=-DFIRESTORE_DEP_SOURCE=${{ github.event.inputs.firestore_dep_source }})
fi
python scripts/gha/build_testapps.py --p Desktop \
--t ${{ needs.check_and_prepare.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}" \
--noadd_timestamp \
--short_output_paths \
--gha_build \
--arch ${{ matrix.arch }} \
${additional_flags[*]}
- name: Upload Desktop Cmake
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: cmake-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
path: D:/a/firebase-cpp-sdk/firebase-cpp-sdk/ta/firestore/iti/CMakeFiles/
retention-days: 1
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
if [ ! -f build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log.json ]; then
# No summary was created, make a placeholder one.
echo "__SUMMARY_MISSING__" > build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log.json
fi
- name: Upload Desktop integration tests artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
path: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload Desktop build results artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
pushd ${{env.GCS_UPLOAD_DIR}}
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.check_and_prepare.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_android:
name: build-android-${{ matrix.os }}
needs: [check_and_prepare]
runs-on: ${{ matrix.os }}
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'Android') && needs.check_and_prepare.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_os) }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Force Java 8 (macOS)
if: startsWith(matrix.os, 'macos')
shell: bash
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.1
- name: Cache NDK
id: cache_ndk
uses: actions/cache@v3
with:
path: /tmp/android-ndk-r21e
key: android-ndk-${{ matrix.os }}-r21e
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: Install Android SDK & integration tests prerequisites
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 10
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p Android
- 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: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
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.check_and_prepare.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "android-${{ matrix.os }}" \
--noadd_timestamp \
--short_output_paths \
--gha_build \
${additional_flags[*]}
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
if [ ! -f build-results-android-${{ matrix.os }}.log.json ]; then
echo "__SUMMARY_MISSING__" > build-results-android-${{ matrix.os }}.log.json
fi
- name: Upload Android integration tests artifact
uses: actions/upload-artifact@v3
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@v3
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-android-${{ matrix.os }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.check_and_prepare.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-${{ matrix.os }}
needs: [check_and_prepare]
runs-on: ${{ matrix.os }}
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'iOS') && needs.check_and_prepare.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: [macos-13]
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: setup default Xcode version (macos)
if: ${{ runner.os == 'macOS' }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
# Remove default Xcode version to prevent the wrong SDK from being used.
rm -rf /Applications/Xcode.app
- name: Install iOS SDK & integration tests prerequisites
uses: nick-invision/retry@v2
with:
timeout_minutes: 3
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p iOS
- 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: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
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.check_and_prepare.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--ios_sdk ${{ needs.check_and_prepare.outputs.mobile_test_on }} \
--artifact_name "ios-${{ matrix.os }}" \
--noadd_timestamp \
--short_output_paths \
--gha_build \
${additional_flags[*]}
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
if [ ! -f build-results-ios-${{ matrix.os }}.log.json ]; then
echo "__SUMMARY_MISSING__" > build-results-ios-${{ matrix.os }}.log.json
fi
- name: Upload iOS integration tests artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: testapps-ios-${{ matrix.os }}
path: testapps-ios-${{ matrix.os }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload iOS build results artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-ios-${{ matrix.os }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.check_and_prepare.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-ios-${{ matrix.os }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_tvos:
name: build-tvos-${{ matrix.os }}
needs: [check_and_prepare]
runs-on: ${{ matrix.os }}
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'tvOS') && needs.check_and_prepare.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: [macos-13]
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: setup default Xcode version (macos)
if: ${{ runner.os == 'macOS' }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
# Remove default Xcode version to prevent the wrong SDK from being used.
rm -rf /Applications/Xcode.app
- name: Install tvOS SDK & integration tests prerequisites
uses: nick-invision/retry@v2
with:
timeout_minutes: 3
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p tvOS
- 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: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
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.check_and_prepare.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "tvos-${{ matrix.os }}" \
--noadd_timestamp \
--short_output_paths \
--gha_build \
${additional_flags[*]}
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
if [ ! -f build-results-tvos-${{ matrix.os }}.log.json ]; then
echo "__SUMMARY_MISSING__" > build-results-tvos-${{ matrix.os }}.log.json
fi
- name: Upload tvOS integration tests artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: testapps-tvos-${{ matrix.os }}
path: testapps-tvos-${{ matrix.os }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload tvOS build results artifact
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-tvos-${{ matrix.os }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.check_and_prepare.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-tvos-${{ matrix.os }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_desktop:
name: test-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
needs: [check_and_prepare, build_desktop]
runs-on: ${{ matrix.os }}
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'Desktop') && needs.check_and_prepare.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_os) }}
arch: ${{ fromJson(needs.check_and_prepare.outputs.matrix_arch_combined) }}
ssl_variant: ${{ fromJson(needs.check_and_prepare.outputs.matrix_ssl) }}
# Because matrix_arch_combined combines Mac, Linux, and Windows, we need
# a few exclusions. These are standard exclusions used in several
# places.
exclude:
# Do not attempt to use arm64 on Windows or Linux.
- os: windows-latest
arch: arm64
- os: ubuntu-20.04
arch: arm64
# Do not attempt to use x86 on Mac.
- os: macos-13
arch: x86
# Until we support building openssl from source, we can't use the
# system's openssl when cross-compiling, except on Linux. Builds all
# happen on x64 machines, so arm64 and x86 are technically
# cross-compiling.
- os: windows-latest
ssl_variant: openssl
arch: x86
# Custom for this matrix: MacOS GitHub-hosted runner cannot test arm64
# code. Exclude that scenario from running here; it will run in
# test_desktop_custom_runners.
- os: macos-13
arch: arm64
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
- name: Download Desktop integration tests artifact
uses: actions/download-artifact@v3
with:
path: testapps/testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
name: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: setup default Xcode version (macos)
if: ${{ runner.os == 'macOS' }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
# Remove default Xcode version to prevent the wrong SDK from being used.
rm -rf /Applications/Xcode.app
- name: Install prerequisites for testing
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 15
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p Desktop -t true -a '${{ matrix.arch }}' -s '${{ matrix.ssl_variant }}'
- name: Set up Node (18)
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Firestore Emulator
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 5
max_attempts: 3
command: npm install firebase-tools
- name: Add firebase-tools to PATH
shell: bash
run: |
echo "$(npm root)" >> $GITHUB_PATH
echo "$(npm root)/.bin" >> $GITHUB_PATH
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run Desktop integration tests
env:
USE_FIRESTORE_EMULATOR: true
shell: bash
run: |
if [[ "${{ needs.check_and_prepare.outputs.apis }}" == *"firestore"* ]]; then
firebase emulators:exec --only firestore --project demo-example 'python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}"'
else
python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}"
fi
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
# If testapps do not exist, then it's a build error not test error.
if [ -d "testapps/testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}" ] && [ ! -f testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log.json ]; then
mkdir -p testapps && echo "__SUMMARY_MISSING__" > testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}.log.json
fi
- name: Upload Desktop test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: log-artifact
path: testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.check_and_prepare.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.arch }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
# Run tests that depend on custom (self-hosted) runners.
# For now, this is only used for ARM Mac builds.
test_desktop_custom_runners:
name: test-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}-custom-runner
needs: [check_and_prepare, build_desktop]
runs-on: [self-hosted, firebase-cpp, '${{ matrix.runner_label }}']
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'Desktop') && contains(needs.check_and_prepare.outputs.matrix_arch_combined, 'arm64') && contains(needs.check_and_prepare.outputs.matrix_os, 'macos-13') && needs.check_and_prepare.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
ssl_variant: ${{ fromJson(needs.check_and_prepare.outputs.matrix_ssl) }}
os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_os) }}
arch: ${{ fromJson(needs.check_and_prepare.outputs.matrix_arch_combined) }}
runner_label: ['${{ needs.check_and_prepare.outputs.runner_label_macos_arm64 }}']
exclude:
# Don't run Linux or Windows tests on the Mac arm64 runner.
- os: ubuntu-20.04
runner_label: ${{ needs.check_and_prepare.outputs.runner_label_macos_arm64 }}
- os: windows-latest
runner_label: ${{ needs.check_and_prepare.outputs.runner_label_macos_arm64 }}
# Don't run x86 tests on any Mac runner.
- os: macos-13
arch: x86
# Don't run x64 tests on the Mac arm64 runner.
- os: macos-13
arch: x64
runner_label: ${{ needs.check_and_prepare.outputs.runner_label_macos_arm64 }}
# Until we support building openssl from source, we can't link to system
# openssl when cross-compiling, so exclude openssl from mac arm64 testing.
- os: macos-13
arch: arm64
ssl_variant: openssl
steps:
- name: Clean up previous run
shell: bash
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"/*
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
- name: Download Desktop integration tests artifact
uses: actions/download-artifact@v3
with:
path: testapps
name: testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
# Omit all of the prerequisites steps; we ensure that our self-hosted runners
# are configured with all prereqs already installed.
- name: Create keychain (macOS)
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
echo "Creating temporary keychain"
# Create a local keychain on Mac:
# Clean up previous temp keychain, if any.
security delete-keychain tmp-keychain 2> /dev/null || true
# Create temp keychain file and unlock it.
# (Avoid passing in -p on command line by using interactive mode.)
# Also set it to default settings so there is no unlock timeout.
security -i <<EOF
create-keychain -p ${{ secrets.TEST_SECRET }} tmp-keychain
set-keychain-settings tmp-keychain
unlock-keychain -p ${{ secrets.TEST_SECRET }} tmp-keychain
EOF
# Change the keychain list and default keychain to the temp keychain.
security list-keychains -d user -s tmp-keychain
security default-keychain -s tmp-keychain
- name: Restore google-services files
shell: bash
run: |
python scripts/gha/restore_secrets.py --passphrase_file=- --artifact testapps <<EOF
${{ secrets.TEST_SECRET }}
EOF
- name: Run Desktop integration tests on M1 Mac
if: ${{ matrix.os == 'macos-13' && matrix.arch == 'arm64' && matrix.runner_label == needs.check_and_prepare.outputs.runner_label_macos_arm64 }}
shell: bash
run: |
# This is an M1 Mac GitHub self-hosted runner.
# Use arch command to ensure that the app is running in the correct processor mode (arm64).
cmd_prefix='arch -arm64'
# If Firestore is included, use the emulator; otherwise just run the tests standalone.
if [[ "${{ needs.check_and_prepare.outputs.apis }}" == *"firestore"* ]]; then
# ARM Mac requires a firestore.json to specify the host as 127.0.0.1 rather than localhost.
# Otherwise the Firestore emulator cannot connect, probably because localhost is ipv6.
echo '{"emulators":{"firestore":{"port":"8080","host":"127.0.0.1"}}}' > firebase.json
echo "::warning ::Firestore emulator version: $(firebase --version)"
set -x
firebase emulators:exec --only firestore --project demo-example \
'python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}" --cmd_prefix='"\"${cmd_prefix}\""
else
set -x
python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}" --cmd_prefix="${cmd_prefix}"
fi
env:
USE_FIRESTORE_EMULATOR: true
- name: Delete keychain (macOS)
if: ${{ always() && runner.os == 'macOS' }}
shell: bash
run: |
# Remove the local keychain on Mac:
# Set back to the default login keychain.
security list-keychains -d user -s login.keychain
# Delete the temp keychain, if it exists.
security delete-keychain tmp-keychain || true
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
run: |
if [ ! -f testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch}}-${{ matrix.ssl_variant }}.log.json ]; then
mkdir -p testapps && echo "__SUMMARY_MISSING__" > testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch}}-${{ matrix.ssl_variant }}.log.json
fi
- name: Upload Desktop test results artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: log-artifact
path: testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
shell: bash
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_and_prepare.outputs.pr_number}}\
--actor ${{github.actor}} \