Update Qt CI for desktop platforms (#468)

This commit is contained in:
Tadej Novak
2022-09-11 21:47:12 +02:00
committed by GitHub
parent e147b11fdf
commit 3cca1b255f
11 changed files with 90 additions and 101 deletions

View File

@@ -1,4 +1,4 @@
FROM ghcr.io/maplibre/linux-builder:centos7
FROM ghcr.io/maplibre/linux-builder:centos7-cmake3.10
# Copy and set the entry point
COPY entrypoint.sh /entrypoint.sh

View File

@@ -11,9 +11,11 @@ export PATH="$Qt5_Dir/bin:$PATH"
mkdir build && cd build
cmake ../source/ \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON \
-DCMAKE_INSTALL_PREFIX="../install/"
-DMBGL_QT_LIBRARY_ONLY=ON
ninja
ninja install

5
.github/actions/qt6-build/Dockerfile vendored Normal file
View File

@@ -0,0 +1,5 @@
FROM ghcr.io/maplibre/linux-builder:centos8-latest
# Copy and set the entry point
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

6
.github/actions/qt6-build/action.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
# action.yml
name: 'Qt6 Linux Builder'
description: 'Helper action to build in a specific Docker container'
runs:
using: 'docker'
image: 'Dockerfile'

19
.github/actions/qt6-build/entrypoint.sh vendored Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -l
set -e
set -x
export CCACHE_DIR="$GITHUB_WORKSPACE/.ccache"
export PATH="$Qt6_DIR/bin:$PATH"
mkdir build && cd build
qt-cmake ../source/ \
-G Ninja \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_INSTALL_PREFIX=../install \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_LIBRARY_ONLY=ON
ninja
ninja install

View File

@@ -16,6 +16,7 @@ on:
- "platform/qt/**"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/android-ci.yml"
- ".github/workflows/android-docker-base.yml"
- ".github/workflows/android-docker-ndk-r21b.yml"

View File

@@ -17,6 +17,7 @@ on:
- "platform/qt/**"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/android-ci-pull.yml"
- ".github/workflows/android-docker-base.yml"
- ".github/workflows/android-docker-ndk-r21b.yml"

View File

@@ -17,6 +17,7 @@ on:
- "platform/qt/**"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/android-ci.yml"
- ".github/workflows/android-ci-pull.yml"
- ".github/workflows/android-docker-base.yml"

View File

@@ -18,6 +18,7 @@ on:
- "platform/qt/**"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/android-ci.yml"
- ".github/workflows/android-ci-pull.yml"
- ".github/workflows/android-docker-base.yml"

View File

@@ -17,6 +17,7 @@ on:
- "platform/qt/**"
# ignore CI for other platforms
- ".github/FUNDING.yml"
- ".github/actions/**"
- ".github/workflows/android-ci.yml"
- ".github/workflows/android-ci-pull.yml"
- ".github/workflows/android-docker-base.yml"

View File

@@ -3,8 +3,10 @@ name: qt-ci
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
branches:
- main
tags:
- 'qt-**'
paths-ignore:
- ".gitignore"
- "README.md"
@@ -28,10 +30,9 @@ on:
- ".github/workflows/macos-ci.yml"
- ".github/workflows/macos-release.yml"
- ".github/workflows/node-ci.yml"
- ".github/workflows/node-release.yml"
- ".github/workflows/qt-ci-windows.yml"
- ".github/workflows/update-gl-js.yml"
branches:
- main
pull_request:
branches:
@@ -59,6 +60,7 @@ on:
- ".github/workflows/macos-ci.yml"
- ".github/workflows/macos-release.yml"
- ".github/workflows/node-ci.yml"
- ".github/workflows/node-release.yml"
- ".github/workflows/qt-ci-windows.yml"
- ".github/workflows/update-gl-js.yml"
@@ -73,40 +75,35 @@ jobs:
matrix:
include:
- name: Linux
os: ubuntu-latest
static: OFF
qt: 5.15.2
os: ubuntu-22.04
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
- name: Linux
os: ubuntu-22.04
build_type: RelWithDebInfo
qt_version: 6.3.1
qt_target: desktop
- name: macOS
os: macos-latest
static: OFF
qt: 5.15.2
os: macos-12
build_type: RelWithDebInfo
qt_version: 5.15.2
qt_target: desktop
- name: macOS_static
os: macos-latest
static: ON
qt: 5.15.2
qt_target: desktop
- name: iOS_static
os: macos-latest
static: ON
qt: 5.15.2
qt_target: ios
deployment_target: 10.13
deployment_arch: "x86_64"
- name: macOS
os: macos-latest
static: ON
qt: 6.2.2
qt_target: desktop
- name: macOS_static
os: macos-latest
static: OFF
qt: 6.2.2
os: macos-12
build_type: RelWithDebInfo
qt_version: 6.3.1
qt_target: desktop
deployment_target: 10.14
deployment_arch: "x86_64;arm64"
runs-on: ${{ matrix.os }}
env:
BUILD_TYPE: RelWithDebInfo
BUILD_MODE: ${{ matrix.static }}
QT_VERSION: ${{ matrix.qt }}
BUILD_TYPE: ${{ matrix.build_type }}
DEPLOYMENT_TARGET: ${{ matrix.deployment_target }}
DEPLOYMENT_ARCH: ${{ matrix.deployment_arch }}
QT_VERSION: ${{ matrix.qt_version }}
steps:
- name: Checkout
@@ -116,16 +113,6 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Install macOS dependencies
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew list cmake || brew install cmake
brew list ccache || brew install ccache
brew list ninja || brew install ninja
- name: Setup Xcode
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
@@ -133,36 +120,20 @@ jobs:
xcode-version: latest-stable
- name: Download Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
aqtversion: ==2.1.*
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}
target: ${{ matrix.qt_target }}
- name: Prepare ccache
if: runner.os == 'macOS'
run: |
ccache --clear
ccache --set-config cache_dir=~/.ccache
- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Cache ccache
uses: actions/cache@v3
env:
cache-name: ccache-v1
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.name }}-${{ matrix.qt }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.name }}-${{ matrix.qt }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.name }}-${{ matrix.qt }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.name }}-${{ matrix.qt }}-${{ github.job }}
- name: Clear ccache statistics
if: runner.os == 'macOS'
run: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats -v
key: ${{ matrix.name }}
- name: Build maplibre-gl-native (macOS)
if: runner.os == 'macOS' && matrix.qt_target == 'desktop'
@@ -170,46 +141,27 @@ jobs:
mkdir build && cd build
cmake ../source/ \
-G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-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}" \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_STATIC=${BUILD_MODE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DMBGL_QT_LIBRARY_ONLY=ON
ninja
ninja install
- name: Build maplibre-gl-native (iOS)
if: runner.os == 'macOS' && matrix.qt_target == 'ios'
run: |
mkdir build && cd build
cmake ../source/ \
-G"Ninja Multi-Config" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
-DMBGL_WITH_QT=ON \
-DMBGL_QT_STATIC=${BUILD_MODE} \
-DMBGL_QT_LIBRARY_ONLY=ON \
-DMBGL_QT_WITH_IOS_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_FIND_ROOT_PATH="$Qt5_Dir" \
-DCMAKE_PREFIX_PATH="$Qt5_Dir"
cmake --build . --config Release
cmake --install . --config Release
- name: Build maplibre-gl-native (Linux)
if: runner.os == 'Linux'
- name: Build maplibre-gl-native (Linux, Qt5)
if: runner.os == 'Linux' && matrix.qt_version == '5.15.2'
uses: ./source/.github/actions/qt5-build
- name: Build maplibre-gl-native (Linux, Qt6)
if: runner.os == 'Linux' && matrix.qt_version != '5.15.2'
uses: ./source/.github/actions/qt6-build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: maplibre-gl-native_${{ matrix.name }}_Qt${{ matrix.qt }}
name: maplibre-gl-native_${{ matrix.name }}_Qt${{ matrix.qt_version }}
path: install
- name: Show ccache statistics
if: runner.os == 'macOS'
run: |
ccache --show-stats -v