Skip to content

Commit 80b5953

Browse files
committed
ci(vcpkg): Only have Generals win32-vcpkg-debug job save cache to prevent race condition
1 parent 4ced7c2 commit 80b5953

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,10 @@ jobs:
206206
Write-Host "github.ref='${{ github.ref }}'" -ForegroundColor Cyan
207207
208208
- name: Save vcpkg binary cache
209-
# Save if cache was not hit (cache-hit != 'true' handles both 'false' and empty string cases)
210-
# Note: All 6 parallel jobs may attempt to save the same cache key simultaneously.
211-
# This is expected - GitHub Actions ensures only one succeeds, others show harmless warnings.
212-
# See: https://github.com/actions/cache/blob/main/save/README.md
213-
if: ${{ always() && startsWith(inputs.preset, 'win32') && steps.vcpkg_cache.outputs.cache-hit != 'true' }}
209+
# Only save if cache was not hit AND this is the designated job to save (prevents all 6 jobs from racing)
210+
# We use Generals + win32-vcpkg-debug as the "designated saver" since it's deterministic and always runs
211+
# All other jobs will benefit from the cache once it's saved by this job
212+
if: ${{ always() && startsWith(inputs.preset, 'win32') && steps.vcpkg_cache.outputs.cache-hit != 'true' && inputs.game == 'Generals' && inputs.preset == 'win32-vcpkg-debug' }}
214213
uses: actions/cache/save@v4
215214
with:
216215
path: ${{ github.workspace }}\vcpkg-bincache

0 commit comments

Comments
 (0)