Skip to content

Commit cbdb846

Browse files
authored
ci(github-actions): implement ccache, Vulkan SDK, and Flatpak runtime caching (#174)
1 parent 63ff809 commit cbdb846

2 files changed

Lines changed: 47 additions & 11 deletions

File tree

.github/workflows/build-macos.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
xcode-select -p || (echo "❌ Xcode command-line tools not installed"; exit 1)
7575
7676
# Build tools
77-
brew install cmake ninja meson pkg-config
77+
brew install cmake ninja meson pkg-config ccache
7878
7979
# Autotools (required by vcpkg when building packages like gperf from source)
8080
brew install autoconf autoconf-archive automake libtool
@@ -121,7 +121,15 @@ jobs:
121121
122122
echo "Build tools installed"
123123
124+
- name: Cache Vulkan SDK
125+
id: cache-vulkan
126+
uses: actions/cache@v5
127+
with:
128+
path: ~/VulkanSDK
129+
key: vulkan-sdk-macos-1.4.341.1
130+
124131
- name: Install Vulkan SDK
132+
if: steps.cache-vulkan.outputs.cache-hit != 'true'
125133
run: |
126134
echo "Installing Vulkan SDK (required for DXVK + MoltenVK)..."
127135
@@ -263,24 +271,35 @@ jobs:
263271
fi
264272
fi
265273
fi
274+
275+
- name: Set Vulkan SDK Environment Variable
276+
run: |
277+
VULKAN_SDK=""
278+
279+
# 1. Try LunarG installer location
280+
if [ -d "$HOME/VulkanSDK/1.4.341.1/macOS" ]; then
281+
VULKAN_SDK="$HOME/VulkanSDK/1.4.341.1/macOS"
282+
fi
266283
267-
# Set environment variables for downstream steps
284+
# 2. Try generic search in ~/VulkanSDK
268285
if [ -z "$VULKAN_SDK" ] || [ ! -d "$VULKAN_SDK" ]; then
269-
# Last resort: search for any installed SDK, prefer macOS subdir
270286
for candidate in $(find $HOME/VulkanSDK -maxdepth 2 -type d -name "macOS" 2>/dev/null); do
271287
VULKAN_SDK="$candidate"
272288
break
273289
done
274290
fi
275-
276-
# Normalize: if VULKAN_SDK points to version root (has macOS subdir), use macOS subdir
277-
if [ -d "$VULKAN_SDK/macOS" ] && [ -f "$VULKAN_SDK/macOS/lib/libvulkan.dylib" ]; then
278-
VULKAN_SDK="$VULKAN_SDK/macOS"
279-
echo "Normalized VULKAN_SDK to platform subdirectory"
291+
292+
# 3. Try Homebrew fallback path
293+
if [ -z "$VULKAN_SDK" ] || [ ! -d "$VULKAN_SDK" ]; then
294+
VULKAN_SDK="$(brew --prefix vulkan-sdk 2>/dev/null)/macOS"
295+
if [ ! -d "$VULKAN_SDK" ]; then
296+
VULKAN_SDK="/usr/local/Caskroom/vulkan-sdk/latest/VulkanSDK"
297+
fi
280298
fi
281299
300+
# 4. Fallback default
282301
if [ -z "$VULKAN_SDK" ] || [ ! -d "$VULKAN_SDK" ]; then
283-
echo "⚠️ Vulkan SDK not found in standard locations; using default path (system Vulkan may be used)"
302+
echo "⚠️ Vulkan SDK not found in standard locations; using default path"
284303
VULKAN_SDK="$HOME/VulkanSDK"
285304
fi
286305
@@ -293,16 +312,26 @@ jobs:
293312
else
294313
echo "⚠️ MoltenVK not found at $VULKAN_SDK/lib/libMoltenVK.dylib"
295314
echo "Checking for alternate locations..."
296-
find "$(dirname $VULKAN_SDK)" -name "libMoltenVK*" 2>/dev/null | head -5 || echo "(none found)"
315+
find "$(dirname $VULKAN_SDK 2>/dev/null || echo $HOME)" -name "libMoltenVK*" 2>/dev/null | head -5 || echo "(none found)"
297316
fi
298317
318+
- name: Cache ccache
319+
uses: actions/cache@v5
320+
with:
321+
path: ~/Library/Caches/ccache
322+
key: ccache-macos-${{ matrix.game.id }}-${{ inputs.preset }}-${{ github.sha }}
323+
restore-keys: |
324+
ccache-macos-${{ matrix.game.id }}-${{ inputs.preset }}-
325+
299326
- name: Configure CMake (macOS)
300327
env:
301328
VULKAN_SDK: ${{ env.VULKAN_SDK }}
302329
VCPKG_ROOT: ${{ env.VCPKG_ROOT }}
303330
VCPKG_DEFAULT_TRIPLET: arm64-osx
304331
CC: clang
305332
CXX: clang++
333+
CMAKE_C_COMPILER_LAUNCHER: ccache
334+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
306335
run: |
307336
mkdir -p logs
308337
echo "VULKAN_SDK=$VULKAN_SDK"

.github/workflows/replay-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,19 @@ jobs:
5656
# lavapipe: software Vulkan renderer (no GPU required in CI)
5757
sudo apt-get install -y -qq p7zip-full mesa-vulkan-drivers libvulkan1
5858
59+
- name: Cache Flatpak Runtime
60+
if: inputs.platform == 'linux-flatpak'
61+
uses: actions/cache@v5
62+
with:
63+
path: ~/.local/share/flatpak/runtime
64+
key: flatpak-runtime-25.08-v1
65+
5966
- name: Install system dependencies (Linux Flatpak)
6067
if: inputs.platform == 'linux-flatpak'
6168
run: |
6269
sudo apt-get update -qq
6370
sudo apt-get install -y -qq p7zip-full flatpak
64-
71+
6572
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
6673
flatpak --user install -y flathub org.freedesktop.Platform//25.08
6774

0 commit comments

Comments
 (0)