Skip to content

Commit

Permalink
ci: add SDK (extracted) sources to separate SDK cache
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kwvg committed Feb 18, 2025
1 parent 9841155 commit 56d8a8e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/build-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ jobs:
restore-keys: |
depends-sources-
- name: Cache SDKs
uses: actions/cache@v4
if: inputs.build-target == 'mac'
with:
path: |
depends/SDKs
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
restore-keys: |
depends-sdks-
- name: Restore cached depends
uses: actions/cache/restore@v4
id: restore
Expand All @@ -66,7 +76,12 @@ jobs:
depends-${{ hashFiles('contrib/containers/ci/Dockerfile') }}-${{ inputs.build-target }}-
- name: Build depends
run: env ${{ steps.setup.outputs.DEP_OPTS }} HOST=${{ steps.setup.outputs.HOST }} make -j$(nproc) -C depends
run: |
export HOST="${{ steps.setup.outputs.HOST }}"
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
./contrib/containers/guix/scripts/setup-sdk
fi
env ${{ steps.setup.outputs.DEP_OPTS }} make -j$(nproc) -C depends
- name: Save depends cache
uses: actions/cache/save@v4
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ jobs:
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
shell: bash

- name: Restore SDKs cache
uses: actions/cache/restore@v4
if: inputs.build-target == 'mac'
with:
path: |
depends/SDKs
key: depends-sdks-${{ hashFiles('depends/hosts/darwin.mk') }}
fail-on-cache-miss: true

- name: Restore depends cache
uses: actions/cache/restore@v4
with:
Expand Down

0 comments on commit 56d8a8e

Please sign in to comment.