8000 refactor(ci): Introduce common, re-usable quickstart workflow (#15245) · firebase/firebase-ios-sdk@056de5b · GitHub 10000
[go: up one dir, main page]

Skip to content

Commit 056de5b

Browse files
authored
refactor(ci): Introduce common, re-usable quickstart workflow (#15245)
1 parent e193270 commit 056de5b

13 files changed

+267
-250
lines changed

.github/workflows/abtesting.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- '.github/workflows/common.yml'
1414
- '.github/workflows/common_cocoapods.yml'
1515
- '.github/workflows/common_catalyst.yml'
16+
- '.github/workflows/common_quickstart.yml'
1617
- 'Gemfile*'
1718
schedule:
1819
# Run every day at 2am (PDT) / 5am (EDT) - cron uses UTC times
@@ -40,28 +41,15 @@ jobs:
4041
product: FirebaseABTesting
4142

4243
quickstart:
43-
# Don't run on private repo unless it is a PR.
44-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
45-
46-
env:
44+
uses: ./.github/workflows/common_quickstart.yml
45+
with:
46+
product: ABTesting
47+
is_legacy: true
48+
setup_command: scripts/setup_quickstart.sh abtesting
49+
plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg
50+
plist_dst_path: quickstart-ios/database/GoogleService-Info.plist
51+
secrets:
4752
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
48-
runs-on: macos-15
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
52-
- name: Xcode
53-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
54-
- name: Setup quickstart
55-
env:
56-
LEGACY: true
57-
run: scripts/setup_quickstart.sh abtesting
58-
- name: Install Secret GoogleService-Info.plist
59-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \
60-
quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret"
61-
- name: Test swift quickstart
62-
env:
63-
LEGACY: true
64-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh ABTesting true)
6553

6654
quickstart-ftl-cron-only:
6755
# Don't run on private repo.

.github/workflows/auth.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- '.github/workflows/common.yml'
1414
- '.github/workflows/common_cocoapods.yml'
1515
- '.github/workflows/common_catalyst.yml'
16+
- '.github/workflows/common_quickstart.yml'
1617
- 'scripts/gha-encrypted/AuthSample/SwiftApplication.plist.gpg'
1718
- 'Gemfile*'
1819
schedule:
@@ -92,22 +93,16 @@ jobs:
9293
command: ([ -z $plist_secret ] || scripts/build.sh Auth iOS ${{ matrix.scheme }})
9394

9495
quickstart:
95-
# Don't run on private repo unless it is a PR.
96-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
97-
98-
env:
96+
uses: ./.github/workflows/common_quickstart.yml
97+
with:
98+
product: Authentication
99+
is_legacy: false
100+
setup_command: scripts/setup_quickstart.sh authentication
101+
plist_src_path: scripts/gha-encrypted/qs-auth.plist.gpg
102+
plist_dst_path: quickstart-ios/authentication/GoogleService-Info.plist
103+
run_tests: false
104+
secrets:
99105
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
100-
runs-on: macos-15
101-
steps:
102-
- uses: actions/checkout@v4
103-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
104-
- name: Setup quickstart
105-
run: scripts/setup_quickstart.sh authentication
106-
- name: Install Secret GoogleService-Info.plist
107-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-auth.plist.gpg \
108-
quickstart-ios/authentication/GoogleService-Info.plist "$plist_secret"
109-
- name: Test swift quickstart
110-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Authentication false)
111106

112107
# TODO(@sunmou99): currently have issue with this job, will re-enable it once the issue resolved.
113108
# quickstart-ftl-cron-only:
@@ -116,6 +111,7 @@ jobs:
116111

