[pre-commit.ci] pre-commit autoupdate (#123) #63
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: Windows 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/macOS.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/macOS.yml" | |
concurrency: | |
# cancel jobs on PRs only | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
CCACHE_CONFIGPATH: C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf | |
jobs: | |
build-and-test: | |
name: Build QMapLibre for Windows (Qt${{ matrix.qt_version}}, ${{ matrix.arch }}) | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
include: | |
- qt_series: 5 | |
qt_version: 5.15.2 | |
qt_arch: win64_msvc2019_64 | |
qt_modules: "" | |
arch: msvc2019_64 | |
compiler: x64 | |
compiler_version: 14.29 | |
- qt_series: 6 | |
qt_version: 6.5.3 | |
qt_arch: win64_msvc2019_64 | |
qt_modules: qtlocation qtpositioning | |
arch: msvc2019_64 | |
compiler: x64 | |
compiler_version: 14.29 | |
- qt_series: 6 | |
qt_version: 6.6.2 | |
qt_arch: win64_msvc2019_64 | |
qt_modules: qtlocation qtpositioning | |
arch: msvc2019_64 | |
compiler: x64 | |
compiler_version: 14.29 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: source | |
fetch-depth: 0 | |
- name: Setup submodules | |
shell: bash | |
run: | | |
cd source | |
auth_header="$(git config --local --get http.https://github.com/.extraheader)" | |
git submodule sync --recursive | |
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 || true | |
- name: Download Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: ==3.1.* | |
version: ${{ matrix.qt_version }} | |
target: desktop | |
arch: ${{ matrix.qt_arch }} | |
modules: ${{ matrix.qt_modules }} | |
extra: --base https://mirrors.ocf.berkeley.edu/qt/ | |
- name: Setup ninja | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: Setup MSVC | |
if: matrix.qt_arch == 'win64_msvc2019_64' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.compiler }} | |
toolset: ${{ matrix.compiler_version }} | |
- name: Update ccache | |
run: | | |
choco upgrade ccache | |
ccache --version | |
- name: Set up ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: Windows_QMapLibre_${{ matrix.qt_version }}_${{ matrix.arch }} | |
max-size: 200M | |
- name: Build QMapLibre (Qt 5) | |
if: matrix.qt_series == 5 | |
shell: bash | |
env: | |
COMPILER_TYPE: ${{ matrix.compiler }} | |
run: | | |
mkdir build && cd build | |
cmake.exe ../source/ \ | |
-G"Ninja Multi-Config" \ | |
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_INSTALL_PREFIX="../install" | |
ninja.exe | |
ninja.exe test | |
ninja.exe install | |
- name: Build QMapLibre (Qt 6) | |
if: matrix.qt_series == 6 | |
shell: bash | |
env: | |
COMPILER_TYPE: ${{ matrix.compiler }} | |
run: | | |
mkdir build && cd build | |
qt-cmake.bat ../source/ \ | |
-G"Ninja Multi-Config" \ | |
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_INSTALL_PREFIX="../install" | |
ninja.exe | |
ninja.exe test | |
ninja.exe install | |
- name: Build QtQuick Example (Qt 6) | |
if: matrix.qt_series == 6 | |
shell: bash | |
run: | | |
export PREFIX_PATH="$(pwd)/install" | |
mkdir build-example-quick && cd build-example-quick | |
qt-cmake.bat ../source/examples/quick/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="Release" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_INSTALL_PREFIX="../install-example-quick" \ | |
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" | |
ninja.exe | |
ninja.exe install | |
- name: Build QtWidgets Example (Qt 6) | |
if: matrix.qt_series == 6 | |
shell: bash | |
run: | | |
export PREFIX_PATH="$(pwd)/install" | |
mkdir build-example-widgets && cd build-example-widgets | |
qt-cmake.bat ../source/examples/widgets/ \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE="Release" \ | |
-DCMAKE_C_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache.exe" \ | |
-DCMAKE_INSTALL_PREFIX="../install-example-widgets" \ | |
-DCMAKE_PREFIX_PATH="$PREFIX_PATH" | |
ninja.exe | |
ninja.exe install | |
- name: Compress installation | |
shell: bash | |
env: | |
TAG_ARCH: ${{ matrix.arch }} | |
run: | | |
pushd install | |
tar cjvf ../QMapLibre_Windows_${TAG_ARCH}.tar.bz2 * | |
popd | |
- name: Compress examples | |
if: matrix.qt_series == 6 | |
shell: bash | |
env: | |
TAG_ARCH: ${{ matrix.arch }} | |
run: | | |
mkdir examples && pushd examples | |
cp -a ../install-example-quick/ Quick | |
cp -a ../install-example-widgets/ Widgets | |
tar cjvf ../QMapLibre_Windows_${TAG_ARCH}_examples.tar.bz2 * | |
popd | |
- name: Upload installation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }} | |
path: QMapLibre_Windows_${{ matrix.arch }}.tar.bz2 | |
- name: Upload examples | |
if: matrix.qt_series == 6 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }}_examples | |
path: QMapLibre_Windows_${{ matrix.arch }}_examples.tar.bz2 | |
release: | |
name: Release QMapLibre | |
if: github.ref_type == 'tag' | |
runs-on: windows-2022 | |
needs: build-and-test | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
qt_version: [5.15.2, 6.5.3, 6.6.2] | |
arch: [msvc2019_64] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: QMapLibre_Windows_${{ matrix.arch }}_${{ matrix.qt_version }}} | |
- name: Make tarball | |
shell: bash | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
TAG_ARCH: ${{ matrix.arch }} | |
run: | | |
mv QMapLibre_Windows_${TAG_ARCH}.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_${TAG_ARCH}.tar.bz2 | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_win64_${{ matrix.arch }}.tar.bz2 | |
allowUpdates: true | |
draft: true |