[pre-commit.ci] pre-commit autoupdate #215
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: Linux CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- "**" | |
paths-ignore: | |
- ".gitignore" | |
- "README.md" | |
# ignore CI for other platforms | |
- ".github/FUNDING.yml" | |
- ".github/workflows/Android.yml" | |
- ".github/workflows/iOS.yml" | |
- ".github/workflows/macOS.yml" | |
- ".github/workflows/Windows.yml" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- ".gitignore" | |
- "README.md" | |
# ignore CI for other platforms | |
- ".github/FUNDING.yml" | |
- ".github/workflows/Android.yml" | |
- ".github/workflows/iOS.yml" | |
- ".github/workflows/macOS.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 Linux (Qt${{ matrix.qt_version}}, ${{ matrix.compiler }}) | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- qt_series: 5 | |
qt_version: 5.15.2 | |
qt_modules: "" | |
compiler: default | |
- qt_series: 6 | |
qt_version: 6.5.3 | |
qt_modules: qtlocation qtpositioning | |
compiler: default | |
- qt_series: 6 | |
qt_version: 6.6.2 | |
qt_modules: qtlocation qtpositioning | |
compiler: default | |
- qt_series: 6 | |
qt_version: 6.6.2 | |
qt_modules: qtlocation qtpositioning | |
compiler: gcc-13 | |
gcov: gcov-13 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: source | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Install test dependencies | |
if: matrix.compiler != 'default' | |
run: | | |
sudo apt-get update | |
sudo apt-get install \ | |
libxkbcommon-x11-0 \ | |
libxcb-cursor0 \ | |
libxcb-icccm4 \ | |
libxcb-image0 \ | |
libxcb-keysyms1 \ | |
libxcb-randr0 \ | |
libxcb-render-util0 \ | |
libxcb-xinerama0 \ | |
libxcb-xfixes0 \ | |
libegl1-mesa | |
- name: Install compiler | |
id: install_compiler | |
if: matrix.compiler != 'default' | |
uses: rlalik/setup-cpp-compiler@master | |
with: | |
compiler: ${{ matrix.compiler }} | |
- name: Install lcov | |
if: matrix.compiler != 'default' | |
run: | | |
sudo apt-get update | |
sudo apt-get install \ | |
libcapture-tiny-perl \ | |
libdatetime-perl \ | |
libdatetime-format-dateparse-perl \ | |
libgd-perl \ | |
libgd3 \ | |
libjbig0 \ | |
libjpeg-turbo8 \ | |
libjpeg8 \ | |
libjson-perl \ | |
libperlio-gzip-perl \ | |
libtiff5 \ | |
libwebp7 | |
git clone https://github.com/linux-test-project/lcov.git -b v2.0 | |
pushd lcov | |
sudo make -j$(nproc) install | |
popd | |
rm -rf lcov | |
- name: Download Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: ==3.1.* | |
version: ${{ matrix.qt_version }} | |
dir: ${{ github.workspace }} | |
target: desktop | |
modules: ${{ matrix.qt_modules }} | |
extra: --base https://mirrors.ocf.berkeley.edu/qt/ | |
- name: Setup ninja | |
if: matrix.compiler != 'default' | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: Set up ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: Linux_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }} | |
max-size: 200M | |
- name: Build QMapLibre (Qt5) | |
if: matrix.qt_series == 5 | |
uses: ./source/.github/actions/qt5-build | |
- name: Build QMapLibre (Qt6) | |
if: matrix.qt_series == 6 && matrix.compiler == 'default' | |
uses: ./source/.github/actions/qt6-build | |
- name: Build QMapLibre (Qt6, custom compiler) | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
env: | |
CC: ${{ steps.install_compiler.outputs.cc }} | |
CXX: ${{ steps.install_compiler.outputs.cxx }} | |
GCOV: ${{ matrix.gcov }} | |
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" \ | |
-DMLN_QT_WITH_COVERAGE=ON \ | |
-DGCOV_PATH="$(which ${GCOV})" | |
ninja | |
ninja install | |
- name: Run tests | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: ctest --output-on-failure | |
working-directory: build | |
- name: Run code coverage | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: ninja coverage | |
working-directory: build | |
- name: Build QtQuick Example (Qt6) | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
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_PREFIX_PATH="$PREFIX_PATH" | |
ninja | |
- name: Build QtWidgets Example (Qt6) | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
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_PREFIX_PATH="$PREFIX_PATH" | |
ninja | |
- name: Compress installation | |
if: matrix.compiler == 'default' | |
run: | | |
pushd install | |
tar cjvf ../QMapLibre_Linux.tar.bz2 * | |
popd | |
- name: Upload installation | |
if: matrix.compiler == 'default' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QMapLibre_Linux_${{ matrix.qt_version }} | |
path: QMapLibre_Linux.tar.bz2 | |
- name: Upload coverage reports to Codecov | |
if: matrix.qt_series == 6 && matrix.compiler != 'default' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/coverage.info | |
verbose: true | |
release: | |
name: Release QMapLibre | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-22.04 | |
needs: build-and-test | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
qt_version: [5.15.2, 6.5.3, 6.6.2] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: QMapLibre_Linux_${{ matrix.qt_version }} | |
- name: Make tarball | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
QT_VERSION: ${{ matrix.qt_version }} | |
run: | | |
mv QMapLibre_Linux.tar.bz2 QMapLibre_${TAG_NAME}_Qt${QT_VERSION}_Linux.tar.bz2 | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: QMapLibre_${{ github.ref_name }}_Qt${{ matrix.qt_version }}_Linux.tar.bz2 | |
allowUpdates: true | |
draft: true |