Skip to content

Commit

Permalink
[ci] Merge Linux workflows and add LLVM 17 test for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ntadej committed Oct 14, 2023
1 parent 1016386 commit 1bd1032
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
# - ".github/actions/**"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"
# - ".github/workflows/Windows.yml"

Expand All @@ -30,7 +29,6 @@ on:
# - ".github/actions/**"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"
# - ".github/workflows/Windows.yml"

Expand Down
93 changes: 86 additions & 7 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
- ".github/FUNDING.yml"
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux-Test.yml"
- ".github/workflows/macOS.yml"
- ".github/workflows/Windows.yml"

Expand All @@ -28,7 +27,6 @@ on:
- ".github/FUNDING.yml"
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux-Test.yml"
- ".github/workflows/macOS.yml"
- ".github/workflows/Windows.yml"

Expand All @@ -39,20 +37,27 @@ concurrency:

jobs:
build-and-test:
name: Build QMapLibre (Qt ${{ matrix.qt_version}})
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: ""
- qt_series: 6
qt_version: 6.5.3
qt_modules: qtlocation qtpositioning
compiler: ""
- qt_series: 6
qt_version: 6.6.0
qt_modules: qtlocation qtpositioning
compiler: ""
- qt_series: 6
qt_version: 6.6.0
qt_modules: qtlocation qtpositioning
compiler: gcc-13

steps:
- name: Checkout
Expand All @@ -62,6 +67,28 @@ jobs:
submodules: recursive
fetch-depth: 0

- name: Install test dependencies
if: matrix.compiler != ''
run: |
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 != ''
uses: rlalik/setup-cpp-compiler@master
with:
compiler: ${{ matrix.compiler }}

- name: Download Qt
uses: jurplel/install-qt-action@v3
with:
Expand All @@ -74,24 +101,76 @@ jobs:
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: Linux_QMapLibre_${{ matrix.qt_version }}
key: Linux_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }}
append-timestamp: false

- name: Build QMapLibre (Qt5)
if: matrix.qt_series == 5
uses: ./source/.github/actions/qt5-build

- name: Build QMapLibre (Qt6)
if: matrix.qt_series == 6
if: matrix.qt_series == 6 && matrix.compiler == ''
uses: ./source/.github/actions/qt6-build

- name: Create artifacts
- name: Build QMapLibre (Qt6, custom compiler)
if: matrix.qt_series == 6 && matrix.compiler != ''
env:
CC: ${{ steps.install_compiler.outputs.cc }}
CXX: ${{ steps.install_compiler.outputs.cxx }}
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_INTERNAL_ICU=ON
ninja
ninja install
- name: Run tests
if: matrix.qt_series == 6 && matrix.compiler != ''
uses: coactions/setup-xvfb@v1
with:
run: ctest --output-on-failure
working-directory: build

- name: Build QtQuick Example (Qt6)
if: matrix.qt_series == 6 && matrix.compiler != ''
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 != ''
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 == ''
run: |
pushd install
tar cjvf ../QMapLibre_Linux.tar.bz2 *
popd
- name: Upload installationUpload artifacts
- name: Upload installation
if: matrix.compiler == ''
uses: actions/upload-artifact@v3
with:
name: QMapLibre_Linux_${{ matrix.qt_version }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
# - ".github/workflows/Android.yml"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"

# pull_request:
Expand All @@ -31,7 +30,6 @@ on:
# - ".github/workflows/Android.yml"
# - ".github/workflows/iOS.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"

concurrency:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
# - ".github/actions/**"
# - ".github/workflows/Android.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"
# - ".github/workflows/Windows.yml"

Expand All @@ -30,7 +29,6 @@ on:
# - ".github/actions/**"
# - ".github/workflows/Android.yml"
# - ".github/workflows/Linux.yml"
# - ".github/workflows/Linux-Test.yml"
# - ".github/workflows/macOS.yml"
# - ".github/workflows/Windows.yml"

Expand Down
33 changes: 27 additions & 6 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux.yml"
- ".github/workflows/Linux-Test.yml"
- ".github/workflows/Windows.yml"

pull_request:
Expand All @@ -31,7 +30,6 @@ on:
- ".github/workflows/Android.yml"
- ".github/workflows/iOS.yml"
- ".github/workflows/Linux.yml"
- ".github/workflows/Linux-Test.yml"
- ".github/workflows/Windows.yml"

concurrency:
Expand All @@ -41,20 +39,27 @@ concurrency:

jobs:
build-and-test:
name: Build QMapLibre (Qt ${{ matrix.qt_version}})
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: ""
- qt_series: 6
qt_version: 6.5.3
qt_modules: qtlocation qtpositioning
compiler: ""
- qt_series: 6
qt_version: 6.6.0
qt_modules: qtlocation qtpositioning
compiler: ""
- qt_series: 6
qt_version: 6.6.0
qt_modules: qtlocation qtpositioning
compiler: "llvm@17"

steps:
- name: Checkout
Expand All @@ -69,6 +74,20 @@ jobs:
with:
xcode-version: latest-stable

- name: Setup compiler (macOS)
if: matrix.compiler != ''
env:
MLN_COMPILER: ${{ matrix.compiler }}
run: |
brew install "$MLN_COMPILER"
echo "/usr/local/opt/${MLN_COMPILER}/bin" >> "$GITHUB_PATH"
{
echo "CC=/usr/local/opt/${MLN_COMPILER}/bin/clang"
echo "CXX=/usr/local/opt/${MLN_COMPILER}/bin/clang++"
echo "LDFLAGS=\"-L/usr/local/opt/${MLN_COMPILER}/lib\""
echo "CPPFLAGS=\"-I/usr/local/opt/${MLN_COMPILER}/include\""
} >> "$GITHUB_ENV"
- name: Download Qt
uses: jurplel/install-qt-action@v3
with:
Expand All @@ -83,7 +102,7 @@ jobs:
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macOS_QMapLibre_${{ matrix.qt_version }}
key: macOS_QMapLibre_${{ matrix.qt_version }}_${{ matrix.compiler }}
append-timestamp: false

- name: Build QMapLibre (Qt5)
Expand Down Expand Up @@ -150,13 +169,14 @@ jobs:
ninja deploy
- name: Compress installation
if: matrix.compiler == ''
run: |
pushd install
tar cjvf ../QMapLibre_macOS.tar.bz2 *
popd
- name: Compress examples
if: matrix.qt_series == 6
if: matrix.qt_series == 6 && matrix.compiler == ''
run: |
mkdir examples && pushd examples
cp -a ../build-example-quick/QMapLibreExampleQuick.app .
Expand All @@ -165,13 +185,14 @@ jobs:
popd
- name: Upload installation
if: matrix.compiler == ''
uses: actions/upload-artifact@v3
with:
name: QMapLibre_macOS_${{ matrix.qt_version }}
path: QMapLibre_macOS.tar.bz2

- name: Upload examples
if: matrix.qt_series == 6
if: matrix.qt_series == 6 && matrix.compiler == ''
uses: actions/upload-artifact@v3
with:
name: QMapLibre_macOS_${{ matrix.qt_version }}_examples
Expand Down

0 comments on commit 1bd1032

Please sign in to comment.