Skip to content

Commit cca2823

Browse files
committed
[Infra] Create common SPM-focused reusable workflow
1 parent b321674 commit cca2823

File tree

2 files changed

+174
-135
lines changed

2 files changed

+174
-135
lines changed

.github/workflows/common.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: common
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
spm-package-resolved:
12+
env:
13+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
14+
runs-on: macos-15
15+
outputs:
16+
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Xcode
20+
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
21+
- name: Generate Swift Package.resolved
22+
id: swift_package_resolve
23+
run: |
24+
swift package resolve
25+
- name: Generate cache key
26+
id: generate_cache_key
27+
run: |
28+
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
29+
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
30+
- uses: actions/cache/save@v4
31+
id: cache
32+
with:
33+
path: .build
34+
key: ${{ steps.generate_cache_key.outputs.cache_key }}
35+
36+
spm:
37+
# Don't run on private repo unless it is a PR.
38+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
39+
needs: [spm-package-resolved]
40+
strategy:
41+
matrix:
42+
# TODO: Add Xcode matrix when Xcode 16 is ubiquitous on CI runners.
43+
include:
44+
- os: macos-14
45+
xcode: Xcode_16.2
46+
platform: iOS
47+
- os: macos-15
48+
xcode: Xcode_16.2
49+
platform: iOS
50+
- os: macos-15
51+
xcode: Xcode_16.2
52+
platform: iOS
53+
- os: macos-15
54+
xcode: Xcode_16.2
55+
platform: tvOS
56+
- os: macos-15
57+
xcode: Xcode_16.2
58+
platform: macOS
59+
- os: macos-15
60+
xcode: Xcode_16.2
61+
platform: watchOS
62+
- os: macos-15
63+
xcode: Xcode_16.2
64+
platform: catalyst
65+
- os: macos-15
66+
xcode: Xcode_16.2
67+
platform: visionOS
68+
runs-on: ${{ matrix.os }}
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: actions/cache/restore@v4
72+
with:
73+
path: .build
74+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
75+
- name: Xcode
76+
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
77+
- name: Install visionOS, if needed.
78+
if: matrix.platform == 'visionOS'
79+
run: xcodebuild -downloadPlatform visionOS
80+
- name: Initialize xcodebuild
81+
run: scripts/setup_spm_tests.sh
82+
- name: Unit Tests
83+
run: scripts/third_party/travis/retry.sh ./scripts/build.sh ${{ inputs.target }} ${{ matrix.platform }} spm

.github/workflows/core.yml

Lines changed: 91 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -16,142 +16,98 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19-
pod-lib-lint:
20-
# Don't run on private repo unless it is a PR.
21-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
22-
strategy:
23-
matrix:
24-
# TODO: macos tests are blocked by https://github.com/erikdoe/ocmock/pull/532
25-
target: [ios, tvos, macos --skip-tests, watchos]
26-
build-env:
27-
- os: macos-14
28-
xcode: Xcode_16.2
29-
- os: macos-15
30-
xcode: Xcode_16.2
31-
# TODO: Add Xcode matrix when Xcode 16 is ubiquitous on CI runners.
19+
# pod-lib-lint:
20+
# # Don't run on private repo unless it is a PR.
21+
# if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
22+
# strategy:
23+
# matrix:
24+
# # TODO: macos tests are blocked by https://github.com/erikdoe/ocmock/pull/532
25+
# target: [ios, tvos, macos --skip-tests, watchos]
26+
# build-env:
27+
# - os: macos-14
28+
# xcode: Xcode_16.2
3229
# - os: macos-15
33-
# xcode: Xcode_16.3
34-
runs-on: ${{ matrix.build-env.os }}
35-
steps:
36-
- uses: actions/checkout@v4
37-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
38-
- name: Setup Bundler
39-
run: scripts/setup_bundler.sh
40-
- name: Xcode
41-
run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
42-
- name: Build and test
43-
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCore.podspec --platforms=${{ matrix.target }}
44-
45-
spm-package-resolved:
46-
env:
47-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
48-
runs-on: macos-15
49-
outputs:
50-
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
51-
steps:
52-
- uses: actions/checkout@v4
53-
- name: Xcode
54-
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
55-
- name: Generate Swift Package.resolved
56-
id: swift_package_resolve
57-
run: |
58-
swift package resolve
59-
- name: Generate cache key
60-
id: generate_cache_key
61-
run: |
62-
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
63-
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
64-
- uses: actions/cache/save@v4
65-
id: cache
66-
with:
67-
path: .build
68-
key: ${{ steps.generate_cache_key.outputs.cache_key }}
30+
# xcode: Xcode_16.2
31+
# # TODO: Add Xcode matrix when Xcode 16 is ubiquitous on CI runners.
32+
## - os: macos-15
33+
## xcode: Xcode_16.3
34+
# runs-on: ${{ matrix.build-env.os }}
35+
# steps:
36+
# - uses: actions/checkout@v4
37+
# - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
38+
# - name: Setup Bundler
39+
# run: scripts/setup_bundler.sh
40+
# - name: Xcode
41+
# run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
42+
# - name: Build and test
43+
# run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCore.podspec --platforms=${{ matrix.target }}
44+
#
45+
# spm-package-resolved:
46+
# env:
47+
# FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
48+
# runs-on: macos-15
49+
# outputs:
50+
# cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
51+
# steps:
52+
# - uses: actions/checkout@v4
53+
# - name: Xcode
54+
# run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
55+
# - name: Generate Swift Package.resolved
56+
# id: swift_package_resolve
57+
# run: |
58+
# swift package resolve
59+
# - name: Generate cache key
60+
# id: generate_cache_key
61+
# run: |
62+
# cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
63+
# echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
64+
# - uses: actions/cache/save@v4
65+
# id: cache
66+
# with:
67+
# path: .build
68+
# key: ${{ steps.generate_cache_key.outputs.cache_key }}
6969

