Skip to content

🍎 Mac Qt6 .dmg

🍎 Mac Qt6 .dmg #59

---
name: 🍎 Build - MacOS Qt6
on:
push:
branches:
- master
- release-*
pull_request:
release:
types: ['published']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
include:
- os: macos-13
triplet: x64-osx-dynamic-release
deployment-target: "10.15"
- os: macos-14
triplet: arm64-osx-dynamic-release
deployment-target: "11.0"
name: build (macos)
runs-on: ${{ matrix.os }}
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
- name: 🐩 Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
# Pin to specific version to avoid rebuilding too often
# Also helps to avoid spurious build failures like https://github.com/qgis/QGIS/pull/47098
cmakeVersion: 3.30.4
- name: 🎡 Setup vcpkg
id: setup-vcpkg
uses: ./.github/actions/setup-vcpkg
- name: 🎲 Get artifact ids
id: workflow-artifact-ids
uses: ./.github/actions/get-workflow-artifact-ids
- name: 🔨 Prepare build env
run: |
brew install automake bison flex gnu-sed autoconf-archive nasm libtool fdupes
echo $(brew --prefix bison)/bin >> $GITHUB_PATH
echo $(brew --prefix flex)/bin >> $GITHUB_PATH
echo $(brew --prefix libtool)/bin >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 🍭 Setup XCode
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable
- name: 🛍️ Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
max-size: 500M
key: build-ccache-win64-qt6-${{ github.event.pull_request.base.ref || github.ref_name }}
# save: ${{ github.event_name == 'push' }}
- name: 🛍️ Tune ccache configuration
shell: bash
run: |
# To make ccache work properly with precompiled headers
ccache --set-config sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime
- name: 🌱 Install dependencies and generate project files
run: |
echo "VCPKG_ROOT: ${VCPKG_ROOT}"
# Install first only with binarycaching, then deduplicate binaries and replace copies with symlinks.
# Nuget doesn't understand the symlink concept
cmake -S . \
-G Ninja \
-B build \
-D QGIS_APP_NAME="QGIS-${{steps.workflow-artifact-ids.outputs.display-name}}" \
-D WITH_VCPKG=ON \
-D BUILD_WITH_QT6=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_BINDINGS=ON \
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
-D VCPKG_HOST_TRIPLET="${{ matrix.triplet }}" \
-D VCPKG_INSTALL_OPTIONS="--only-binarycaching" \
-D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.deployment-target }} \
-D ENABLE_UNITY_BUILDS=ON \
-D NUGET_USERNAME=${{ github.actor }} \
-D NUGET_SOURCE="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} || true
fdupes -q -r -1 build/vcpkg_installed/${{ matrix.triplet }}/lib | grep libQt | while read line; do master=""; for file in ${line[*]}; do if [[ "x${master}" == "x" ]]; then master=$file; else rm "${file}"; ln -s $(basename "${master}") "${file}"; fi; done; done
cmake -D VCPKG_INSTALL_OPTIONS="" build
- name: 📑 Upload vcpkg build logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-${{ matrix.triplet }}
path: |
${{ env.VCPKG_ROOT }}/buildtrees/**/*.log
- name: 📦 Create SDK
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
run: |
./build/_deps/vcpkg-src/vcpkg export --zip --output-dir=./sdk --x-install-root=./build/vcpkg_installed --x-manifest-root=vcpkg
- name: 📤 Upload sdk
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: qgis-sdk-${{ matrix.triplet }}
path: |
sdk/vcpkg-export-*.zip
- name: 🌋 Build
run: |
# We make sure the target "all" is built before bundling
# Ideally, we would specify each target that is required to be installed, but this workaround is sufficient for now
cmake --build build
cmake --build build --target bundle
- name: Archive app
run: |
gtar -cpvzf qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}.tar.gz ./build/_CPack_Packages/Darwin/External/*/*.app
- name: 📤 Upload app
uses: actions/upload-artifact@v4
with:
name: qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}
path: |
qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-${{ matrix.triplet }}.tar.gz
schedule_download_comment:
name: Create dmg
runs-on: macos-latest
needs: build
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
- name: 🔨 Prepare build env
run: |
brew install create-dmg
- name: 🎲 Get artifact ids
id: workflow-artifact-ids
uses: ./.github/actions/get-workflow-artifact-ids
- name: 📤 Download app
uses: actions/download-artifact@v4
with:
pattern: qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-*
path: |
artifacts
- name: Create universal app
run: |
mkdir -p x64
gtar --strip-components=5 -zxf ./artifacts/qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-x64-osx-dynamic-release/qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-x64-osx-dynamic-release.tar.gz -C x64
mkdir -p arm64
gtar --strip-components=5 -zxf ./artifacts/qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-arm64-osx-dynamic-release/qgis-app-${{steps.workflow-artifact-ids.outputs.display-name}}-arm64-osx-dynamic-release.tar.gz -C arm64
wget https://raw.githubusercontent.com/m-kuhn/lipo-dir-merge/refs/heads/main/lipo-dir-merge.py
python lipo-dir-merge.py x64 arm64 universal
- name: Create dmg
run: |
QGIS_APP_NAME=QGIS-"${{steps.workflow-artifact-ids.outputs.display-name}}"
create-dmg --volname "${QGIS_APP_NAME} Installer" \
--hide-extension ${QGIS_APP_NAME}.app \
--volicon "$(pwd)/images/icons/mac/qgis.icns" \
--background "$(pwd)/platform/macos/installer_background.png" \
--window-pos 200 120 \
--window-size 512 320 \
--icon-size 100 \
--icon "${QGIS_APP_NAME}.app" 130 160 \
--app-drop-link 400 155 \
${QGIS_APP_NAME}-Installer.dmg \
universal/*/*.app
- name: 📤 Upload app
uses: actions/upload-artifact@v4
id: artifact-mac-qt6
with:
name: qgis-${{steps.workflow-artifact-ids.outputs.display-name}}-dmg
path: |
*.dmg
- name: Upload release assets
uses: AButler/upload-release-assets@v3.0
if: ${{ github.event_name == 'release' }}
with:
files: '*.dmg'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Schedule download comment
uses: ./.github/actions/post_sticky_comment
if: github.event_name == 'pull_request'
with:
marker: macos-qt6
body: |
### 🍎 MacOS Qt6 builds
Download [MacOS Qt6 builds of this PR for testing](${{ steps.artifact-mac-qt6.outputs.artifact-url }}).
_This installer is not signed, `control`+click > `open` the app to avoid the warning_
*(Built from commit ${{ github.event.pull_request.head.sha }})*
pr: ${{ github.event.number }}