Allow to use as a CMake included project (#100) #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- "**" | |
paths-ignore: | |
- ".gitignore" | |
- "README.md" | |
# ignore CI for other platforms | |
- ".github/FUNDING.yml" | |
- ".github/actions/**" | |
- ".github/workflows/Android.yml" | |
- ".github/workflows/iOS.yml" | |
- ".github/workflows/Linux.yml" | |
- ".github/workflows/Windows.yml" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- ".gitignore" | |
- "README.md" | |
# ignore CI for other platforms | |
- ".github/FUNDING.yml" | |
- ".github/actions/**" | |
- ".github/workflows/Android.yml" | |
- ".github/workflows/iOS.yml" | |
- ".github/workflows/Linux.yml" | |
- ".github/workflows/Windows.yml" | |
concurrency: | |
# cancel jobs on PRs only | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
build-and-test: | |
name: Build QMapLibre for macOS (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) | |
runs-on: macos-13 | |
strategy: | |
matrix: | |
include: | |
- qt_series: 5 | |
qt_version: 5.15.2 | |
qt_modules: "" | |
compiler: default | |
deployment_target: 10.13 | |
deployment_arch: x86_64 | |
- qt_series: 6 | |
qt_version: 6.5.3 | |
qt_modules: qtlocation qtpositioning | |
compiler: default | |
deployment_target: 11.0 | |
deployment_arch: x86_64 | |
- qt_series: 6 | |
qt_version: 6.6.1 | |
qt_modules: qtlocation qtpositioning | |
compiler: default | |
deployment_target: 11.0 | |
deployment_arch: x86_64;arm64 | |
- qt_series: 6 | |
qt_version: 6.6.1 | |
qt_modules: qtlocation qtpositioning | |
compiler: llvm@17 | |
deployment_target: 11.0 | |
deployment_arch: x86_64 | |
env: | |
COMPILER: ${{ matrix.compiler }} | |
DEPLOYMENT_TARGET: ${{ matrix.deployment_target }} | |
DEPLOYMENT_ARCH: ${{ matrix.deployment_arch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: source | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Setup Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Setup compiler (macOS) | |
if: matrix.compiler != 'default' | |
run: | | |
brew install --overwrite [email protected] | |
brew install "$COMPILER" | |
echo "/usr/local/opt/${COMPILER}/bin" >> "$GITHUB_PATH" | |
{ | |
echo "CC=/usr/local/opt/${COMPILER}/bin/clang" | |
echo "CXX=/usr/local/opt/${COMPILER}/bin/clang++" | |
echo "LDFLAGS=\"-L/usr/local/opt/${COMPILER}/lib\"" | |
echo "CPPFLAGS=\"-I/usr/local/opt/${COMPILER}/include\"" | |
} >> "$GITHUB_ENV" | |
- name: Download Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: ==3.1.* | |
version: ${{ matrix.qt_version }} | |
target: desktop | |
modules: ${{ matrix.qt_modules }} | |
- name: Setup ninja | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: Set up ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: macOS_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }} | |
max-size: 200M | |
- name: Build QMapLibre (Qt5) | |
if: matrix.qt_series == 5 | |
run: | | |
mkdir build && cd build | |
cmake ../source/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_INSTALL_PREFIX="../install" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" | |
ninja | |
ninja test | |
ninja install | |
- name: Build QMapLibre (Qt 6) | |
if: matrix.qt_series == 6 | |
env: | |
MLN_QT_WITH_CLANG_TIDY: ${{ matrix.compiler != 'default' }} | |
run: | | |
mkdir build && cd build | |
qt-cmake ../source/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_INSTALL_PREFIX="../install" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ | |
-DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ | |
-DMLN_QT_WITH_CLANG_TIDY="${MLN_QT_WITH_CLANG_TIDY}" | |
ninja | |
ninja test | |
ninja install | |
- name: Build QtQuick Example (Qt 6) | |
if: matrix.qt_series == 6 | |
run: | | |
export PREFIX_PATH="$(pwd)/install" | |
mkdir build-example-quick && cd build-example-quick | |
qt-cmake ../source/examples/quick/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_INSTALL_PREFIX="../install-example-quick" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ | |
-DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ | |
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" | |
ninja | |
ninja install | |
- name: Build QtWidgets Example (Qt 6) | |
if: matrix.qt_series == 6 | |
run: | | |
export PREFIX_PATH="$(pwd)/install" | |
mkdir build-example-widgets && cd build-example-widgets | |
qt-cmake ../source/examples/widgets/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ | |
-DCMAKE_INSTALL_PREFIX="../install-example-widgets" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \ | |
-DCMAKE_OSX_ARCHITECTURES="${DEPLOYMENT_ARCH}" \ | |
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" | |
ninja | |
ninja install | |
- name: Compress installation | |
if: matrix.compiler == 'default' | |
run: | | |
pushd install | |
tar cjvf ../QMapLibre_macOS.tar.bz2 * | |
popd | |
- name: Compress examples | |
if: matrix.qt_series == 6 && matrix.compiler == 'default' | |
run: | | |
mkdir examples && pushd examples | |
cp -a ../install-example-quick/QMapLibreExampleQuick.app . | |
cp -a ../install-example-widgets/QMapLibreExampleWidgets.app . | |
tar cjvf ../QMapLibre_macOS_examples.tar.bz2 * | |
popd | |
- name: Upload installation | |
if: matrix.compiler == 'default' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QMapLibre_macOS_${{ matrix.qt_version }} | |
path: QMapLibre_macOS.tar.bz2 | |
- name: Upload examples | |
if: matrix.qt_series == 6 && matrix.compiler == 'default' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QMapLibre_macOS_${{ matrix.qt_version }}_examples | |
path: QMapLibre_macOS_examples.tar.bz2 | |
release: | |
name: Release QMapLibre | |
if: github.ref_type == 'tag' | |
runs-on: macos-13 | |
needs: build-and-test | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
qt_version: [5.15.2, 6.5.3, 6.6.1] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: QMapLibre_macOS_${{ matrix.qt_version }} | |
- name: Make tarball | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
QT_VERSION: ${{ matrix.qt_version }} | |
run: | | |
mv QMapLibre_macOS.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_macOS.tar.bz2 | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_macOS.tar.bz2 | |
allowUpdates: true | |
draft: true |