ci: key Library caches per build configuration (#864)

Server and Player builds shared a cache key, and every job could fall back to any other job's Library through the bare Library- restore key. A Library remembers its last standalone subtarget, so a macOS Player build that restored an Ubuntu Server Library tried to build a Mac Dedicated Server and failed. Keys now include the scripting backend and subtarget, prefix fallbacks are gone, and the v2 prefix leaves the polluted caches behind.

Co-authored-by: Frostebite <[email protected]>
This commit is contained in:
Webber Takken
2026-10-24 22:33:03 +02:00
committed by GitHub
co-authored by Frostebite
parent 58e7224b82
commit fc892a0623
3 changed files with 15 additions and 12 deletions
+5 -4
View File
@@ -59,10 +59,11 @@ jobs:
id: cache-restore
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-macos-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-${{ matrix.buildProfile }}
restore-keys: |
Library-${{ matrix.projectPath }}-macos-
Library-
# One cache per build configuration and no prefix fallback: a Library
# remembers the settings of the build that produced it (such as the
# standalone subtarget), so restoring another configuration's Library
# changes what gets built. Bump the version to discard every Library cache.
key: Library-v2-${{ matrix.projectPath }}-macos-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-il2cpp-true-subtarget-player-${{ matrix.buildProfile }}
###########################
# Set Scripting Backend #
+5 -4
View File
@@ -138,10 +138,11 @@ jobs:
id: cache-restore
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-ubuntu-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-${{ matrix.buildProfile }}
restore-keys: |
Library-${{ matrix.projectPath }}-ubuntu-
Library-
# One cache per build configuration and no prefix fallback: a Library
# remembers the settings of the build that produced it (such as the
# standalone subtarget), so restoring another configuration's Library
# changes what gets built. Bump the version to discard every Library cache.
key: Library-v2-${{ matrix.projectPath }}-ubuntu-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-il2cpp-${{ matrix.buildWithIl2cpp == true }}-subtarget-${{ contains(matrix.additionalParameters, '-standaloneBuildSubtarget Server') && 'server' || 'player' }}-${{ matrix.buildProfile }}
###########################
# Set Scripting Backend #
+5 -4
View File
@@ -66,10 +66,11 @@ jobs:
id: cache-restore
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-windows-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-${{ matrix.buildProfile }}
restore-keys: |
Library-${{ matrix.projectPath }}-windows-
Library-
# One cache per build configuration and no prefix fallback: a Library
# remembers the settings of the build that produced it (such as the
# standalone subtarget), so restoring another configuration's Library
# changes what gets built. Bump the version to discard every Library cache.
key: Library-v2-${{ matrix.projectPath }}-windows-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-il2cpp-true-subtarget-player-${{ matrix.buildProfile }}
###########################
# Set Scripting Backend #