Skip to content

Commit e85e6bc

Browse files
committed
perf(ci): reuse macos swift build outputs
1 parent 40c30d0 commit e85e6bc

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,15 @@ jobs:
17321732
- name: Install XcodeGen / SwiftLint / SwiftFormat
17331733
run: brew install xcodegen swiftlint swiftformat
17341734

1735+
- name: Detect Swift toolchain cache key
1736+
id: swift-toolchain
1737+
run: |
1738+
set -euo pipefail
1739+
xcode_version="$(xcodebuild -version | tr '\n' ' ' | sed 's/ */ /g; s/ $//')"
1740+
swift_version="$(swift --version | head -n 1)"
1741+
toolchain_key="$(printf '%s\n%s\n' "$xcode_version" "$swift_version" | shasum -a 256 | awk '{print $1}')"
1742+
echo "key=$toolchain_key" >> "$GITHUB_OUTPUT"
1743+
17351744
- name: Cache SwiftPM
17361745
uses: actions/cache@v5
17371746
with:
@@ -1740,10 +1749,24 @@ jobs:
17401749
restore-keys: |
17411750
${{ runner.os }}-swiftpm-
17421751
1752+
- name: Cache Swift build directory
1753+
uses: actions/cache@v5
1754+
with:
1755+
path: apps/macos/.build
1756+
key: ${{ runner.os }}-swift-build-v1-${{ steps.swift-toolchain.outputs.key }}-${{ hashFiles('apps/macos/Package.swift', 'apps/macos/Package.resolved', 'apps/shared/OpenClawKit/Package.swift', 'Swabble/Package.swift') }}
1757+
restore-keys: |
1758+
${{ runner.os }}-swift-build-v1-${{ steps.swift-toolchain.outputs.key }}-
1759+
17431760
- name: Patch mlx-audio-swift manifest
17441761
run: |
17451762
set -euo pipefail
1746-
swift package resolve --package-path apps/macos >/dev/null
1763+
if [ ! -f apps/macos/.build/checkouts/mlx-audio-swift/Package.swift ]; then
1764+
swift package resolve --package-path apps/macos >/dev/null
1765+
fi
1766+
if [ ! -f apps/macos/.build/checkouts/mlx-audio-swift/Package.swift ]; then
1767+
echo "mlx-audio-swift checkout missing after swift package resolve" >&2
1768+
exit 1
1769+
fi
17471770
chmod u+w apps/macos/.build/checkouts/mlx-audio-swift/Package.swift
17481771
python <<'PY'
17491772
from pathlib import Path
@@ -1779,7 +1802,10 @@ jobs:
17791802
run: |
17801803
set -euo pipefail
17811804
for attempt in 1 2 3; do
1782-
if swift build --package-path apps/macos --configuration release; then
1805+
# The macOS lane validates the desktop app build; the CLI product is
1806+
# intentionally left to its own narrower surfaces instead of making
1807+
# this lane rebuild the whole package graph.
1808+
if swift build --package-path apps/macos --product OpenClaw --configuration release; then
17831809
exit 0
17841810
fi
17851811
echo "swift build failed (attempt $attempt/3). Retrying…"

0 commit comments

Comments
 (0)