Skip to content

Commit 61f7668

Browse files
committed
ci: add SDK (extracted) sources to separate SDK cache
We cannot add it to the sources cache because we share the cache among all variants and as the caches are immutable, the first one to finish will decide the cache for all subsequent use. This will prevent the SDKs from being saved and will cause failures in the next step as it fetches the common cache, most likely saved by a Linux variant and finds no cache. Saving it in the source cache isn't a great option either because it will get frequently invalidated. Better to just give it its own cache.
1 parent bba1da9 commit 61f7668

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.github/workflows/build-depends.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ jobs:
5353
restore-keys: |
5454
depends-sources-
5555
56+
- name: Cache SDKs
57+
uses: actions/cache@v4
58+
if: inputs.build-target == 'mac'
59+
with:
60+
path: |
61+
depends/sdk-sources
62+
depends/SDKs
63+
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
64+
restore-keys: |
65+
depends-sdks-
66+
5667
- name: Restore cached depends
5768
uses: actions/cache/restore@v4
5869
id: restore
@@ -66,7 +77,12 @@ jobs:
6677
depends-${{ hashFiles('contrib/containers/ci/Dockerfile', 'depends/packages/*') }}-
6778
6879
- name: Build depends
69-
run: env ${{ steps.setup.outputs.DEP_OPTS }} HOST=${{ steps.setup.outputs.HOST }} make -j$(nproc) -C depends
80+
run: |
81+
export HOST="${{ steps.setup.outputs.HOST }}"
82+
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
83+
./contrib/containers/guix/scripts/setup-sdk
84+
fi
85+
env ${{ steps.setup.outputs.DEP_OPTS }} make -j$(nproc) -C depends
7086
7187
- name: Save depends cache
7288
uses: actions/cache/save@v4

.github/workflows/build-src.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ jobs:
4444
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
4545
shell: bash
4646

47+
- name: Restore SDKs cache
48+
uses: actions/cache/restore@v4
49+
if: inputs.build-target == 'mac'
50+
with:
51+
path: |
52+
depends/sdk-sources
53+
depends/SDKs
54+
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
55+
fail-on-cache-miss: true
56+
4757
- name: Restore depends cache
4858
uses: actions/cache/restore@v4
4959
with:

0 commit comments

Comments
 (0)