Skip to content

Commit 95eb9df

Browse files
authored
[Vertex AI] Use actions/cache in workflow (#13687)
1 parent 3ae46c0 commit 95eb9df

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

.github/workflows/vertexai.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,47 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
spm-package-resolved:
19+
runs-on: macos-14
20+
outputs:
21+
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
22+
env:
23+
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Generate Swift Package.resolved
27+
id: swift_package_resolve
28+
run: |
29+
swift package resolve
30+
- name: Generate cache key
31+
id: generate_cache_key
32+
run: |
33+
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
34+
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
35+
- uses: actions/cache/save@v4
36+
id: cache
37+
with:
38+
path: .build
39+
key: ${{ steps.generate_cache_key.outputs.cache_key }}
40+
1841
spm-unit:
1942
strategy:
20-
max-parallel: 1
2143
matrix:
2244
target: [iOS, macOS, catalyst, tvOS, visionOS, watchOS]
2345
os: [macos-14]
2446
include:
2547
- os: macos-14
2648
xcode: Xcode_15.2
2749
runs-on: ${{ matrix.os }}
50+
needs: spm-package-resolved
2851
env:
2952
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
3053
steps:
3154
- uses: actions/checkout@v4
55+
- uses: actions/cache/restore@v4
56+
with:
57+
path: .build
58+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
3259
- name: Clone mock responses
3360
run: scripts/update_vertexai_responses.sh
3461
- name: Xcode
@@ -45,20 +72,24 @@ jobs:
4572

4673
spm-integration:
4774
strategy:
48-
max-parallel: 1
4975
matrix:
5076
target: [iOS]
5177
os: [macos-14]
5278
include:
5379
- os: macos-14
5480
xcode: Xcode_15.2
5581
runs-on: ${{ matrix.os }}
82+
needs: spm-package-resolved
5683
env:
5784
TEST_RUNNER_VertexAIRunIntegrationTests: 1
5885
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
5986
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
6087
steps:
6188
- uses: actions/checkout@v4
89+
- uses: actions/cache/restore@v4
90+
with:
91+
path: .build
92+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
6293
- name: Install Secret GoogleService-Info.plist
6394
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/vertexai-integration.plist.gpg \
6495
FirebaseVertexAI/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
@@ -108,14 +139,17 @@ jobs:
108139
- os: macos-14
109140
xcode: Xcode_15.2
110141
runs-on: ${{ matrix.os }}
142+
needs: spm-package-resolved
111143
env:
112144
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
113145
steps:
114146
- uses: actions/checkout@v4
147+
- uses: actions/cache/restore@v4
148+
with:
149+
path: .build
150+
key: ${{needs.spm-package-resolved.outputs.cache_key}}
115151
- name: Xcode
116152
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
117-
- name: Initialize xcodebuild
118-
run: xcodebuild -list
119153
- name: Placeholder GoogleService-Info.plist for build testing
120154
run: cp FirebaseCore/Tests/Unit/Resources/GoogleService-Info.plist FirebaseVertexAI/Sample/
121155
- uses: nick-fields/retry@v3

0 commit comments

Comments
 (0)