117112
# env:
118113
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
114+
# signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
119115
# runs-on: macos-14
120116
# steps:
121117
# - uses: actions/checkout@v4
@@ -150,6 +146,9 @@ jobs:
150146
'--use-static-frameworks'
151147
]
152148
needs: pod_lib_lint
149+
env:
150+
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
151+
runs-on: macos-14
153152
steps:
154153
- uses: actions/checkout@v4
155154
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: common_quickstart
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
# Re-usable workflows do not automatically inherit the caller's secrets.
9+
#
10+
# This workflow decrypts encrypted files, so the calling workflow needs to
11+
# pass the secret to the re-usable workflow.
12+
#
13+
# Example:
14+
#
15+
# quickstart:
16+
# uses: ./.github/workflows/common_quickstart.yml
17+
# with:
18+
# # ...
19+
# secrets:
20+
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
21+
#
22+
secrets:
23+
plist_secret:
24+
required: true
25+
26+
inputs:
27+
# The product to test be tested (e.g. `ABTesting`).
28+
product:
29+
type: string
30+
required: true
31+
32+
# Whether to test the legacy version of the quickstart.
33+
is_legacy:
34+
type: boolean
35+
required: true
36+
37+
# The path to the encrypted `GoogleService-Info.plist` file.
38+
plist_src_path:
39+
type: string
40+
required: true
41+
42+
# The destination path for the decrypted `GoogleService-Info.plist` file.
43+
plist_dst_path:
44+
type: string
45+
required: true
46+
47+
# The type of quickstart to test.
48+
#
49+
# Options: [swift, objc]
50+
quickstart_type:
51+
type: string
52+
required: false
53+
default: objc
54+
55+
# Whether to run tests or just build. Defaults to true.
56+
run_tests:
57+
type: boolean
58+
required: false
59+
default: true
60+
61+
# A command to execute before testing.
62+
#
63+
# Example: `scripts/setup_quickstart.sh functions`
64+
setup_command:
65+
type: string
66+
required: false
67+
default: ""
68+
69+
jobs:
70+
quickstart:
71+
# Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
72+
if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
73+
env:
74+
plist_secret: ${{ secrets.plist_secret }}
75+
LEGACY: ${{ inputs.is_legacy && true || '' }}
76+
runs-on: macos-15
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
80+
- name: Xcode
81+
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
82+
- name: Run setup command.
83+
run: ${{ inputs.setup_command }}
84+
- name: Install Secret GoogleService-Info.plist
85+
run: |
86+
scripts/decrypt_gha_secret.sh \
87+
${{ inputs.plist_src_path }} \
88+
${{ inputs.plist_dst_path }} \
89+
"$plist_secret"
90+
- name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }})
91+
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
92+
with:
93+
timeout_minutes: 15
94+
max_attempts: 3
95+
retry_wait_seconds: 120
96+
command: |
97+
scripts/test_quickstart.sh \
98+
${{ inputs.product }} \
99+
${{ inputs.run_tests }} \
100+
${{ inputs.quickstart_type }}
101+
# Failure sequence to upload artifact.
102+
- id: lowercase_product
103+
if: ${{ failure() }}
104+
run: |
105+
lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]')
106+
echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT
107+
- name: Remove data before upload.
108+
if: ${{ failure() }}
109+
run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }}
110+
- uses: actions/upload-artifact@v4
111+
if: ${{ failure() }}
112+
with:
113+
name: quickstart_artifacts_${{ steps.lowercase_product.outputs.lowercase_product }}
114+
path: quickstart-ios/

.github/workflows/crashlytics.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- '.github/workflows/common.yml'
1414
- '.github/workflows/common_cocoapods.yml'
1515
- '.github/workflows/common_catalyst.yml'
16+
- '.github/workflows/common_quickstart.yml'
1617
- 'Interop/Analytics/Public/*.h'
1718
- 'Gemfile*'
1819
schedule:
@@ -42,33 +43,21 @@ jobs:
4243
buildonly_platforms: tvOS, macOS, watchOS
4344

