1414 types : [ labeled, opened, synchronize, reopened ]
1515
1616jobs :
17- # Warm up LFS cache once, on a single runner, and compute a stable cache key
17+ # Prime a single LFS cache and expose the exact key for the matrix
1818 WarmLFS :
1919 runs-on : ubuntu-latest
20-
21- # Expose the computed cache key so matrix jobs can use it
2220 outputs :
23- lfs_key : ${{ steps.compute-key.outputs.lfs_key }}
24-
21+ lfs_key : ${{ steps.expose-key.outputs.lfs_key }}
2522 steps :
26- # Checkout repo with full history and submodules so we can see all LFS files
27- - uses : actions/checkout@v4
23+ - name : Git Config
24+ shell : bash
25+ run : |
26+ git config --global core.autocrlf false
27+ git config --global core.longpaths true
28+
29+ - name : Git Checkout
30+ uses : actions/checkout@v4
2831 with :
2932 fetch-depth : 0
3033 submodules : recursive
3134
32- # Create a deterministic list of LFS object IDs:
35+ # Deterministic list of LFS object IDs, then compute a portable key :
3336 # - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256
3437 # - `awk '{print $1}'` extracts just the SHA field
3538 # - `sort` sorts in byte order (hex hashes sort the same everywhere)
@@ -38,30 +41,25 @@ jobs:
3841 shell : bash
3942 run : git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id
4043
41- # Compute a stable cache key by hashing the list file itself.
42- # This guarantees the same key across all OSes and all matrix jobs.
43- - name : Git Compute LFS cache key
44- id : compute-key
44+ - name : Git Expose LFS cache key
45+ id : expose-key
4546 shell : bash
46- run : |
47- # sha256sum outputs "<hash> <filename>"
48- KEY_HASH=$(sha256sum .lfs-assets-id | awk '{print $1}')
49- echo "lfs_key=lfs-${KEY_HASH}-v1" >> "$GITHUB_OUTPUT"
47+ env :
48+ LFS_KEY : lfs-${{ hashFiles('.lfs-assets-id') }}-v1
49+ run : echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT"
5050
51- # Restore or populate the cache for .git/lfs using the computed key
5251 - name : Git Setup LFS Cache
5352 uses : actions/cache@v4
5453 with :
5554 path : .git/lfs
56- key : ${{ steps.compute -key.outputs.lfs_key }}
55+ key : ${{ steps.expose -key.outputs.lfs_key }}
5756
58- # Ensure all LFS files for this commit are present locally
5957 - name : Git Pull LFS
6058 shell : bash
6159 run : git lfs pull
6260
6361 Build :
64- needs : WarmLFS # Ensure the cache and id file exist before starting the matrix
62+ needs : WarmLFS
6563 strategy :
6664 matrix :
6765 isARM :
@@ -123,8 +121,8 @@ jobs:
123121 - name : Install libgdi+, which is required for tests running on ubuntu
124122 if : ${{ contains(matrix.options.os, 'ubuntu') }}
125123 run : |
126- sudo apt-get update
127- sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
124+ sudo apt-get update
125+ sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
128126
129127 - name : Git Config
130128 shell : bash
@@ -138,21 +136,15 @@ jobs:
138136 fetch-depth : 0
139137 submodules : recursive
140138
141- # Use the *exact same key* computed in WarmLFS to restore the warmed cache.
142- # This avoids regenerating the key per-OS and ensures all matrix jobs hit the same cache.
143- - uses : actions/cache@v4
144- with :
145- path : .git/lfs
146- key : ${{ needs.WarmLFS.outputs.lfs_key }}
147-
139+ # Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
148140 - name : Git Setup LFS Cache
149141 uses : actions/cache@v4
150- id : lfs-cache
151142 with :
152143 path : .git/lfs
153- key : lfs- ${{ hashFiles('.lfs-assets-id') }}-v1
144+ key : ${{ needs.WarmLFS.outputs.lfs_key }}
154145
155146 - name : Git Pull LFS
147+ shell : bash
156148 run : git lfs pull
157149
158150 - name : NuGet Install
@@ -183,29 +175,29 @@ jobs:
183175 - name : DotNet Build
184176 if : ${{ matrix.options.sdk-preview != true }}
185177 shell : pwsh
186- run : ./ci-build.ps1 "${{ matrix.options.framework }}"
178+ run : ./ci-build.ps1 "${{matrix.options.framework}}"
187179 env :
188180 SIXLABORS_TESTING : True
189181
190182 - name : DotNet Build Preview
191183 if : ${{ matrix.options.sdk-preview == true }}
192184 shell : pwsh
193- run : ./ci-build.ps1 "${{ matrix.options.framework }}"
185+ run : ./ci-build.ps1 "${{matrix.options.framework}}"
194186 env :
195187 SIXLABORS_TESTING_PREVIEW : True
196188
197189 - name : DotNet Test
198190 if : ${{ matrix.options.sdk-preview != true }}
199191 shell : pwsh
200- run : ./ci-test.ps1 "${{ matrix.options.os }}" "${{ matrix.options.framework }}" "${{ matrix.options.runtime }}" "${{ matrix.options.codecov }}"
192+ run : ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
201193 env :
202194 SIXLABORS_TESTING : True
203195 XUNIT_PATH : .\tests\ImageSharp.Tests # Required for xunit
204196
205197 - name : DotNet Test Preview
206198 if : ${{ matrix.options.sdk-preview == true }}
207199 shell : pwsh
208- run : ./ci-test.ps1 "${{ matrix.options.os }}" "${{ matrix.options.framework }}" "${{ matrix.options.runtime }}" "${{ matrix.options.codecov }}"
200+ run : ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
209201 env :
210202 SIXLABORS_TESTING_PREVIEW : True
211203 XUNIT_PATH : .\tests\ImageSharp.Tests # Required for xunit
@@ -219,11 +211,8 @@ jobs:
219211
220212 Publish :
221213 needs : [Build]
222-
223214 runs-on : ubuntu-latest
224-
225215 if : (github.event_name == 'push')
226-
227216 steps :
228217 - name : Git Config
229218 shell : bash
0 commit comments