CI: Replace ccache with Xcode compile cache

This commit is contained in:
PatTheMav
2026-01-13 00:44:07 +01:00
committed by Ryan Foster
parent c10fd25aea
commit 97a498d67a
5 changed files with 32 additions and 16 deletions

View File

@@ -99,7 +99,7 @@ runs:
.github/scripts/Build-Windows.ps1 @BuildArgs
- name: Create Summary 📊
if: contains(fromJSON('["Linux", "macOS"]'), runner.os)
if: runner.os == 'Linux'
shell: zsh --no-rcs --errexit --pipefail {0}
run: |
: Create Summary 📊

View File

@@ -1,4 +1,3 @@
brew "ccache"
brew "cmake"
brew "git"
brew "jq"

View File

@@ -42,7 +42,7 @@ build() {
local project_root=${SCRIPT_HOME:A:h:h}
fpath=(${SCRIPT_HOME}/utils.zsh ${fpath})
autoload -Uz log_group log_error log_output check_${host_os} setup_ccache
autoload -Uz log_group log_error log_output check_${host_os}
local -i debug=0
@@ -98,10 +98,11 @@ build() {
set -- ${(@)args}
check_${host_os}
setup_ccache
if [[ ${host_os} == ubuntu ]] {
autoload -Uz setup_ubuntu && setup_ubuntu
autoload -Uz setup_ubuntu setup_ccache
setup_ccache
setup_ubuntu
}
local product_name='obs-studio'
@@ -116,7 +117,14 @@ build() {
case ${target} {
macos-*)
cmake_args+=(--preset 'macos-ci' -DCMAKE_OSX_ARCHITECTURES:STRING=${target##*-})
cmake_args+=(
--preset 'macos-ci'
-DCMAKE_OSX_ARCHITECTURES:STRING=${target##*-}
)
if (( debug )) {
cmake_args+=(CMAKE_XCODE_ATTRIBUTE_COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS:STRING=YES)
}
typeset -gx NSUnbufferedIO=YES

View File

@@ -80,8 +80,8 @@ jobs:
: Set Up Environment 🔧
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
print '::group::Enable Xcode 16.4'
sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
print '::group::Enable Xcode 26.1'
sudo xcode-select --switch /Applications/Xcode_26.1.app/Contents/Developer
print '::endgroup::'
print '::group::Clean Homebrew Environment'
@@ -97,13 +97,19 @@ jobs:
local -A arch_names=(x86_64 intel arm64 apple)
print "cpuName=${arch_names[${{ matrix.target }}]}" >> $GITHUB_OUTPUT
local xcode_cas_path="${HOME}/Library/Developer/Xcode/DerivedData/CompilationCache.noindex"
if ! [[ -d ${xcode_cas_path} ]] mkdir -p ${xcode_cas_path}
print "xcodeCasPath=${xcode_cas_path}" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
id: ccache-cache
id: xcode-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-${{ matrix.target }}-${{ needs.check-event.outputs.config }}
path: ${{ steps.setup.outputs.xcodeCasPath }}
key: ${{ runner.os }}-xcode-${{ matrix.target }}-${{ needs.check-event.outputs.config }}
restore-keys: |
${{ runner.os }}-ccache-${{ matrix.target }}-
${{ runner.os }}-xcode-${{ matrix.target }}-
- name: Set Up Code Signing 🔑
uses: ./.github/actions/setup-macos-codesigning
@@ -129,6 +135,7 @@ jobs:
YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
XCODE_CAS_PATH: ${{ steps.setup.outputs.xcodeCasPath }}
with:
target: ${{ matrix.target }}
config: ${{ needs.check-event.outputs.config }}
@@ -163,10 +170,10 @@ jobs:
path: ${{ github.workspace }}/build_macos/obs-studio-*-macos-${{ steps.setup.outputs.cpuName }}-dSYMs.tar.xz
- uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
if: github.event_name != 'pull_request' && steps.xcode-cache.outputs.cache-hit != 'true'
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-${{ matrix.target }}-${{ needs.check-event.outputs.config }}
path: ${{ steps.setup.outputs.xcodeCasPath }}
key: ${{ runner.os }}-xcode-${{ matrix.target }}-${{ needs.check-event.outputs.config }}
ubuntu-build:
name: Ubuntu 🐧