Skip to content

Commit 638a1b0

Browse files
Optimize Firestore CI and Migrate Test Retries to xcodebuild (#16024)
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
1 parent 9c14df4 commit 638a1b0

4 files changed

Lines changed: 59 additions & 22 deletions

File tree

.github/workflows/sdk.firestore.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ jobs:
298298
retry_wait_seconds: 120
299299
command: sudo xcodebuild -downloadPlatform ${{ matrix.target }}
300300

301+
- name: Cache Pods
302+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
303+
with:
304+
path: Firestore/Example/Pods
305+
key: ${{ runner.os }}-pods-${{ matrix.target }}-${{ hashFiles('Firestore/Example/Podfile.lock') }}
306+
restore-keys: |
307+
${{ runner.os }}-pods-${{ matrix.target }}-
308+
301309
# 'FirestoreEnterprise' is used as product name for `build.sh` to select the enterprise build variant. `install_prereqs.sh` does not require this distinction, so 'Firestore' is used.
302310
- name: Setup build
303311
run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild
@@ -309,12 +317,7 @@ jobs:
309317
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodebuild
310318

311319
- name: Test
312-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
313-
with:
314-
timeout_minutes: 60
315-
max_attempts: 3
316-
retry_wait_seconds: 120
317-
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
320+
run: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
318321

319322
xcodetest_nightly:
320323
needs: check
@@ -354,6 +357,14 @@ jobs:
354357
retry_wait_seconds: 120
355358
command: sudo xcodebuild -downloadPlatform ${{ matrix.target }}
356359

360+
- name: Cache Pods
361+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
362+
with:
363+
path: Firestore/Example/Pods
364+
key: ${{ runner.os }}-pods-${{ matrix.target }}-${{ hashFiles('Firestore/Example/Podfile.lock') }}
365+
restore-keys: |
366+
${{ runner.os }}-pods-${{ matrix.target }}-
367+
357368
# 'FirestoreEnterprise' is used as product name for `build.sh` to select the enterprise build variant. `install_prereqs.sh` does not require this distinction, so 'Firestore' is used.
358369
- name: Setup build
359370
run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild
@@ -378,12 +389,7 @@ jobs:
378389
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodebuild
379390

380391
- name: Test
381-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
382-
with:
383-
timeout_minutes: 60
384-
max_attempts: 3
385-
retry_wait_seconds: 120
386-
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
392+
run: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
387393

388394

389395
xcodetest_emulator:
@@ -417,6 +423,14 @@ jobs:
417423
retry_wait_seconds: 120
418424
command: sudo xcodebuild -downloadPlatform ${{ matrix.target }}
419425

426+
- name: Cache Pods
427+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
428+
with:
429+
path: Firestore/Example/Pods
430+
key: ${{ runner.os }}-pods-${{ matrix.target }}-${{ hashFiles('Firestore/Example/Podfile.lock') }}
431+
restore-keys: |
432+
${{ runner.os }}-pods-${{ matrix.target }}-
433+
420434
- name: Setup build
421435
# 'FirestoreEnterprise' is used as product name for `build.sh` to select the enterprise build variant. `install_prereqs.sh` does not require this distinction, so 'Firestore' is used.
422436
run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild
@@ -428,12 +442,7 @@ jobs:
428442
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodebuild
429443

430444
- name: Test
431-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
432-
with:
433-
timeout_minutes: 60
434-
max_attempts: 3
435-
retry_wait_seconds: 120
436-
command: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
445+
run: scripts/build.sh ${{ matrix.scheme }} ${{ matrix.target }} xcodetest
437446

438447

439448
pod_lib_lint:

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
3C63B6ED2E494437BBAD82D7 /* mirroring_semantics_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = F3704E3BF509EE783D0B0F08 /* mirroring_semantics_test.cc */; };
453453
3C9DEC46FE7B3995A4EA629C /* memory_globals_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5C6DEA63FBDE19D841291723 /* memory_globals_cache_test.cc */; };
454454
3CCABD7BB5ED39DF1140B5F0 /* leveldb_globals_cache_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = FC44D934D4A52C790659C8D6 /* leveldb_globals_cache_test.cc */; };
455+
3CD19EF20299AA20D8F71F8E /* AsyncSequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F3EEA0F8A85AE6E345DB1B2 /* AsyncSequenceTests.swift */; };
455456
3CFFA6F016231446367E3A69 /* listen_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA12A01F315EE100DD57A1 /* listen_spec_test.json */; };
456457
3D1365A99984C2F86C2B8A82 /* timestamp_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82DF854A7238D538FA53C908 /* timestamp_test.cc */; };
457458
3D22F56C0DE7C7256C75DC06 /* tree_sorted_map_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 549CCA4D20A36DBB00BCEB75 /* tree_sorted_map_test.cc */; };
@@ -589,6 +590,7 @@
589590
5250AE69A391E7A3310E013B /* listen_source_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 4D9E51DA7A275D8B1CAEAEB2 /* listen_source_spec_test.json */; };
590591
52967C3DD7896BFA48840488 /* byte_string_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5342CDDB137B4E93E2E85CCA /* byte_string_test.cc */; };
591592
529AB59F636060FEA21BD4FF /* garbage_collection_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = AAED89D7690E194EF3BA1132 /* garbage_collection_spec_test.json */; };
593+
52DD091174079A4BAF2F3BFA /* AsyncSequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F3EEA0F8A85AE6E345DB1B2 /* AsyncSequenceTests.swift */; };
592594
5360D52DCAD1069B1E4B0B9D /* testing_hooks_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = A002425BC4FC4E805F4175B6 /* testing_hooks_test.cc */; };
593595
53AB47E44D897C81A94031F6 /* write.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 544129D921C2DDC800EFB9CC /* write.pb.cc */; };
594596
53BBB5CDED453F923ADD08D2 /* stream_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5B5414D28802BC76FDADABD6 /* stream_test.cc */; };
@@ -1729,6 +1731,7 @@
17291731
ED14A67E34AEDF55232096EF /* Validation_BloomFilterTest_MD5_5000_0001_membership_test_result.json in Resources */ = {isa = PBXBuildFile; fileRef = C8582DFD74E8060C7072104B /* Validation_BloomFilterTest_MD5_5000_0001_membership_test_result.json */; };
17301732
ED420D8F49DA5C41EEF93913 /* FIRSnapshotMetadataTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E04D202154AA00B64F25 /* FIRSnapshotMetadataTests.mm */; };
17311733
ED4E2AC80CAF2A8FDDAC3DEE /* field_mask_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 549CCA5320A36E1F00BCEB75 /* field_mask_test.cc */; };
1734+
ED6F2E19CFE231B0251464C9 /* AsyncSequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F3EEA0F8A85AE6E345DB1B2 /* AsyncSequenceTests.swift */; };
17321735
ED9DF1EB20025227B38736EC /* message_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = CE37875365497FFA8687B745 /* message_test.cc */; };
17331736
EDF35B147B116F659D0D2CA8 /* Validation_BloomFilterTest_MD5_1_0001_membership_test_result.json in Resources */ = {isa = PBXBuildFile; fileRef = C939D1789E38C09F9A0C1157 /* Validation_BloomFilterTest_MD5_1_0001_membership_test_result.json */; };
17341737
EE470CC3C8FBCDA5F70A8466 /* local_store_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 307FF03D0297024D59348EBD /* local_store_test.cc */; };
@@ -1941,6 +1944,7 @@
19411944
1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = resource.pb.cc; sourceTree = "<group>"; };
19421945
1CA9800A53669EFBFFB824E3 /* memory_remote_document_cache_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = memory_remote_document_cache_test.cc; sourceTree = "<group>"; };
19431946
1E0C7C0DCD2790019E66D8CC /* bloom_filter.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = bloom_filter.pb.cc; sourceTree = "<group>"; };
1947+
1F3EEA0F8A85AE6E345DB1B2 /* AsyncSequenceTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncSequenceTests.swift; path = Unit/AsyncAwait/AsyncSequenceTests.swift; sourceTree = "<group>"; };
19441948
1F50E872B3F117A674DA8E94 /* index_backfiller_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = index_backfiller_test.cc; sourceTree = "<group>"; };
19451949
1F78CD3208A1D5885B4C134E /* field_behavior.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = field_behavior.pb.cc; sourceTree = "<group>"; };
19461950
214877F52A705012D6720CA0 /* object_value_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = object_value_test.cc; sourceTree = "<group>"; };
@@ -2515,6 +2519,14 @@
25152519
path = Integration;
25162520
sourceTree = "<group>";
25172521
};
2522+
24C7067A4A3A8C1B87B879F8 /* AsyncAwait */ = {
2523+
isa = PBXGroup;
2524+
children = (
2525+
1F3EEA0F8A85AE6E345DB1B2 /* AsyncSequenceTests.swift */,
2526+
);
2527+
name = AsyncAwait;
2528+
sourceTree = "<group>";
2529+
};
25182530
3C21D8CBCC4E086899931A65 /* admin */ = {
25192531
isa = PBXGroup;
25202532
children = (
@@ -2804,6 +2816,7 @@
28042816
5495EB012040E90200EBA509 /* Codable */,
28052817
124C932A22C1635300CA8C2D /* Integration */,
28062818
C7D3D622BB13EB3C3301DA4F /* TestHelper */,
2819+
D7C1545F948B5D9C8FE393E6 /* Unit */,
28072820
620C1427763BA5D3CCFB5A1F /* BridgingHeader.h */,
28082821
54C9EDF52040E16300A969CD /* Info.plist */,
28092822
);
@@ -3228,6 +3241,14 @@
32283241
name = TestHelper;
32293242
sourceTree = "<group>";
32303243
};
3244+
D7C1545F948B5D9C8FE393E6 /* Unit */ = {
3245+
isa = PBXGroup;
3246+
children = (
3247+
24C7067A4A3A8C1B87B879F8 /* AsyncAwait */,
3248+
);
3249+
name = Unit;
3250+
sourceTree = "<group>";
3251+
};
32313252
DAFF0CF621E64AC30062958F /* macOS */ = {
32323253
isa = PBXGroup;
32333254
children = (
@@ -4929,6 +4950,7 @@
49294950
files = (
49304951
EF6C286F29E6D22200A7D4F1 /* AggregationIntegrationTests.swift in Sources */,
49314952
062072B92773A055001655D7 /* AsyncAwaitIntegrationTests.swift in Sources */,
4953+
3CD19EF20299AA20D8F71F8E /* AsyncSequenceTests.swift in Sources */,
49324954
733AFC467B600967536BD70F /* BasicCompileTests.swift in Sources */,
49334955
79987AF2DF1FCE799008B846 /* CodableGeoPointTests.swift in Sources */,
49344956
1C79AE3FBFC91800E30D092C /* CodableIntegrationTests.swift in Sources */,
@@ -5185,8 +5207,8 @@
51855207
25D74F38A5EE96CC653ABB49 /* thread_safe_memoizer_testing.cc in Sources */,
51865208
688AC36AA9D0677E910D5A37 /* thread_safe_memoizer_testing_test.cc in Sources */,
51875209
6300709ECDE8E0B5A8645F8D /* time_testing.cc in Sources */,
5188-
A405A976DB6444D3ED3FCAB2 /* timestamp_test.cc in Sources */,
51895210
0CEE93636BA4852D3C5EC428 /* timestamp_test.cc in Sources */,
5211+
A405A976DB6444D3ED3FCAB2 /* timestamp_test.cc in Sources */,
51905212
95DCD082374F871A86EF905F /* to_string_apple_test.mm in Sources */,
51915213
9E656F4FE92E8BFB7F625283 /* to_string_test.cc in Sources */,
51925214
96D95E144C383459D4E26E47 /* token_test.cc in Sources */,
@@ -5212,6 +5234,7 @@
52125234
files = (
52135235
EF6C286E29E6D22200A7D4F1 /* AggregationIntegrationTests.swift in Sources */,
52145236
062072B82773A055001655D7 /* AsyncAwaitIntegrationTests.swift in Sources */,
5237+
ED6F2E19CFE231B0251464C9 /* AsyncSequenceTests.swift in Sources */,
52155238
B896E5DE1CC27347FAC009C3 /* BasicCompileTests.swift in Sources */,
52165239
722F9A798F39F7D1FE7CF270 /* CodableGeoPointTests.swift in Sources */,
52175240
CF5DE1ED21DD0A9783383A35 /* CodableIntegrationTests.swift in Sources */,
@@ -5468,8 +5491,8 @@
54685491
CF18D52A88F4F6F62C5495EF /* thread_safe_memoizer_testing.cc in Sources */,
54695492
A7669E72BCED7FBADA4B1314 /* thread_safe_memoizer_testing_test.cc in Sources */,
54705493
A25FF76DEF542E01A2DF3B0E /* time_testing.cc in Sources */,
5471-
BDDAB87A7D76562BCB5D0BF8 /* timestamp_test.cc in Sources */,
54725494
1E42CD0F60EB22A5D0C86D1F /* timestamp_test.cc in Sources */,
5495+
BDDAB87A7D76562BCB5D0BF8 /* timestamp_test.cc in Sources */,
54735496
F9705E595FC3818F13F6375A /* to_string_apple_test.mm in Sources */,
54745497
3BAFCABA851AE1865D904323 /* to_string_test.cc in Sources */,
54755498
1B9E54F4C4280A713B825981 /* token_test.cc in Sources */,
@@ -5777,6 +5800,7 @@
57775800
files = (
57785801
EF6C286D29E6D22200A7D4F1 /* AggregationIntegrationTests.swift in Sources */,
57795802
062072B72773A055001655D7 /* AsyncAwaitIntegrationTests.swift in Sources */,
5803+
52DD091174079A4BAF2F3BFA /* AsyncSequenceTests.swift in Sources */,
57805804
F731A0CCD0220B370BC1BE8B /* BasicCompileTests.swift in Sources */,
57815805
7C5E017689012489AAB7718D /* CodableGeoPointTests.swift in Sources */,
57825806
54C3242322D3B627000FE6DD /* CodableIntegrationTests.swift in Sources */,
@@ -6033,8 +6057,8 @@
60336057
D928302820891CCCAD0437DD /* thread_safe_memoizer_testing.cc in Sources */,
60346058
C099AEC05D44976755BA32A2 /* thread_safe_memoizer_testing_test.cc in Sources */,
60356059
2D220B9ABFA36CD7AC43D0A7 /* time_testing.cc in Sources */,
6036-
06B8A653BC26CB2C96024993 /* timestamp_test.cc in Sources */,
60376060
D91D86B29B86A60C05879A48 /* timestamp_test.cc in Sources */,
6061+
06B8A653BC26CB2C96024993 /* timestamp_test.cc in Sources */,
60386062
60260A06871DCB1A5F3448D3 /* to_string_apple_test.mm in Sources */,
60396063
ECED3B60C5718B085AAB14FB /* to_string_test.cc in Sources */,
60406064
F0EA84FB66813F2BC164EF7C /* token_test.cc in Sources */,

Firestore/Swift/Tests/Integration/PipelineTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3846,8 +3846,8 @@ class PipelineIntegrationTests: FSTIntegrationTestCase {
38463846
}
38473847

38483848
func testSupportsParent() async throws {
3849-
let db = firestore()
38503849
let randomCol = collectionRef()
3850+
let db = randomCol.firestore
38513851

38523852
// Add a dummy document directly to randomCol so the pipeline has input data to process
38533853
try await randomCol.document("dummy").setData(["dummy": 1])

scripts/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ case "$product-$platform-$method" in
403403
-workspace 'Firestore/Example/Firestore.xcworkspace' \
404404
-scheme "Firestore_IntegrationTests_$platform" \
405405
-enableCodeCoverage YES \
406+
-retry-tests-on-failure \
407+
-test-iterations 3 \
406408
"${xcb_flags[@]}" \
407409
test-without-building
408410
;;
@@ -425,6 +427,8 @@ case "$product-$platform-$method" in
425427
-workspace 'Firestore/Example/Firestore.xcworkspace' \
426428
-scheme "Firestore_IntegrationTests_Enterprise_$platform" \
427429
-enableCodeCoverage YES \
430+
-retry-tests-on-failure \
431+
-test-iterations 3 \
428432
"${xcb_flags[@]}" \
429433
test-without-building
430434
;;

0 commit comments

Comments
 (0)