Skip to content

Commit 09f1a1a

Browse files
authored
[Infra] Migrate .github/workflows/functions.yml to reusable workflows (#14906)
1 parent 588c023 commit 09f1a1a

File tree

1 file changed

+9
-94
lines changed

1 file changed

+9
-94
lines changed

.github/workflows/functions.yml

Lines changed: 9 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -35,105 +35,20 @@ jobs:
3535
supports_swift6: true
3636
setup_command: FirebaseFunctions/Backend/start.sh synchronous
3737

38-
spm-package-resolved:
39-
runs-on: macos-14
40-
env:
41-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
42-
outputs:
43-
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
44-
steps:
45-
- uses: actions/checkout@v4
46-
- name: Xcode
47-
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
48-
- name: Generate Swift Package.resolved
49-
id: swift_package_resolve
50-
run: |
51-
swift package resolve
52-
- name: Generate cache key
53-
id: generate_cache_key
54-
run: |
55-
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
56-
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
57-
- uses: actions/cache/save@v4
58-
id: cache
59-
with:
60-
path: .build
61-
key: ${{ steps.generate_cache_key.outputs.cache_key }}
62-
6338
spm-integration:
64-
# Don't run on private repo unless it is a PR.
65-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
66-
needs: [spm-package-resolved]
39+
uses: ./.github/workflows/common.yml
6740
strategy:
6841
matrix:
69-
os: [macos-15]
70-
xcode: [Xcode_16.3]
71-
runs-on: ${{ matrix.os }}
72-
env:
73-
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
74-
steps:
75-
- uses: actions/checkout@v4
76-
- uses: actions/cache/restore@v4
77-
with:
78-
path: .build
79-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
80-
- name: Initialize xcodebuild
81-
run: scripts/setup_spm_tests.sh
82-
- name: Integration Test Server
83-
run: FirebaseFunctions/Backend/start.sh synchronous
84-
- name: Xcode
85-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
86-
- name: iOS Swift Integration Tests (including Swift library)
87-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsIntegration iOS spm
88-
- name: iOS ObjC Integration Tests (using Swift library)
89-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsObjCIntegration iOS spm
90-
- name: Combine Unit Tests
91-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsCombineUnit iOS spm
42+
target: [FirebaseFunctionsIntegration, FirebaseFunctionsObjCIntegration, FunctionsCombineUnit]
43+
with:
44+
target: ${{ matrix.target }}
45+
platforms: iOS
46+
setup_command: FirebaseFunctions/Backend/start.sh synchronous
9247

9348
spm-unit:
94-
# Don't run on private repo.
95-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
96-
needs: [spm-package-resolved]
97-
strategy:
98-
matrix:
99-
include:
100-
- os: macos-14
101-
xcode: Xcode_16.2
102-
target: iOS
103-
- os: macos-15
104-
xcode: Xcode_16.3
105-
target: iOS
106-
- os: macos-15
107-
xcode: Xcode_16.3
108-
target: tvOS
109-
- os: macos-15
110-
xcode: Xcode_16.3
111-
target: macOS
112-
- os: macos-15
113-
xcode: Xcode_16.3
114-
target: watchOS
115-
- os: macos-15
116-
xcode: Xcode_16.3
117-
target: catalyst
118-
- os: macos-15
119-
xcode: Xcode_16.3
120-
target: visionOS
121-
runs-on: ${{ matrix.os }}
122-
steps:
123-
- uses: actions/checkout@v4
124-
- uses: actions/cache/restore@v4
125-
with:
126-
path: .build
127-
key: ${{needs.spm-package-resolved.outputs.cache_key}}
128-
- name: Xcode
129-
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
130-
- name: Install visionOS, if needed.
131-
if: matrix.target == 'visionOS'
132-
run: xcodebuild -downloadPlatform visionOS
133-
- name: Initialize xcodebuild
134-
run: scripts/setup_spm_tests.sh
135-
- name: Unit Tests
136-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsUnit ${{ matrix.target }} spm
49+
uses: ./.github/workflows/common.yml
50+
with:
51+
target: FirebaseFunctionsUnit
13752

13853
# TODO: Move to macos-14 and Xcode 15. The legacy quickstart uses material which doesn't build on Xcode 15.
13954
# quickstart:

0 commit comments

Comments
 (0)