Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .github/workflows/build-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ on:
built-artifact:
description: "Artifact holding freshly built depends (empty when restored from cache)"
value: ${{ jobs.build.outputs.built-artifact }}
sdk-artifact:
description: "Artifact holding prepared SDKs (empty when restored from cache)"
value: ${{ jobs.check-cache.outputs.sdk-artifact }}

jobs:
check-cache:
Expand All @@ -43,6 +46,7 @@ jobs:
cache-key-prefix: ${{ steps.setup.outputs.cache-key-prefix }}
host: ${{ steps.setup.outputs.HOST }}
dep-opts: ${{ steps.setup.outputs.DEP_OPTS }}
sdk-artifact: ${{ steps.prepare-sdks.outputs.artifact }}
steps:
- name: Checkout code
uses: actions/checkout@v6
Expand Down Expand Up @@ -95,8 +99,25 @@ jobs:
restore-keys: depends-sdks-

- name: Prepare SDKs
id: prepare-sdks
if: inputs.build-target == 'mac' && steps.cache-sdk-check.outputs.cache-hit != 'true'
run: ./contrib/containers/guix/scripts/setup-sdk
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
./contrib/containers/guix/scripts/setup-sdk
echo "artifact=depends-sdks-${BUILD_TARGET}" >> "${GITHUB_OUTPUT}"

Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Upload prepared SDKs
# This originates in check-cache so both Build depends (when needed)
# and Build source can use it even when a PR cannot save the cache.
if: steps.prepare-sdks.outputs.artifact != ''
uses: actions/upload-artifact@v6
with:
name: ${{ steps.prepare-sdks.outputs.artifact }}
path: depends/SDKs
compression-level: 0
retention-days: 1
overwrite: true

build:
name: Build depends
Expand All @@ -122,13 +143,27 @@ jobs:
restore-keys: depends-sources-

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

- name: Download prepared SDKs
if: inputs.build-target == 'mac' && steps.sdk-cache.outputs.cache-hit != 'true' && needs.check-cache.outputs.sdk-artifact != ''
uses: actions/download-artifact@v8
with:
name: ${{ needs.check-cache.outputs.sdk-artifact }}
path: depends/SDKs

- name: Check prepared SDKs are present
if: inputs.build-target == 'mac' && steps.sdk-cache.outputs.cache-hit != 'true' && needs.check-cache.outputs.sdk-artifact == ''
run: |
echo "::error::SDK cache restore missed and no prepared SDK artifact was provided"
exit 1
shell: bash

- name: Restore cached depends
uses: actions/cache/restore@v5
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
required: false
type: string
default: ""
sdk-artifact:
description: "Artifact holding prepared SDKs, used if the cache restore misses"
required: false
type: string
default: ""
runs-on:
description: "Runner label to use (e.g., ubuntu-24.04 or ubuntu-24.04-arm)"
required: true
Expand Down Expand Up @@ -66,13 +71,27 @@ jobs:
shell: bash

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

- name: Download prepared SDKs
if: inputs.build-target == 'mac' && steps.sdk-cache.outputs.cache-hit != 'true' && inputs.sdk-artifact != ''
uses: actions/download-artifact@v8
with:
name: ${{ inputs.sdk-artifact }}
path: depends/SDKs

- name: Check prepared SDKs are present
if: inputs.build-target == 'mac' && steps.sdk-cache.outputs.cache-hit != 'true' && inputs.sdk-artifact == ''
run: |
echo "::error::SDK cache restore missed and no prepared SDK artifact was provided"
exit 1
shell: bash

- name: Restore depends cache
id: depends-cache
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ jobs:
depends-host: ${{ needs.depends-mac.outputs.host }}
depends-dep-opts: ${{ needs.depends-mac.outputs.dep-opts }}
depends-artifact: ${{ needs.depends-mac.outputs.built-artifact }}
sdk-artifact: ${{ needs.depends-mac.outputs.sdk-artifact }}
runs-on: ${{ needs.check-skip.outputs['runner-amd64'] }}

src-win64:
Expand Down
Loading