|
| 1 | +# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor |
| 4 | + |
| 5 | +name: CI with external graphviz |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: |
| 22 | + - ubuntu-latest |
| 23 | + - macos-latest |
| 24 | + build_type: |
| 25 | + - Debug |
| 26 | + config: |
| 27 | + - qt_version: 6.6.2 |
| 28 | + qt_modules: qtscxml |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Install Dependencies on Linux |
| 32 | + if: ${{ runner.os == 'Linux' }} |
| 33 | + run: | |
| 34 | + sudo apt update -qq |
| 35 | + sudo apt install -y doxygen libgraphviz-dev |
| 36 | +
|
| 37 | + - name: Install Dependencies on macOS |
| 38 | + if: ${{ runner.os == 'macOS' }} |
| 39 | + run: brew install bison graphviz |
| 40 | + |
| 41 | + - name: Install Qt ${{ matrix.config.qt_version }} with options and default aqtversion |
| 42 | + uses: jurplel/install-qt-action@v3 |
| 43 | + with: |
| 44 | + aqtversion: null # use whatever the default is |
| 45 | + modules: ${{ matrix.config.qt_modules }} |
| 46 | + version: ${{ matrix.config.qt_version }} |
| 47 | + cache: true |
| 48 | + |
| 49 | + - name: Install ninja-build tool (must be after Qt due PATH changes) |
| 50 | + uses: turtlesec-no/get-ninja@main |
| 51 | + |
| 52 | + - name: Add Bison to PATH (must be after Qt due PATH changes) |
| 53 | + if: ${{ runner.os == 'macOS' }} |
| 54 | + run: echo "/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH |
| 55 | + |
| 56 | + - name: Checkout sources |
| 57 | + uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + submodules: recursive |
| 60 | + |
| 61 | + - name: Configure project |
| 62 | + run: > |
| 63 | + cmake -S . -B ./build -G Ninja |
| 64 | + --warn-uninitialized -Werror=dev |
| 65 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 66 | + -DCMAKE_OSX_ARCHITECTURES="arm64" |
| 67 | + -DBUILD_QT6=ON |
| 68 | + -DBUILD_TESTS=${{ matrix.build_type == 'Debug' }} |
| 69 | + -DBUILD_EXAMPLES=ON |
| 70 | + -DBUILD_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }} |
| 71 | + -DWITH_INTERNAL_GRAPHVIZ=OFF |
| 72 | +
|
| 73 | + - name: Build Project |
| 74 | + run: cmake --build ./build |
| 75 | + |
| 76 | + - name: Run tests on Linux (offscreen) |
| 77 | + if: ${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }} |
| 78 | + run: ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure |
| 79 | + env: |
| 80 | + QT_QPA_PLATFORM: offscreen |
| 81 | + |
| 82 | + - name: Run tests on macOS |
| 83 | + if: ${{ matrix.build_type == 'Debug' && runner.os != 'Linux' }} |
| 84 | + run: ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure |
| 85 | + |
| 86 | + - name: Read tests log when it fails |
| 87 | + uses: andstor/file-reader-action@v1 |
| 88 | + if: ${{ failure() && matrix.build_type == 'Debug' }} |
| 89 | + with: |
| 90 | + path: "./build/Testing/Temporary/LastTest.log" |
0 commit comments