Skip to content

Commit 66a44cb

Browse files
authored
Migrate RTDB to GHA (#5681)
1 parent b4faa55 commit 66a44cb

File tree

6 files changed

+109
-54
lines changed

6 files changed

+109
-54
lines changed

.github/workflows/database.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,39 @@ on:
1414
- cron: '0 7 * * *'
1515

1616
jobs:
17+
unit:
18+
runs-on: macos-latest
19+
strategy:
20+
matrix:
21+
target: [iOS, tvOS, macOS]
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Setup Bundler
25+
run: scripts/setup_bundler.sh
26+
- name: BuildAndTest # can be replaced with pod lib lint with CocoaPods 1.10
27+
run: scripts/third_party/travis/retry.sh scripts/build.sh Database ${{ matrix.target }} unit
28+
29+
integration:
30+
runs-on: macos-latest
31+
strategy:
32+
matrix:
33+
target: [iOS, tvOS, macOS]
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Setup Bundler
37+
run: scripts/setup_bundler.sh
38+
- name: IntegrationTest
39+
run: scripts/third_party/travis/retry.sh scripts/build.sh Database ${{ matrix.target }} integration
40+
41+
catalyst:
42+
runs-on: macOS-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: Setup Bundler
46+
run: scripts/setup_bundler.sh
47+
- name: Setup project and Build for Catalyst
48+
# Only build the unit tests on Catalyst. Test stopped working when GHA moved to Xcode 11.4.1.
49+
run: scripts/test_catalyst.sh FirebaseDatabase build FirebaseDatabase-Unit-unit
1750

1851
quickstart:
1952
env:
@@ -35,3 +68,35 @@ jobs:
3568
- name: Test swift quickstart
3669
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Database swift)
3770

71+
pod-lib-lint:
72+
runs-on: macOS-latest
73+
74+
strategy:
75+
matrix:
76+
target: [ios, tvos, macos]
77+
steps:
78+
- uses: actions/checkout@v2
79+
- name: Setup Bundler
80+
run: scripts/setup_bundler.sh
81+
- name: Build and test
82+
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseDatabase.podspec --skip-tests --platforms=${{ matrix.target }}
83+
84+
database-cron-only:
85+
runs-on: macos-latest
86+
if: github.event_name == 'schedule'
87+
strategy:
88+
matrix:
89+
target: [ios, tvos, macos]
90+
flags: [
91+
'--skip-tests --use-modular-headers',
92+
'--skip-tests --use-libraries'
93+
]
94+
needs: pod-lib-lint
95+
steps:
96+
- uses: actions/checkout@v2
97+
- name: Setup Bundler
98+
run: scripts/setup_bundler.sh
99+
- name: PodLibLint database Cron
100+
run: |
101+
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseDatabase.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
102+
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseDatabase.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}

.travis.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,6 @@ jobs:
118118
- travis_retry ./scripts/pod_lib_lint.rb FirebaseInstanceID.podspec --platforms=tvos --use-modular-headers
119119
- travis_retry ./scripts/pod_lib_lint.rb FirebaseInstanceID.podspec --platforms=macos --use-modular-headers
120120

121-
- stage: test
122-
env:
123-
- PROJECT=Database PLATFORM=all METHOD=xcodebuild QUICKSTART=Database
124-
before_install:
125-
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
126-
script:
127-
- travis_retry ./scripts/if_changed.sh ./scripts/build.sh $PROJECT $PLATFORM
128-
# The pod lib lint tests are fast enough that it's not worth a separate stage.
129-
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --skip-tests --platforms=ios
130-
- travis_retry ./scripts/if_changed.sh ./scripts/test_quickstart.sh Database
131-
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --skip-tests --platforms=tvos
132-
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --skip-tests --platforms=macos
133-
134121
- stage: test
135122
osx_image: xcode10.3
136123
env:
@@ -140,18 +127,6 @@ jobs:
140127
script:
141128
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --skip-tests --platforms=ios
142129

143-
- stage: test
144-
if: type = cron
145-
env:
146-
- PROJECT=DatabaseCron METHOD=pod-lib-lint
147-
script:
148-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-libraries --skip-tests --platforms=ios
149-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-libraries --skip-tests --platforms=tvos
150-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-libraries --skip-tests --platforms=macos
151-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-modular-headers --skip-tests --platforms=ios
152-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-modular-headers --skip-tests --platforms=tvos
153-
- travis_retry ./scripts/pod_lib_lint.rb FirebaseDatabase.podspec --use-modular-headers --skip-tests --platforms=macos
154-
155130
- stage: test
156131
env:
157132
- PROJECT=DynamicLinks METHOD=pod-lib-lint QUICKSTART=DynamicLinks

Example/Database/Tests/Integration/FData.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,40 @@ - (void)testWriteLeafNodeOverwriteAtParentMultipleTimesVerifyExpectedEvents {
300300
[et wait];
301301
}
302302

