Skip to content

Commit 6225b7f

Browse files
committed
Check OS environment as well as bext SHA1
A bext build may be invalidated by more than just a change in the upstream sources - it may also need to be rebuilt if the operating system or compiler changes. Make a stab at incorporating that information into the cache process.
1 parent 7a64606 commit 6225b7f

File tree

4 files changed

+84
-12
lines changed

4 files changed

+84
-12
lines changed

.github/workflows/distcheck.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,19 @@ jobs:
5454
cd bext
5555
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
5656
57+
- name: Compute bext cache discriminator
58+
id: cachekey
59+
shell: bash
60+
run: |
61+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
62+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
63+
5764
- name: Cache bext build outputs
5865
id: cache-bext
5966
uses: actions/cache@v4
6067
with:
6168
path: ${{ github.workspace }}/bext_output
62-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
69+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
6370

6471
- name: Build bext (if cache miss)
6572
if: steps.cache-bext.outputs.cache-hit != 'true'

.github/workflows/push.yml

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
path: |
4141
/var/cache/apt/archives
42-
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/check.yml') }}
42+
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/push.yml') }}
4343

4444
# Install system dependencies
4545
- name: Install apt dependencies
@@ -68,12 +68,19 @@ jobs:
6868
cd bext
6969
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
7070
71+
- name: Compute bext cache discriminator
72+
id: cachekey
73+
shell: bash
74+
run: |
75+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
76+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
77+
7178
- name: Cache bext build outputs
7279
id: cache-bext
7380
uses: actions/cache@v4
7481
with:
7582
path: ${{ github.workspace }}/bext_output
76-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
83+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
7784

7885
- name: Build bext (if cache miss)
7986
if: steps.cache-bext.outputs.cache-hit != 'true'
@@ -135,7 +142,7 @@ jobs:
135142
with:
136143
path: |
137144
/var/cache/apt/archives
138-
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/check.yml') }}
145+
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/push.yml') }}
139146

140147
- name: Setup - System
141148
run: |
@@ -157,12 +164,19 @@ jobs:
157164
cd bext
158165
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
159166
167+
- name: Compute bext cache discriminator
168+
id: cachekey
169+
shell: bash
170+
run: |
171+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
172+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
173+
160174
- name: Cache bext build outputs
161175
id: cache-bext
162176
uses: actions/cache@v4
163177
with:
164178
path: ${{ github.workspace }}/bext_output
165-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
179+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
166180

167181
- name: Build bext (if cache miss)
168182
if: steps.cache-bext.outputs.cache-hit != 'true'
@@ -186,7 +200,6 @@ jobs:
186200
187201
windows:
188202
name: MSVC - Ninja
189-
#needs: [linux]
190203
runs-on: windows-latest
191204
strategy:
192205
fail-fast: true
@@ -221,12 +234,23 @@ jobs:
221234
cd bext
222235
echo "sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
223236
237+
- name: Compute bext cache discriminator
238+
id: cachekey
239+
shell: bash
240+
run: |
241+
clver=""
242+
if command -v cl.exe &> /dev/null; then
243+
clver="$(cl.exe 2>&1 | head -n 1)"
244+
fi
245+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$clver"
246+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
247+
224248
- name: Cache bext build outputs
225249
id: cache-bext
226250
uses: actions/cache@v4
227251
with:
228252
path: ${{ github.workspace }}\bext_output
229-
key: windows-bext-${{ steps.bext-sha.outputs.sha }}
253+
key: windows-bext-${{ steps.cachekey.outputs.hash }}
230254

231255
- name: Build bext (if cache miss)
232256
if: steps.cache-bext.outputs.cache-hit != 'true'
@@ -313,12 +337,23 @@ jobs:
313337
cd bext
314338
echo "sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
315339
340+
- name: Compute bext cache discriminator
341+
id: cachekey
342+
shell: bash
343+
run: |
344+
clver=""
345+
if command -v cl.exe &> /dev/null; then
346+
clver="$(cl.exe 2>&1 | head -n 1)"
347+
fi
348+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$clver"
349+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
350+
316351
- name: Cache bext build outputs
317352
id: cache-bext
318353
uses: actions/cache@v4
319354
with:
320355
path: ${{ github.workspace }}\bext_output
321-
key: windows-bext-${{ steps.bext-sha.outputs.sha }}
356+
key: windows-bext-${{ steps.cachekey.outputs.hash }}
322357

323358
- name: Build bext (if cache miss)
324359
# Note - most of windows_std_tools builds using cmd and avoids ninja,
@@ -401,12 +436,21 @@ jobs:
401436
cd bext
402437
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
403438
439+
- name: Compute bext cache discriminator
440+
id: cachekey
441+
shell: bash
442+
run: |
443+
xcodever="$(xcodebuild -version | head -n 1 | awk '{print $2}')"
444+
clangver="$(clang --version | head -n 1)"
445+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$xcodever-$clangver"
446+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
447+
404448
- name: Cache bext build outputs
405449
id: cache-bext
406450
uses: actions/cache@v4
407451
with:
408452
path: ${{ github.workspace }}/bext_output
409-
key: macos-bext-${{ steps.bext-sha.outputs.sha }}
453+
key: macos-bext-${{ steps.cachekey.outputs.hash }}
410454

411455
- name: Build bext (if cache miss)
412456
if: steps.cache-bext.outputs.cache-hit != 'true'

.github/workflows/scheduled.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,19 @@ jobs:
263263
cd bext
264264
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
265265
266+
- name: Compute bext cache discriminator
267+
id: cachekey
268+
shell: bash
269+
run: |
270+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
271+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
272+
266273
- name: Cache bext build outputs
267274
id: cache-bext
268275
uses: actions/cache@v4
269276
with:
270277
path: ${{ github.workspace }}/bext_output
271-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
278+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
272279

273280
- name: Build bext (if cache miss)
274281
if: steps.cache-bext.outputs.cache-hit != 'true'
@@ -354,12 +361,19 @@ jobs:
354361
cd bext
355362
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
356363
364+
- name: Compute bext cache discriminator
365+
id: cachekey
366+
shell: bash
367+
run: |
368+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
369+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
370+
357371
- name: Cache bext build outputs
358372
id: cache-bext
359373
uses: actions/cache@v4
360374
with:
361375
path: ${{ github.workspace }}/bext_output
362-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
376+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
363377

364378
- name: Build bext (if cache miss)
365379
if: steps.cache-bext.outputs.cache-hit != 'true'

misc/CMake/distcheck_hdr.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,19 @@ jobs:
5454
cd bext
5555
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
5656
57+
- name: Compute bext cache discriminator
58+
id: cachekey
59+
shell: bash
60+
run: |
61+
info="${{ steps.bext-sha.outputs.sha }}-$(uname -s)-$(uname -r)-$(gcc --version | head -n 1)"
62+
echo "hash=$(echo -n "$info" | sha1sum | awk '{print $1}')" >> $GITHUB_OUTPUT
63+
5764
- name: Cache bext build outputs
5865
id: cache-bext
5966
uses: actions/cache@v4
6067
with:
6168
path: ${{ github.workspace }}/bext_output
62-
key: ${{ runner.os }}-bext-${{ steps.bext-sha.outputs.sha }}
69+
key: ${{ runner.os }}-bext-${{ steps.cachekey.outputs.hash }}
6370

6471
- name: Build bext (if cache miss)
6572
if: steps.cache-bext.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)