mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 18:13:55 -07:00
build: use vcpkg for most dependencies on macos (#6170)
* build: use vcpkg for most dependencies on macos * factor out common params * refactor: factor out common parameters in macOS matrix * use env vars instead of matrix * add comment about jianmingyong/ccache-action * Remove unused 'qt_tools' param * Use system python * Let ccache caches be handled by ccache-action * Add comment about why we use install-qt-action * set unique ccache key * nit * fix cache prefix * pass gh-token * Revert "pass gh-token" This reverts commitcadfa253c6. * Reapply "pass gh-token" This reverts commitbd15e96e18. * do not cache qt on macos
This commit is contained in:
parent
d31b044529
commit
5fa06746f1
2 changed files with 35 additions and 29 deletions
60
.github/workflows/desktop-build.yml
vendored
60
.github/workflows/desktop-build.yml
vendored
|
|
@ -262,6 +262,11 @@ jobs:
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
||||||
env:
|
env:
|
||||||
|
# Common parameters for all macOS builds
|
||||||
|
QT_VERSION: 6.6.*
|
||||||
|
QT_ARCH: clang_64
|
||||||
|
QT_MODULES: "qtimageformats qtmultimedia qtwebsockets"
|
||||||
|
# Build-specific environment variables
|
||||||
CCACHE_DIR: ${{github.workspace}}/.ccache/${{matrix.os}}-${{matrix.type}}
|
CCACHE_DIR: ${{github.workspace}}/.ccache/${{matrix.os}}-${{matrix.type}}
|
||||||
CCACHE_SIZE: 500M
|
CCACHE_SIZE: 500M
|
||||||
DEVELOPER_DIR:
|
DEVELOPER_DIR:
|
||||||
|
|
@ -271,26 +276,33 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Install dependencies using Homebrew
|
|
||||||
shell: bash
|
|
||||||
# CMake cannot find the MySQL connector
|
|
||||||
# Neither of these works: mariadb-connector-c mysql-connector-c++
|
|
||||||
env:
|
|
||||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
|
||||||
run: |
|
|
||||||
brew update
|
|
||||||
brew install ccache protobuf qt --force-bottle
|
|
||||||
|
|
||||||
- name: Restore compiler cache (ccache)
|
|
||||||
id: ccache_restore
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
env:
|
|
||||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
||||||
with:
|
with:
|
||||||
path: ${{env.CCACHE_DIR}}
|
submodules: recursive
|
||||||
key: ccache-${{matrix.os}}-${{matrix.type}}-${{env.BRANCH_NAME}}
|
|
||||||
restore-keys: ccache-${{matrix.os}}-${{matrix.type}}-
|
# Using jianmingyong/ccache-action to setup ccache without using brew
|
||||||
|
# It tries to download a binary of ccache from GitHub Release and falls back to building from source if it fails
|
||||||
|
- name: Setup ccache
|
||||||
|
uses: jianmingyong/ccache-action@v1
|
||||||
|
with:
|
||||||
|
install-type: "binary"
|
||||||
|
ccache-key-prefix: ccache-${{matrix.os}}-${{matrix.soc}}-${{matrix.type}}
|
||||||
|
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Using jurplel/install-qt-action to install Qt without using brew
|
||||||
|
# qt build using vcpkg either just fails or takes too long to build
|
||||||
|
- name: Install Qt ${{env.QT_VERSION}}
|
||||||
|
uses: jurplel/install-qt-action@v4
|
||||||
|
with:
|
||||||
|
cache: false # qt caches take too much space for macOS (1.1Gi)
|
||||||
|
version: ${{env.QT_VERSION}}
|
||||||
|
arch: ${{env.QT_ARCH}}
|
||||||
|
modules: ${{env.QT_MODULES}}
|
||||||
|
|
||||||
|
- name: Setup vcpkg cache
|
||||||
|
id: vcpkg-cache
|
||||||
|
uses: TAServers/vcpkg-cache@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build on Xcode ${{matrix.xcode}}
|
- name: Build on Xcode ${{matrix.xcode}}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -304,15 +316,10 @@ jobs:
|
||||||
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
|
||||||
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
|
||||||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
||||||
|
VCPKG_DISABLE_METRICS: 1
|
||||||
|
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
||||||
run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE"
|
run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE"
|
||||||
|
|
||||||
- name: Save compiler cache (ccache)
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: ${{env.CCACHE_DIR}}
|
|
||||||
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
|
||||||
|
|
||||||
- name: Sign app bundle
|
- name: Sign app bundle
|
||||||
if: matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
if: matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
||||||
env:
|
env:
|
||||||
|
|
@ -431,7 +438,6 @@ jobs:
|
||||||
setup-python: true
|
setup-python: true
|
||||||
version: ${{matrix.qt_version}}
|
version: ${{matrix.qt_version}}
|
||||||
arch: win64_${{matrix.qt_arch}}
|
arch: win64_${{matrix.qt_arch}}
|
||||||
tools: ${{matrix.qt_tools}}
|
|
||||||
modules: ${{matrix.qt_modules}}
|
modules: ${{matrix.qt_modules}}
|
||||||
|
|
||||||
- name: Setup vcpkg cache
|
- name: Setup vcpkg cache
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ if(USE_CCACHE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 OR APPLE)
|
||||||
# Use vcpkg toolchain on Windows
|
# Use vcpkg toolchain on Windows and macOS
|
||||||
set(CMAKE_TOOLCHAIN_FILE
|
set(CMAKE_TOOLCHAIN_FILE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||||
CACHE STRING "Vcpkg toolchain file"
|
CACHE STRING "Vcpkg toolchain file"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue