Skip to content

Commit ae48cc3

Browse files
authored
chore: new integration test caching strategy (#2734)
1 parent d0ad95a commit ae48cc3

8 files changed

Lines changed: 116 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,17 @@ jobs:
178178
- name: Extract project archive
179179
run: tar -xvzf test-project.tar.gz
180180

181-
- name: Cache Unity Library
182-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
181+
- name: Restore Unity Library cache
182+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
183183
with:
184184
path: samples/IntegrationTest/Library
185-
key: Library-IntegrationTest-${{ matrix.platform }}-${{ matrix.unity-version }}-v2
185+
key: it-library-ubuntu-${{ matrix.unity-version }}-${{ github.run_id }}
186186
restore-keys: |
187-
Library-IntegrationTest-${{ matrix.platform }}-${{ matrix.unity-version }}-
187+
it-library-ubuntu-${{ matrix.unity-version }}-
188188
189189
- name: Restore cached build without Sentry
190190
id: cache-build-nosentry
191-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
191+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
192192
with:
193193
path: samples/IntegrationTest/Build-NoSentry
194194
key: build-nosentry-${{ matrix.build_platform }}-${{ matrix.unity-version }}
@@ -199,6 +199,13 @@ jobs:
199199
env:
200200
BUILD_PLATFORM: ${{ matrix.build_platform }}
201201

202+
- name: Save cached build without Sentry
203+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
204+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
205+
with:
206+
path: samples/IntegrationTest/Build-NoSentry
207+
key: build-nosentry-${{ matrix.build_platform }}-${{ matrix.unity-version }}
208+
202209
- name: Download UPM package
203210
uses: ./.github/actions/wait-for-artifact
204211
with:
@@ -260,6 +267,8 @@ jobs:
260267
path: test-app-webgl.tar.gz
261268
retention-days: 14
262269

270+
# Library cache for the shared `ubuntu` flavour is written only by the Linux job
271+
# (see test-build-linux.yml) - the other ubuntu targets are restore-only.
263272
- name: Upload IntegrationTest project on failure
264273
if: ${{ failure() }}
265274
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-build-android.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ jobs:
4545
- name: Extract project archive
4646
run: tar -xvzf test-project.tar.gz
4747

48-
- name: Cache Unity Library
49-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
48+
- name: Restore Unity Library cache
49+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5050
with:
5151
path: samples/IntegrationTest/Library
52-
key: Library-IntegrationTest-Android-${{ env.UNITY_VERSION }}-v2
52+
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
5353
restore-keys: |
54-
Library-IntegrationTest-Android-${{ env.UNITY_VERSION }}-
54+
it-library-ubuntu-${{ env.UNITY_VERSION }}-
5555
5656
- name: Restore cached build without Sentry
5757
id: cache-build-nosentry
58-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
58+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5959
with:
6060
path: samples/IntegrationTest/Build-NoSentry
6161
key: build-nosentry-Android-${{ inputs.unity-version }}
@@ -64,6 +64,13 @@ jobs:
6464
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
6565
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -BuildDirName "Build-NoSentry"
6666

67+
- name: Save cached build without Sentry
68+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
69+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
70+
with:
71+
path: samples/IntegrationTest/Build-NoSentry
72+
key: build-nosentry-Android-${{ inputs.unity-version }}
73+
6774
- name: Download UPM package
6875
uses: ./.github/actions/wait-for-artifact
6976
with:
@@ -144,6 +151,8 @@ jobs:
144151
samples/IntegrationTest/Build/sentry-mapping-upload.log
145152
retention-days: 14
146153

154+
# Library cache for the shared `ubuntu` flavour is written only by the Linux job
155+
# (see test-build-linux.yml) - the other ubuntu targets are restore-only.
147156
- name: Upload IntegrationTest project on failure
148157
if: ${{ failure() }}
149158
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-build-ios.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ jobs:
5151
- name: Extract project archive
5252
run: tar -xvzf test-project.tar.gz
5353

54-
- name: Cache Unity Library
55-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
54+
- name: Restore Unity Library cache
55+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5656
with:
5757
path: samples/IntegrationTest/Library
58-
key: Library-IntegrationTest-iOS-${{ env.UNITY_VERSION }}-v2
58+
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
5959
restore-keys: |
60-
Library-IntegrationTest-iOS-${{ env.UNITY_VERSION }}-
60+
it-library-ubuntu-${{ env.UNITY_VERSION }}-
6161
6262
- name: Restore cached build without Sentry
6363
id: cache-build-nosentry
64-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
64+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6565
with:
6666
path: samples/IntegrationTest/Build-NoSentry
6767
key: build-nosentry-iOS-${{ inputs.unity-version }}
@@ -70,6 +70,13 @@ jobs:
7070
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
7171
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "iOS" -BuildDirName "Build-NoSentry"
7272

73+
- name: Save cached build without Sentry
74+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
75+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
76+
with:
77+
path: samples/IntegrationTest/Build-NoSentry
78+
key: build-nosentry-iOS-${{ inputs.unity-version }}
79+
7380
- name: Create archive for build without Sentry
7481
shell: bash
7582
run: |
@@ -157,6 +164,8 @@ jobs:
157164
path: test-app-buildtime.tar.gz
158165
retention-days: 14
159166

167+
# Library cache for the shared `ubuntu` flavour is written only by the Linux job
168+
# (see test-build-linux.yml) - the other ubuntu targets are restore-only.
160169
- name: Upload IntegrationTest project on failure
161170
if: ${{ failure() }}
162171
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-build-linux.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ jobs:
5656
- name: Extract project archive
5757
run: tar -xvzf test-project.tar.gz
5858

59-
- name: Cache Unity Library
60-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
59+
- name: Restore Unity Library cache
60+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6161
with:
6262
path: samples/IntegrationTest/Library
63-
key: Library-IntegrationTest-linux-${{ env.UNITY_VERSION }}-v2
63+
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
6464
restore-keys: |
65-
Library-IntegrationTest-linux-${{ env.UNITY_VERSION }}-
65+
it-library-ubuntu-${{ env.UNITY_VERSION }}-
6666
6767
- name: Restore cached build without Sentry
6868
id: cache-build-nosentry
69-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
69+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
7070
with:
7171
path: samples/IntegrationTest/Build-NoSentry
7272
key: build-nosentry-Linux-${{ inputs.unity-version }}
@@ -75,6 +75,13 @@ jobs:
7575
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
7676
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -BuildDirName "Build-NoSentry"
7777

78+
- name: Save cached build without Sentry
79+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
80+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
81+
with:
82+
path: samples/IntegrationTest/Build-NoSentry
83+
key: build-nosentry-Linux-${{ inputs.unity-version }}
84+
7885
- name: Download UPM package
7986
uses: ./.github/actions/wait-for-artifact
8087
with:
@@ -153,6 +160,13 @@ jobs:
153160
path: test-app-desktop.tar.gz
154161
retention-days: 14
155162

163+
- name: Save Unity Library cache
164+
if: github.ref == 'refs/heads/main'
165+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
166+
with:
167+
path: samples/IntegrationTest/Library
168+
key: it-library-ubuntu-${{ env.UNITY_VERSION }}-${{ github.run_id }}
169+
156170
- name: Docker diagnostics on failure
157171
if: ${{ failure() }}
158172
run: |

.github/workflows/test-build-macos.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ jobs:
5151
- name: Extract project archive
5252
run: tar -xvzf test-project.tar.gz
5353

54-
- name: Cache Unity Library
55-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
54+
- name: Restore Unity Library cache
55+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5656
with:
5757
path: samples/IntegrationTest/Library
58-
key: Library-IntegrationTest-macos-${{ env.UNITY_VERSION }}-v2
58+
key: it-library-macos-${{ env.UNITY_VERSION }}-${{ github.run_id }}
5959
restore-keys: |
60-
Library-IntegrationTest-macos-${{ env.UNITY_VERSION }}-
60+
it-library-macos-${{ env.UNITY_VERSION }}-
6161
6262
- name: Restore cached build without Sentry
6363
id: cache-build-nosentry
64-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
64+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6565
with:
6666
path: samples/IntegrationTest/Build-NoSentry
6767
key: build-nosentry-MacOS-${{ inputs.unity-version }}
@@ -70,6 +70,13 @@ jobs:
7070
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
7171
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform MacOS -BuildDirName "Build-NoSentry"
7272

73+
- name: Save cached build without Sentry
74+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
75+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
76+
with:
77+
path: samples/IntegrationTest/Build-NoSentry
78+
key: build-nosentry-MacOS-${{ inputs.unity-version }}
79+
7380
- name: Download UPM package
7481
uses: ./.github/actions/wait-for-artifact
7582
with:
@@ -148,6 +155,13 @@ jobs:
148155
path: test-app-desktop.tar.gz
149156
retention-days: 14
150157

158+
- name: Save Unity Library cache
159+
if: github.ref == 'refs/heads/main'
160+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
161+
with:
162+
path: samples/IntegrationTest/Library
163+
key: it-library-macos-${{ env.UNITY_VERSION }}-${{ github.run_id }}
164+
151165
- name: Upload IntegrationTest project on failure
152166
if: ${{ failure() }}
153167
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-build-windows.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ jobs:
5151
- name: Extract project archive
5252
run: tar -xvzf test-project.tar.gz
5353

54-
- name: Cache Unity Library
55-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
54+
- name: Restore Unity Library cache
55+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5656
with:
5757
path: samples/IntegrationTest/Library
58-
key: Library-IntegrationTest-windows-${{ env.UNITY_VERSION }}-v2
58+
key: it-library-windows-${{ env.UNITY_VERSION }}-${{ github.run_id }}
5959
restore-keys: |
60-
Library-IntegrationTest-windows-${{ env.UNITY_VERSION }}-
60+
it-library-windows-${{ env.UNITY_VERSION }}-
6161
6262
- name: Restore cached build without Sentry
6363
id: cache-build-nosentry
64-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
64+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6565
with:
6666
path: samples/IntegrationTest/Build-NoSentry
6767
key: build-nosentry-Windows-${{ inputs.unity-version }}
@@ -70,6 +70,13 @@ jobs:
7070
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
7171
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -BuildDirName "Build-NoSentry"
7272

73+
- name: Save cached build without Sentry
74+
if: github.ref == 'refs/heads/main' && steps.cache-build-nosentry.outputs.cache-hit != 'true'
75+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
76+
with:
77+
path: samples/IntegrationTest/Build-NoSentry
78+
key: build-nosentry-Windows-${{ inputs.unity-version }}
79+
7380
- name: Download UPM package
7481
uses: ./.github/actions/wait-for-artifact
7582
with:
@@ -148,6 +155,13 @@ jobs:
148155
path: test-app-desktop.tar.gz
149156
retention-days: 14
150157

158+
- name: Save Unity Library cache
159+
if: github.ref == 'refs/heads/main'
160+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
161+
with:
162+
path: samples/IntegrationTest/Library
163+
key: it-library-windows-${{ env.UNITY_VERSION }}-${{ github.run_id }}
164+
151165
- name: Upload IntegrationTest project on failure
152166
if: ${{ failure() }}
153167
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/test-compile-ios.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Restore cached compiled iOS build without Sentry
2929
if: ${{ inputs.init-type == 'runtime' }}
3030
id: cache-compiled-nosentry
31-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
31+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
3232
with:
3333
path: IntegrationTest-NoSentry.app
3434
key: build-nosentry-iOS-compiled-${{ inputs.unity-version }}
@@ -57,6 +57,13 @@ jobs:
5757
-Destination "IntegrationTest-NoSentry.app" -Recurse
5858
Remove-Item -Path "samples/IntegrationTest/Build" -Recurse -Force
5959
60+
- name: Save cached compiled iOS build without Sentry
61+
if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main' }}
62+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
63+
with:
64+
path: IntegrationTest-NoSentry.app
65+
key: build-nosentry-iOS-compiled-${{ inputs.unity-version }}
66+
6067
- name: Download app project
6168
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
6269
with:

.github/workflows/test-create.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
username: ${{ env.GITHUB_ACTOR }}
3131
password: ${{ secrets.GITHUB_TOKEN }}
3232

33-
- name: Cache IntegrationTest Project
33+
- name: Restore IntegrationTest Project cache
3434
id: cache-project
35-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
35+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
3636
with:
3737
path: samples/IntegrationTest
3838
key: IntegrationTest-Project-${{ env.UNITY_VERSION }}-${{ hashFiles('test/Scripts.Integration.Test/**') }}-v1
@@ -50,6 +50,13 @@ jobs:
5050
if: steps.cache-project.outputs.cache-hit != 'true'
5151
run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "$env:UNITY_PATH"
5252

53+
- name: Save IntegrationTest Project cache
54+
if: github.ref == 'refs/heads/main' && steps.cache-project.outputs.cache-hit != 'true'
55+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
56+
with:
57+
path: samples/IntegrationTest
58+
key: IntegrationTest-Project-${{ env.UNITY_VERSION }}-${{ hashFiles('test/Scripts.Integration.Test/**') }}-v1
59+
5360
# We create tar explicitly because upload-artifact is slow for many files.
5461
- name: Create archive
5562
run: tar -cvzf test-project.tar.gz samples/IntegrationTest

0 commit comments

Comments
 (0)