From c0103e0378955a1182c557b3c47f05d20711f782 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Tue, 23 Dec 2025 18:48:07 +0100 Subject: [PATCH] address comments --- .ci/compile.sh | 12 ++++++++++++ .ci/thin_macos_qtlib.sh | 23 +++++++++++++++++++++++ .github/workflows/desktop-build.yml | 24 ++++++------------------ 3 files changed, 41 insertions(+), 18 deletions(-) create mode 100755 .ci/thin_macos_qtlib.sh diff --git a/.ci/compile.sh b/.ci/compile.sh index a7c349fb0..5d2e18390 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -156,6 +156,18 @@ function ccachestatsverbose() { # Compile if [[ $RUNNER_OS == macOS ]]; then + # QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action, + # which sets a few environment variables + if QTDIR=$(find "$GITHUB_WORKSPACE/Qt" -depth -maxdepth 2 -name macos -type d -print -quit); then + echo "found QTDIR at $QTDIR" + else + echo "could not find QTDIR!" + exit 2 + fi + # the qtdir is located at Qt/[qtversion]/macos + # we use find to get the first subfolder with the name "macos" + # this works independent of the qt version as there should be only one version installed on the runner at a time + export QTDIR if [[ $TARGET_MACOS_VERSION ]]; then # CMAKE_OSX_DEPLOYMENT_TARGET is a vanilla cmake flag needed to compile to target macOS version diff --git a/.ci/thin_macos_qtlib.sh b/.ci/thin_macos_qtlib.sh new file mode 100755 index 000000000..c4010e069 --- /dev/null +++ b/.ci/thin_macos_qtlib.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# The macos binaries from aqt are fat (universal), so we thin them to the target architecture to reduce the size of +# the packages and caches using lipo. + +# This script is meant to be used by the ci enironment on macos runners only. +# It uses the runner's GITHUB_WORKSPACE env variable. +arch=$(uname -m) +nproc=$(sysctl -n hw.ncpu) + +function thin() { + local libfile=$0 + if file -b --mime-type "$libfile" | grep -q "application/x-mach-binary"; then + echo "Processing $libfile" + lipo "$libfile" -thin "$arch" -output "$libfile" + fi + return 0 +} +export -f thin # export to allow use in xargs + +echo "::group::Thinning Qt libraries to $arch using $nproc cores" +find "$GITHUB_WORKSPACE/Qt" -type f -print0 | xargs -0 -n1 -P"$nproc" -I{} bash -c "thin '{}'" +echo "::endgroup::" diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index b02327256..44bee4959 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -260,7 +260,7 @@ jobs: make_package: 1 package_suffix: "-macOS13_Intel" artifact_name: macOS13_Intel-package - qt_version: 6.6.3 + qt_version: 6.6.* qt_arch: clang_64 qt_modules: qtimageformats qtmultimedia qtwebsockets cmake_generator: Ninja @@ -275,7 +275,7 @@ jobs: make_package: 1 package_suffix: "-macOS14" artifact_name: macOS14-package - qt_version: 6.6.3 + qt_version: 6.6.* qt_arch: clang_64 qt_modules: qtimageformats qtmultimedia qtwebsockets cmake_generator: Ninja @@ -290,7 +290,7 @@ jobs: make_package: 1 package_suffix: "-macOS15" artifact_name: macOS15-package - qt_version: 6.6.3 + qt_version: 6.6.* qt_arch: clang_64 qt_modules: qtimageformats qtmultimedia qtwebsockets cmake_generator: Ninja @@ -302,7 +302,7 @@ jobs: soc: Apple xcode: "16.4" type: Debug - qt_version: 6.6.3 + qt_version: 6.6.* qt_arch: clang_64 qt_modules: qtimageformats qtmultimedia qtwebsockets cmake_generator: Ninja @@ -327,7 +327,7 @@ jobs: make_package: 1 package_suffix: "-Win10" artifact_name: Windows10-installer - qt_version: 6.6.3 + qt_version: 6.6.* qt_arch: win64_msvc2019_64 qt_modules: qtimageformats qtmultimedia qtwebsockets cmake_generator: "Visual Studio 17 2022" @@ -381,19 +381,9 @@ jobs: modules: ${{matrix.qt_modules}} dir: ${{github.workspace}} - # the binaries from aqt are fat (universal), so we thin them to the target architecture to reduce the size of the packages and caches - name: Thin Qt ${{matrix.qt_version}} libraries if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true' - run: | - export ARCH=$(uname -m) - export NPROC=$(sysctl -n hw.ncpu) - echo "::group::Thinning Qt libraries to $ARCH using $NPROC cores" - find ${{ github.workspace }}/Qt -type f -print0 | \ - xargs -0 -n1 -P "$NPROC" sh -c \ - 'file -b --mime-type "$0" | grep -q "application/x-mach-binary" && \ - echo "Processing $0" && \ - lipo "$0" -thin "$ARCH" -output "$0" || true' - echo "::endgroup::" + run: .ci/thin_macos_qtlib.sh - name: Cache thin Qt ${{matrix.qt_version}} libraries if: matrix.os == 'macOS' && steps.restore_qt.outputs.cache-hit != 'true' @@ -437,8 +427,6 @@ jobs: MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} DEVELOPER_DIR: '/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer' TARGET_MACOS_VERSION: ${{ matrix.override_target }} - # QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action, which sets a few environment variables - QTDIR: ${{ matrix.os == 'macOS' && format('{0}/Qt/{1}/macos', github.workspace, matrix.qt_version) || '' }} run: .ci/compile.sh --server --test --vcpkg - name: Sign app bundle