303+
#ifdef FLAKY_TEST
304+
This test flakes frequently on the emulator on travis and almost always on GHA with
305+
306+
testWriteLeafNodeRemoveLeafVerifyExpectedEvents,
307+
failed
308+
: caught "NSInternalInconsistencyException",
309+
"Unable to report test assertion failure '(([target isEqualTo:recvd]) is true) failed: throwing
310+
"Unable to report test assertion failure '(([target isEqualTo:recvd]) is true) failed - Expected
311+
http : // localhost:9000/-M8IJYWb68MuqQKKz2IY/a aa (0) to match
312+
http : // localhost:9000/-M8IJYWb68MuqQKKz2IY/a (null) (4)' from
313+
/
314+
Users / runner / runners / 2.262.1 / work / firebase -
315+
ios - sdk / firebase - ios -
316+
sdk / Example / Database / Tests / Helpers /
317+
FEventTester
318+
.m : 123 because it was raised inside test case -
319+
[FEventTester(
320+
null)] which has no associated XCTestRun object.This may happen when test cases
321+
are constructed and invoked independently of standard XCTest infrastructure,
322+
or when the test has already finished
323+
." - Expected http://localhost:9000/-M8IJYWb68MuqQKKz2IY/a aa (0) to match "
324+
"http://localhost:9000/-M8IJYWb68MuqQKKz2IY/a (null) (4)' from "
325+
"/Users/runner/runners/2.262.1/work/firebase-ios-sdk/firebase-ios-sdk/"
326+
"Example/Database/Tests/Helpers/FEventTester.m:123 because it was raised "
327+
"inside test case -[FEventTester (null)] which has no associated XCTestRun "
328+
"object. This may happen when test cases are constructed and invoked "
329+
"independently of standard XCTest infrastructure, or when the test has "
330+
"already finished." /
331+
Users / runner / runners / 2.262.1 / work / firebase -
332+
ios - sdk / firebase - ios -
333+
sdk / Example / Database / Tests / Helpers / FEventTester.m : 123
334+
``` FTupleEventTypeString *recvd = [self.actualPathsAndEvents objectAtIndex:i];
335+
XCTAssertTrue([target isEqualTo:recvd], @"Expected %@ to match %@", target, recvd);
336+
303337
- (void)testWriteParentNodeOverwriteAtLeafVerifyExpectedEvents {
304338
FIRDatabaseReference *node = [FTestHelpers getRandomNode];
305339

@@ -595,6 +629,7 @@ - (void)testWriteLeafNodeRemoveLeafVerifyExpectedEvents {
595629
fabs([writeVal doubleValue] - 3.1415) < 0.001;
596630
}];
597631
}
632+
#endif
598633

599634
- (void)testWriteMultipleLeafNodesRemoveOnlyOneVerifyExpectedEvents {
600635
// XXX impl

Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ - (void)testExtremeDoublesAsServerCache {
478478
return;
479479
}
480480
#endif
481-
#if TARGET_OS_MACCATALYST
481+
#if TARGET_OS_MACCATALYST || TARGET_OS_OSX
482482
return;
483483
#endif
484484

scripts/build.sh

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -383,42 +383,24 @@ case "$product-$platform-$method" in
383383
fi
384384
;;
385385

386-
Database-*-xcodebuild)
387-
"${database_emulator}" start
388-
trap '"${database_emulator}" stop' ERR EXIT
389-
390-
pod_gen FirebaseDatabase.podspec --platforms=ios
386+
Database-*-unit)
387+
pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
391388
RunXcodebuild \
392389
-workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
393390
-scheme "FirebaseDatabase-Unit-unit" \
394-
"${ios_flags[@]}" \
395-
"${xcb_flags[@]}" \
396-
build \
397-
test
398-
399-
# Integration tests are only run on iOS to minimize flake failures.
400-
RunXcodebuild \
401-
-workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
402-
-scheme "FirebaseDatabase-Unit-integration" \
403-
"${ios_flags[@]}" \
404391
"${xcb_flags[@]}" \
405392
build \
406393
test
394+
;;
407395

408-
pod_gen FirebaseDatabase.podspec --platforms=macos --clean
409-
RunXcodebuild \
410-
-workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
411-
-scheme "FirebaseDatabase-Unit-unit" \
412-
"${macos_flags[@]}" \
413-
"${xcb_flags[@]}" \
414-
build \
415-
test
396+
Database-*-integration)
397+
"${database_emulator}" start
398+
trap '"${database_emulator}" stop' ERR EXIT
399+
pod_gen FirebaseDatabase.podspec --platforms="${gen_platform}"
416400

417-
pod_gen FirebaseDatabase.podspec --platforms=tvos --clean
418401
RunXcodebuild \
419402
-workspace 'gen/FirebaseDatabase/FirebaseDatabase.xcworkspace' \
420-
-scheme "FirebaseDatabase-Unit-unit" \
421-
"${tvos_flags[@]}" \
403+
-scheme "FirebaseDatabase-Unit-integration" \
422404
"${xcb_flags[@]}" \
423405
build \
424406
test

scripts/install_prereqs.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ function install_secrets() {
3737

3838
cp Secrets/Storage/App/GoogleService-Info.plist FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist
3939

40-
cp Secrets/Metrics/database.config Metrics/database.config
41-
4240
# Firebase Installations
4341
fis_resources_dir=FirebaseInstallations/Source/Tests/Resources/
4442
mkdir -p "$fis_resources_dir"

0 commit comments

Comments
 (0)