4445
quickstart:
45-
# Don't run on private repo unless it is a PR.
46-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
47-
48-
env:
49-
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
50-
runs-on: macos-15
51-
steps:
52-
- uses: actions/checkout@v4
53-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
54-
- name: Xcode
55-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
56-
- name: Setup quickstart
57-
run: scripts/setup_quickstart.sh crashlytics
58-
env:
59-
LEGACY: true
60-
- name: Install Secret GoogleService-Info.plist
61-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-crashlytics.plist.gpg \
62-
quickstart-ios/crashlytics/GoogleService-Info.plist "$plist_secret"
63-
- name: Test swift quickstart
64-
run: |
46+
uses: ./.github/workflows/common_quickstart.yml
47+
with:
48+
product: Crashlytics
49+
is_legacy: true
50+
quickstart_type: swift
51+
setup_command: |
52+
scripts/setup_quickstart.sh crashlytics
6553
mkdir quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics
6654
# Set the deployed pod location of run and upload-symbols with the development pod version.
6755
cp Crashlytics/run quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
6856
cp Crashlytics/upload-symbols quickstart-ios/crashlytics/LegacyCrashlyticsQuickstart/Pods/FirebaseCrashlytics/
69-
([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Crashlytics true swift)
70-
env:
71-
LEGACY: true
57+
plist_src_path: scripts/gha-encrypted/qs-crashlytics.plist.gpg
58+
plist_dst_path: quickstart-ios/crashlytics/GoogleService-Info.plist
59+
secrets:
60+
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
7261

7362
quickstart-ftl-cron-only:
7463
# Don't run on private repo.

.github/workflows/database.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- '.github/workflows/common.yml'
1717
- '.github/workflows/common_cocoapods.yml'
1818
- '.github/workflows/common_catalyst.yml'
19+
- '.github/workflows/common_quickstart.yml'
1920
- 'Gemfile*'
2021
- 'scripts/run_database_emulator.sh'
2122
schedule:
@@ -69,25 +70,20 @@ jobs:
6970
run: scripts/third_party/travis/retry.sh scripts/build.sh Database iOS integration
7071

7172
quickstart:
72-
# Don't run on private repo unless it is a PR.
73-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
74-
env:
73+
uses: ./.github/workflows/common_quickstart.yml
74+
strategy:
75+
matrix:
76+
quickstart_type: [objc, swift]
77+
with:
78+
product: Database
79+
is_legacy: false
80+
setup_command: scripts/setup_quickstart.sh database
81+
plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg
82+
plist_dst_path: quickstart-ios/database/GoogleService-Info.plist
83+
quickstart_type: ${{ matrix.quickstart_type }}
84+
run_tests: false
85+
secrets:
7586
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
76-
runs-on: macos-15
77-
steps:
78-
- uses: actions/checkout@v4
79-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
80-
- name: Setup quickstart
81-
run: scripts/setup_quickstart.sh database
82-
- name: Install Secret GoogleService-Info.plist
83-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-database.plist.gpg \
84-
quickstart-ios/database/GoogleService-Info.plist "$plist_secret"
85-
- name: Xcode
86-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
87-
- name: Test objc quickstart
88-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Database false)
89-
- name: Test swift quickstart
90-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Database false swift)
9187

9288
database-cron-only:
9389
# Don't run on private repo.

.github/workflows/firestore.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -598,23 +598,16 @@ jobs:
598598
if: needs.*.result == 'failure'
599599
run: exit 1
600600

601-
# Disable until FirebaseUI is updated to accept Firebase 9 and quickstart is updated to accept
602-
# Firebase UI 12
601+
# TODO: Disable until FirebaseUI is updated to accept Firebase 9 and
602+
# quickstart is updated to accept Firebase UI 12
603603
# quickstart:
604-
# # Don't run on private repo unless it is a PR.
605-
# if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
606-
# env:
604+
# uses: ./.github/workflows/common_quickstart.yml
605+
# with:
606+
# product: Firestore
607+
# is_legacy: true
608+
# setup_command: scripts/setup_quickstart.sh firestore
609+
# plist_src_path: scripts/gha-encrypted/qs-firestore.plist.gpg
610+
# plist_dst_path: quickstart-ios/firestore/GoogleService-Info.plist
611+
# run_tests: false
612+
# secrets:
607613
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
608-
# runs-on: macos-14
609-
# needs: check
610-
611-
# steps:
612-
# - uses: actions/checkout@v4
613-
# - name: Setup quickstart
614-
# run: scripts/setup_quickstart.sh firestore
615-
# - name: Install Secret GoogleService-Info.plist
616-
# run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-firestore.plist.gpg \
617-
# quickstart-ios/firestore/GoogleService-Info.plist "$plist_secret"
618-
# - name: Test swift quickstart
619-
# run: ([ -z $plist_secret ] ||
620-
# scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Firestore false)

0 commit comments

Comments
 (0)
0