Skip to content

Commit 67c8af8

Browse files
committed
refactor(ci): Introduce common, re-usable quickstart workflow
1 parent b98d6cb commit 67c8af8

File tree

2 files changed

+197
-90
lines changed

2 files changed

+197
-90
lines changed

.github/workflows/abtesting.yml

Lines changed: 73 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -23,101 +23,84 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26-
spm:
27-
uses: ./.github/workflows/common.yml
28-
with:
29-
target: ABTestingUnit
26+
# spm:
27+
# uses: ./.github/workflows/common.yml
28+
# with:
29+
# target: ABTestingUnit
3030

31-
catalyst:
32-
uses: ./.github/workflows/common_catalyst.yml
33-
with:
34-
product: FirebaseABTesting
35-
target: FirebaseABTesting-Unit-unit
31+
# catalyst:
32+
# uses: ./.github/workflows/common_catalyst.yml
33+
# with:
34+
# product: FirebaseABTesting
35+
# target: FirebaseABTesting-Unit-unit
3636

37-
pod_lib_lint:
38-
uses: ./.github/workflows/common_cocoapods.yml
39-
with:
40-
product: FirebaseABTesting
37+
# pod_lib_lint:
38+
# uses: ./.github/workflows/common_cocoapods.yml
39+
# with:
40+
# product: FirebaseABTesting
4141

4242
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:
47-
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
48-
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
49-
runs-on: macos-15
50-
steps:
51-
- uses: actions/checkout@v4
52-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
53-
- name: Xcode
54-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
55-
- name: Setup quickstart
56-
env:
57-
LEGACY: true
58-
run: scripts/setup_quickstart.sh abtesting
59-
- name: Install Secret GoogleService-Info.plist
60-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \
61-
quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret"
62-
- name: Test swift quickstart
63-
env:
64-
LEGACY: true
65-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh ABTesting true)
43+
uses: ./.github/workflows/common_quickstart.yml
44+
with:
45+
product: ABTesting
46+
setup_command: scripts/setup_quickstart.sh abtesting
47+
plist_src_path: scripts/gha-encrypted/qs-database.plist.gpg
48+
plist_dst_path: quickstart-ios/database/GoogleService-Info.plist
6649

67-
quickstart-ftl-cron-only:
68-
# Don't run on private repo.
69-
if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule'
50+
# quickstart-ftl-cron-only:
51+
# # Don't run on private repo.
52+
# if: github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule'
7053

71-
env:
72-
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
73-
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
74-
runs-on: macos-15
75-
steps:
76-
- uses: actions/checkout@v4
77-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
78-
- uses: actions/setup-python@v5
79-
with:
80-
python-version: '3.11'
81-
- name: Setup quickstart
82-
env:
83-
LEGACY: true
84-
run: scripts/setup_quickstart.sh abtesting
85-
- name: Install Secret GoogleService-Info.plist
86-
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \
87-
quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret"
88-
- name: Xcode
89-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
90-
- name: Build swift quickstart
91-
env:
92-
LEGACY: true
93-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh ABTesting)
94-
- id: ftl_test
95-
uses: FirebaseExtended/github-actions/[email protected]
96-
with:
97-
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }}
98-
testapp_dir: quickstart-ios/build-for-testing
99-
test_type: "xctest"
54+
# env:
55+
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
56+
# signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
57+
# runs-on: macos-15
58+
# steps:
59+
# - uses: actions/checkout@v4
60+
# - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
61+
# - uses: actions/setup-python@v5
62+
# with:
63+
# python-version: '3.11'
64+
# - name: Setup quickstart
65+
# env:
66+
# LEGACY: true
67+
# run: scripts/setup_quickstart.sh abtesting
68+
# - name: Install Secret GoogleService-Info.plist
69+
# run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-abtesting.plist.gpg \
70+
# quickstart-ios/abtesting/GoogleService-Info.plist "$plist_secret"
71+
# - name: Xcode
72+
# run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
73+
# - name: Build swift quickstart
74+
# env:
75+
# LEGACY: true
76+
# run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart_ftl.sh ABTesting)
77+
# - id: ftl_test
78+
# uses: FirebaseExtended/github-actions/[email protected]
79+
# with:
80+
# credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS }}
81+
# testapp_dir: quickstart-ios/build-for-testing
82+
# test_type: "xctest"
10083

101-
abtesting-cron-only:
102-
# Don't run on private repo.
103-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
84+
# abtesting-cron-only:
85+
# # Don't run on private repo.
86+
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
10487

