Skip to content

Commit 3f9fb1b

Browse files
authored
Run xcodebuild in parallel for firestore (#11708)
This PR includes a few improvements to Firestore's CI jobs: - Always trigger Firestore workflow, but change the workflow to skip its jobs if no firestore changes are detected. - Introduce a new job check-required-tests to the workflow to check if all required jobs are successful or skipped. This should be the required check. Add parallelization parameters to xcodebuild - Skip a build step with xcodebuild, and only do test which triggers build anyways. This removes a redundant build run.
1 parent 51d9e39 commit 3f9fb1b

File tree

2 files changed

+90
-55
lines changed

2 files changed

+90
-55
lines changed

.github/workflows/firestore.yml

Lines changed: 90 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,6 @@ name: firestore
1616

1717
on:
1818
pull_request:
19-
paths:
20-
# Firestore sources
21-
- 'Firestore/**'
22-
23-
# Interop headers
24-
- 'FirebaseAuth/Interop/*.h'
25-
26-
# FirebaseCore header change
27-
- 'FirebaseCore/Internal'
28-
- 'FirebaseCore/Sources/Public'
29-
30-
# Podspec
31-
- 'FirebaseFirestore.podspec'
32-
33-
# CMake
34-
- '**CMakeLists.txt'
35-
- 'cmake/**'
36-
37-
# Build scripts to which Firestore is sensitive
38-
#
39-
# Note that this doesn't include check scripts because changing those will
40-
# already trigger the check workflow.
41-
- 'scripts/binary_to_array.py'
42-
- 'scripts/build.sh'
43-
- 'scripts/install_prereqs.sh'
44-
- 'scripts/localize_podfile.swift'
45-
- 'scripts/pod_lib_lint.rb'
46-
- 'scripts/run_firestore_emulator.sh'
47-
- 'scripts/setup_*'
48-
- 'scripts/sync_project.rb'
49-
- 'scripts/test_quickstart.sh'
50-
- 'scripts/xcresult_logs.py'
51-
52-
# This workflow
53-
- '.github/workflows/firestore.yml'
54-
55-
# Rebuild on Ruby infrastructure changes.
56-
- 'Gemfile*'
57-
5819
schedule:
5920
# Run every day at 12am (PST) - cron uses UTC times
6021
- cron: '0 8 * * *'
@@ -64,9 +25,60 @@ concurrency:
6425
cancel-in-progress: true
6526

6627
jobs:
28+
changes:
29+
runs-on: macos-12
30+
outputs:
31+
changed: ${{ steps.changes.outputs.changed }}
32+
steps:
33+
- uses: dorny/paths-filter@v2
34+
id: changes
35+
with:
36+
filters: |
37+
changed:
38+
# Firestore sources
39+
- 'Firestore/**'
40+
41+
# Interop headers
42+
- 'FirebaseAuth/Interop/*.h'
43+
44+
# FirebaseCore header change
45+
- 'FirebaseCore/Internal'
46+
- 'FirebaseCore/Sources/Public'
47+
48+
# Podspec
49+
- 'FirebaseFirestore.podspec'
50+
51+
# CMake
52+
- '**CMakeLists.txt'
53+
- 'cmake/**'
54+
55+
# Build scripts to which Firestore is sensitive
56+
#
57+
# Note that this doesn't include check scripts because changing those will
58+
# already trigger the check workflow.
59+
- 'scripts/binary_to_array.py'
60+
- 'scripts/build.sh'
61+
- 'scripts/install_prereqs.sh'
62+
- 'scripts/localize_podfile.swift'
63+
- 'scripts/pod_lib_lint.rb'
64+
- 'scripts/run_firestore_emulator.sh'
65+
- 'scripts/setup_*'
66+
- 'scripts/sync_project.rb'
67+
- 'scripts/test_quickstart.sh'
68+
- 'scripts/xcresult_logs.py'
69+
70+
# This workflow
71+
- '.github/workflows/firestore.yml'
72+
73+
# Rebuild on Ruby infrastructure changes.
74+
- 'Gemfile*'
75+
6776
check:
68-
# Don't run on private repo unless it is a PR.
69-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
77+
needs: changes
78+
# Either a scheduled run from public repo, or a pull request with firestore changes.
79+
if: |
80+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
81+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
7082
runs-on: macos-12
7183
steps:
7284
- uses: actions/checkout@v3
@@ -83,10 +95,11 @@ jobs:
8395

8496

8597
cmake:
86-
# Don't run on private repo unless it is a PR.
87-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
8898
needs: check
89-
99+
# Either a scheduled run from public repo, or a pull request with firestore changes.
100+
if: |
101+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
102+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
90103
strategy:
91104
matrix:
92105
os: [macos-12, ubuntu-latest]
@@ -124,8 +137,10 @@ jobs:
124137

125138

126139
cmake-prod-db:
127-
# Don't run on private repo unless it is a PR.
128-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
140+
# Either a scheduled run from public repo, or a pull request with firestore changes.
141+
if: |
142+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
143+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
129144
needs: check
130145

131146
strategy:
@@ -172,8 +187,10 @@ jobs:
172187

173188

174189
sanitizers:
175-
# Don't run on private repo unless it is a PR.
176-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
190+
# Either a scheduled run from public repo, or a pull request with firestore changes.
191+
if: |
192+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
193+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
177194
needs: check
178195

179196
strategy:
@@ -209,8 +226,10 @@ jobs:
209226

210227

211228
xcodebuild:
212-
# Don't run on private repo unless it is a PR.
213-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
229+
# Either a scheduled run from public repo, or a pull request with firestore changes.
230+
if: |
231+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
232+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
214233
runs-on: macos-12
215234
needs: check
216235

@@ -234,8 +253,10 @@ jobs:
234253

235254

236255
pod-lib-lint:
237-
# Don't run on private repo unless it is a PR.
238-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
256+
# Either a scheduled run from public repo, or a pull request with firestore changes.
257+
if: |
258+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
259+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
239260
runs-on: macos-12
240261
needs: check
241262
strategy:
@@ -297,8 +318,10 @@ jobs:
297318
--no-analyze
298319
299320
spm:
300-
# Don't run on private repo unless it is a PR.
301-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
321+
# Either a scheduled run from public repo, or a pull request with firestore changes.
322+
if: |
323+
(github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') ||
324+
(github.event_name == 'pull_request' && needs.changes.outputs.changed == 'true')
302325
runs-on: macos-12
303326
needs: check
304327
steps:
@@ -332,6 +355,19 @@ jobs:
332355
- name: Swift Build
333356
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFirestoreSwift ${{ matrix.target }} spmbuildonly
334357

358+
# A job that fails if any required job in the test matrix fails,
359+
# to be used as a required check for merging.
360+
check-required-tests:
361+
runs-on: ubuntu-latest
362+
if: always()
363+
name: Check all required Firestore tests results
364+
needs: [cmake, cmake-prod-db, xcodebuild, spm]
365+
steps:
366+
- name: Check test matrix
367+
if: needs.cmake.result == 'failure' || needs.cmake-prod-db.result == 'failure' || needs.xcodebuild.result == 'failure' || needs.spm.result == 'failure'
368+
run: exit 1
369+
370+
335371
# Disable until FirebaseUI is updated to accept Firebase 9 and quickstart is updated to accept
336372
# Firebase UI 12
337373
# quickstart:

scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ case "$product-$platform-$method" in
335335
-scheme "Firestore_IntegrationTests_$platform" \
336336
-enableCodeCoverage YES \
337337
"${xcb_flags[@]}" \
338-
build \
339338
test
340339
;;
341340

0 commit comments

Comments
 (0)