7070
spm:
71-
# Don't run on private repo unless it is a PR.
72-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
73-
needs: [spm-package-resolved]
74-
strategy:
75-
matrix:
76-
# TODO: Add Xcode matrix when Xcode 16 is ubiquitous on CI runners.
77-
include:
78-
- os: macos-14
79-
xcode: Xcode_16.2
80-
target: iOS
81-
- os: macos-15
82-
xcode: Xcode_16.2
83-
target: iOS
84-
- os: macos-15
85-
xcode: Xcode_16.2
86-
target: iOS
87-
- os: macos-15
88-
xcode: Xcode_16.2
89-
target: tvOS
90-
- os: macos-15
91-
xcode: Xcode_16.2
92-
target: macOS
93-
- os: macos-15
94-
xcode: Xcode_16.2
95-
target: watchOS
96-
- os: macos-15
97-
xcode: Xcode_16.2
98-
target: catalyst
99-
- os: macos-15
100-
xcode: Xcode_16.2
101-
target: visionOS
102-
runs-on: ${{ matrix.os }}
103-
steps:
104-
- uses: actions/checkout@v4
105-
- uses: actions/cache/restore@v4
106-
with:
107-
path: .build
108-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
109-
- name: Xcode
110-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
111-
- name: Install visionOS, if needed.
112-
if: matrix.target == 'visionOS'
113-
run: xcodebuild -downloadPlatform visionOS
114-
- name: Initialize xcodebuild
115-
run: scripts/setup_spm_tests.sh
116-
- name: Unit Tests
117-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh CoreUnit ${{ matrix.target }} spm
118-
119-
catalyst:
120-
# Don't run on private repo unless it is a PR.
121-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
122-
123-
runs-on: macos-15
124-
steps:
125-
- uses: actions/checkout@v4
126-
- uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
127-
with:
128-
cache_key: ${{ matrix.os }}
129-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
130-
- name: Setup Bundler
131-
run: scripts/setup_bundler.sh
132-
- name: Xcode
133-
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
134-
- name: Setup project and Build Catalyst
135-
run: scripts/test_catalyst.sh FirebaseCore test FirebaseCore-Unit-unit
136-
137-
core-cron-only:
138-
# Don't run on private repo.
139-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
71+
uses: ./.github/workflows/common.yml
72+
with:
73+
target: CoreUnit
14074

141-
runs-on: macos-14
142-
strategy:
143-
matrix:
144-
target: [ios, tvos, macos]
145-
flags: [
146-
'--use-static-frameworks'
147-
]
148-
needs: pod-lib-lint
149-
steps:
150-
- uses: actions/checkout@v4
151-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
152-
- name: Xcode
153-
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
154-
- name: Setup Bundler
155-
run: scripts/setup_bundler.sh
156-
- name: PodLibLint Core Cron
157-
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCore.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
75+
# catalyst:
76+
# # Don't run on private repo unless it is a PR.
77+
# if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
78+
#
79+
# runs-on: macos-15
80+
# steps:
81+
# - uses: actions/checkout@v4
82+
# - uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
83+
# with:
84+
# cache_key: ${{ matrix.os }}
85+
# - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
86+
# - name: Setup Bundler
87+
# run: scripts/setup_bundler.sh
88+
# - name: Xcode
89+
# run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
90+
# - name: Setup project and Build Catalyst
91+
# run: scripts/test_catalyst.sh FirebaseCore test FirebaseCore-Unit-unit
92+
#
93+
# core-cron-only:
94+
# # Don't run on private repo.
95+
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
96+
#
97+
# runs-on: macos-14
98+
# strategy:
99+
# matrix:
100+
# target: [ios, tvos, macos]
101+
# flags: [
102+
# '--use-static-frameworks'
103+
# ]
104+
# needs: pod-lib-lint
105+
# steps:
106+
# - uses: actions/checkout@v4
107+
# - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
108+
# - name: Xcode
109+
# run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
110+
# - name: Setup Bundler
111+
# run: scripts/setup_bundler.sh
112+
# - name: PodLibLint Core Cron
113+
# run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseCore.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}

0 commit comments

Comments
 (0)