Skip to content

Commit feec4a0

Browse files
authored
[Infra] Create common SPM-focused reusable workflow (#14739)
1 parent af8e1d2 commit feec4a0

19 files changed

+204
-1140
lines changed

.github/workflows/abtesting.yml

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20+
spm:
21+
uses: ./.github/workflows/common.yml
22+
with:
23+
target: ABTestingUnit
24+
2025
pod-lib-lint:
2126
# Don't run on private repo unless it is a PR.
2227
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
@@ -55,81 +60,6 @@ jobs:
5560
retry_wait_seconds: 120
5661
command: scripts/pod_lib_lint.rb FirebaseABTesting.podspec --platforms=${{ matrix.target }}
5762

58-
spm-package-resolved:
59-
env:
60-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
61-
runs-on: macos-15
62-
outputs:
63-
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
64-
steps:
65-
- uses: actions/checkout@v4
66-
- name: Xcode
67-
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
68-
- name: Generate Swift Package.resolved
69-
id: swift_package_resolve
70-
run: |
71-
swift package resolve
72-
- name: Generate cache key
73-
id: generate_cache_key
74-
run: |
75-
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
76-
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
77-
- uses: actions/cache/save@v4
78-
id: cache
79-
with:
80-
path: .build
81-
key: ${{ steps.generate_cache_key.outputs.cache_key }}
82-
83-
spm:
84-
# Don't run on private repo unless it is a PR.
85-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
86-
needs: [spm-package-resolved]
87-
strategy:
88-
matrix:
89-
include:
90-
- os: macos-14
91-
xcode: Xcode_16.2
92-
target: iOS
93-
- os: macos-15
94-
xcode: Xcode_16.2
95-
target: iOS
96-
- os: macos-15
97-
xcode: Xcode_16.2
98-
target: tvOS
99-
- os: macos-15
100-
xcode: Xcode_16.2
101-
target: macOS
102-
- os: macos-15
103-
xcode: Xcode_16.2
104-
target: watchOS
105-
- os: macos-15
106-
xcode: Xcode_16.2
107-
target: catalyst
108-
- os: macos-15
109-
xcode: Xcode_16.2
110-
target: visionOS
111-
runs-on: ${{ matrix.os }}
112-
steps:
113-
- uses: actions/checkout@v4
114-
- uses: actions/cache/restore@v4
115-
with:
116-
path: .build
117-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
118-
- name: Xcode
119-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
120-
- name: Install visionOS, if needed.
121-
if: matrix.target == 'visionOS'
122-
run: xcodebuild -downloadPlatform visionOS
123-
- name: Initialize xcodebuild
124-
run: scripts/setup_spm_tests.sh
125-
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
126-
with:
127-
timeout_minutes: 120
128-
max_attempts: 3
129-
retry_on: error
130-
retry_wait_seconds: 120
131-
command: scripts/build.sh ABTestingUnit ${{ matrix.target }} spm
132-
13363
catalyst:
13464
# Don't run on private repo unless it is a PR.
13565
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'

.github/workflows/appdistribution.yml

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
spm:
20+
uses: ./.github/workflows/common.yml
21+
with:
22+
target: AppDistributionUnit
23+
platforms: iOS
24+
1925
pod-lib-lint:
2026
# Don't run on private repo unless it is a PR.
2127
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
@@ -40,54 +46,6 @@ jobs:
4046
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAppDistribution.podspec \
4147
--platforms=ios
4248
43-
spm-package-resolved:
44-
env:
45-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
46-
runs-on: macos-14
47-
outputs:
48-
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
49-
steps:
50-
- uses: actions/checkout@v4
51-
- name: Generate Swift Package.resolved
52-
id: swift_package_resolve
53-
run: |
54-
swift package resolve
55-
- name: Generate cache key
56-
id: generate_cache_key
57-
run: |
58-
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
59-
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
60-
- uses: actions/cache/save@v4
61-
id: cache
62-
with:
63-
path: .build
64-
key: ${{ steps.generate_cache_key.outputs.cache_key }}
65-
66-
spm:
67-
# Don't run on private repo unless it is a PR.
68-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
69-
needs: [spm-package-resolved]
70-
strategy:
71-
matrix:
72-
include:
73-
- os: macos-14
74-
xcode: Xcode_16.2
75-
- os: macos-15
76-
xcode: Xcode_16.3
77-
runs-on: ${{ matrix.os }}
78-
steps:
79-
- uses: actions/checkout@v4
80-
- uses: actions/cache/restore@v4
81-
with:
82-
path: .build
83-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
84-
- name: Xcode
85-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
86-
- name: Initialize xcodebuild
87-
run: scripts/setup_spm_tests.sh
88-
- name: iOS Unit Tests
89-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh AppDistributionUnit iOS spm
90-
9149
catalyst:
9250
# Don't run on private repo unless it is a PR.
9351
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'

.github/workflows/auth.yml

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24+
spm:
25+
uses: ./.github/workflows/common.yml
26+
with:
27+
target: AuthUnit
28+
buildonly_platforms: macOS
2429

2530
pod-lib-lint:
2631
# Don't run on private repo unless it is a PR.
@@ -58,6 +63,8 @@ jobs:
5863
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
5964
steps:
6065
- uses: actions/checkout@v4
66+
- name: Xcode
67+
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
6168
- name: Generate Swift Package.resolved
6269
id: swift_package_resolve
6370
run: |
@@ -73,56 +80,6 @@ jobs:
7380
path: .build
7481
key: ${{ steps.generate_cache_key.outputs.cache_key }}
7582

76-
spm:
77-
# Don't run on private repo unless it is a PR.
78-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
79-
needs: [spm-package-resolved]
80-
strategy:
81-
matrix:
82-
include:
83-
- os: macos-14
84-
xcode: Xcode_16.2
85-
target: iOS spm
86-
- os: macos-15
87-
xcode: Xcode_16.3
88-
target: iOS spm
89-
- os: macos-15
90-
xcode: Xcode_16.3
91-
target: tvOS spm
92-
- os: macos-15
93-
xcode: Xcode_16.3
94-
target: macOS spmbuildonly
95-
- os: macos-15
96-
xcode: Xcode_16.3
97-
target: watchOS spm
98-
- os: macos-15
99-
xcode: Xcode_16.3
100-
target: catalyst spm
101-
- os: macos-15
102-
xcode: Xcode_16.3
103-
target: visionOS spm
104-
runs-on: ${{ matrix.os }}
105-
steps:
106-
- uses: actions/checkout@v4
107-
- uses: actions/cache/restore@v4
108-
with:
109-
path: .build
110-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
111-
- name: Xcode
112-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
113-
- name: Install visionOS, if needed.
114-
if: matrix.target == 'visionOS spm'
115-
run: xcodebuild -downloadPlatform visionOS
116-
- name: Initialize xcodebuild
117-
run: scripts/setup_spm_tests.sh
118-
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
119-
with:
120-
timeout_minutes: 120
121-
max_attempts: 3
122-
retry_on: error
123-
retry_wait_seconds: 120
124-
command: scripts/third_party/travis/retry.sh ./scripts/build.sh AuthUnit ${{ matrix.target }}
125-
12683
integration-tests:
12784
# Don't run on private repo unless it is a PR.
12885
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'

.github/workflows/common.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: common
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
# The target scheme to be tested.
7+
target:
8+
type: string
9+
required: true
10+
11+
# The platforms to build on. Defaults to all.
12+
platforms:
13+
type: string
14+
required: false
15+
default: "iOS, tvOS, macOS, watchOS, catalyst, visionOS"
16+
17+
# By default, all platforms will be tested (see matrix in `spm` job).
18+
# To build instead of test, pass a comma or space separated string of
19+
# platforms.
20+
#
21+
# Platform options: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
22+
#
23+
# Examples:
24+
# - build only for macOS: `macOS`
25+
# - build only for macOS and tvOS: `macOS, tvOS`
26+
# - build only for all platforms: `all`
27+
buildonly_platforms:
28+
type: string
29+
required: false
30+
default: ""
31+
32+
jobs:
33+
spm-package-resolved:
34+
env:
35+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
36+
runs-on: macos-15
37+
outputs:
38+
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Xcode
42+
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
43+
- name: Generate Swift Package.resolved
44+
id: swift_package_resolve
45+
run: |
46+
swift package resolve
47+
- name: Generate cache key
48+
id: generate_cache_key
49+
run: |
50+
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
51+
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
52+
- uses: actions/cache/save@v4
53+
id: cache
54+
with:
55+
path: .build
56+
key: ${{ steps.generate_cache_key.outputs.cache_key }}
57+
58+
spm:
59+
# Don't run on private repo unless it is a PR.
60+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
61+
needs: [spm-package-resolved]
62+
strategy:
63+
matrix:
64+
os: [macos-15]
65+
xcode: [Xcode_16.2]
66+
platform: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
67+
include:
68+
- os: macos-14
69+
xcode: Xcode_16.2
70+
platform: iOS
71+
runs-on: ${{ matrix.os }}
72+
steps:
73+
- uses: actions/checkout@v4
74+
- uses: actions/cache/restore@v4
75+
with:
76+
path: .build
77+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
78+
- name: Xcode
79+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
80+
- name: Install visionOS, if needed.
81+
if: matrix.platform == 'visionOS'
82+
run: xcodebuild -downloadPlatform visionOS
83+
- name: Initialize xcodebuild
84+
run: scripts/setup_spm_tests.sh
85+
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
86+
if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'
87+
with:
88+
timeout_minutes: 120
89+
max_attempts: 3
90+
retry_on: error
91+
retry_wait_seconds: 120
92+
command: |
93+
./scripts/build.sh \
94+
${{ inputs.target }} \
95+
${{ matrix.platform }} \
96+
${{ (contains(inputs.buildonly_platforms, matrix.platform) || contains(inputs.buildonly_platforms, 'all')) && 'spmbuildonly' || 'spm' }}

0 commit comments

Comments
 (0)