105-
runs-on: macos-15
106-
strategy:
107-
matrix:
108-
target: [ios, tvos, macos]
109-
flags: [
110-
'--use-static-frameworks'
111-
]
112-
needs: pod_lib_lint
113-
steps:
114-
- uses: actions/checkout@v4
115-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
116-
- name: Setup Bundler
117-
run: scripts/setup_bundler.sh
118-
- name: Xcode
119-
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
120-
- name: PodLibLint ABTesting Cron
121-
run: |
122-
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb \
123-
FirebaseABTesting.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
88+
# runs-on: macos-15
89+
# strategy:
90+
# matrix:
91+
# target: [ios, tvos, macos]
92+
# flags: [
93+
# '--use-static-frameworks'
94+
# ]
95+
# needs: pod_lib_lint
96+
# steps:
97+
# - uses: actions/checkout@v4
98+
# - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
99+
# - name: Setup Bundler
100+
# run: scripts/setup_bundler.sh
101+
# - name: Xcode
102+
# run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
103+
# - name: PodLibLint ABTesting Cron
104+
# run: |
105+
# scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb \
106+
# FirebaseABTesting.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: common_cocoapods
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+
# If the calling workflow uses a secret in the `setup_command` input, then
11+
# it also must pass the secret to the re-usable workflow.
12+
#
13+
# Example:
14+
#
15+
# pod_lib_lint:
16+
# uses: ./.github/workflows/common_cocoapods.yml
17+
# with:
18+
# product: FirebaseFoo
19+
# setup_command: |
20+
# scripts/decrypt_gha_secret.sh \
21+
# /path/to/GoogleService-Info.plist.gpg \
22+
# /path/to/dest/GoogleService-Info.plist "$plist_secret"
23+
# secrets:
24+
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
25+
#
26+
secrets:
27+
plist_secret:
28+
required: true
29+
30+
name: common_cocoapods
31+
32+
permissions:
33+
contents: read
34+
35+
on:
36+
workflow_call:
37+
# Re-usable workflows do not automatically inherit the caller's secrets.
38+
#
39+
# If the calling workflow uses a secret in the `setup_command` input, then
40+
# it also must pass the secret to the re-usable workflow.
41+
#
42+
# Example:
43+
#
44+
# pod_lib_lint:
45+
# uses: ./.github/workflows/common_cocoapods.yml
46+
# with:
47+
# product: FirebaseFoo
48+
# setup_command: |
49+
# scripts/decrypt_gha_secret.sh \
50+
# /path/to/GoogleService-Info.plist.gpg \
51+
# /path/to/dest/GoogleService-Info.plist "$plist_secret"
52+
# secrets:
53+
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
54+
#
55+
secrets:
56+
plist_secret:
57+
required: false
58+
59+
inputs:
60+
# The product to test be tested (e.g. `FirebaseABTesting`).
61+
product:
62+
type: string
63+
required: true
64+
65+
is_legacy:
66+
type: boolean
67+
required: false
68+
default: false
69+
70+
plist_src_path:
71+
type: string
72+
required: true
73+
74+
plist_dst_path:
75+
type: string
76+
required: true
77+
78+
# A command to execute before testing.
79+
#
80+
# This is useful for additional set up, like starting an emulator or
81+
# downloading test data.
82+
#
83+
# Note, this step has an env var set to decrypt plists. Use
84+
# "$plist_secret" in the given command. See `secrets` documentation
85+
# at top of this file.
86+
#
87+
# Example: `FirebaseFunctions/Backend/start.sh synchronous`
88+
setup_command:
89+
type: string
90+
required: false
91+
default: ""
92+
93+
jobs:
94+
quickstart:
95+
# Run on the main repo's scheduled jobs or pull requests and manual workflow invocations.
96+
if: (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name)
97+
env:
98+
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
99+
runs-on: macos-15
100+
steps:
101+
- uses: actions/checkout@v4
102+
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
103+
- name: Xcode
104+
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
105+
- name: Run setup command.
106+
env:
107+
LEGACY: inputs.is_legacy == true
108+
run: ${{ inputs.setup_command }}
109+
- name: Install Secret GoogleService-Info.plist
110+
run: |
111+
scripts/decrypt_gha_secret.sh \
112+
${{ inputs.plist_src_path }} \
113+
${{ inputs.plist_dst_path }} \
114+
"$plist_secret"
115+
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
116+
env:
117+
LEGACY: ${{ inputs.is_legacy == true }}
118+
with:
119+
timeout_minutes: 15
120+
max_attempts: 3
121+
retry_wait_seconds: 120
122+
command: |
123+
([ -z $plist_secret ] || == true && 'LEGACY=true' || '' }} scripts/test_quickstart.sh ${{ inputs.product }} true)
124+

0 commit comments

Comments
 (0)