From 20bfb34bb8971787b0f0956db78920c417d2e905 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Sun, 12 Nov 2023 18:46:29 -0300 Subject: [PATCH] CI: Add nightly and fix current to use master branch --- .github/workflows/build.yml | 22 +++--- .github/workflows/nightly.yml | 68 +++++++++++++++++++ CMakeLists.txt | 3 +- .../signalThrottlersDemo/CMakeLists.txt | 3 + qt/qt6_natvis/CMakeLists.txt | 1 + .../qstringtokenizer/tst_qstringtokenizer.cpp | 4 +- 6 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec39ff3..d21fe0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,10 @@ name: CI on: push: branches: - - 2.0 + - master pull_request: branches: - - 2.0 + - master jobs: build: @@ -19,12 +19,9 @@ jobs: fail-fast: true matrix: os: - - ubuntu-22.04 - - ubuntu-20.04 - - windows-2022 - - windows-2019 - - macos-13 - - macos-12 + - ubuntu-latest + - windows-latest + #- macos-latest config: - qt_version: "5.15" @@ -44,6 +41,9 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 + - name: Fetch Git submodule + run: git submodule update --init --recursive + - name: Make sure MSVC is found when Ninja generator is in use if: ${{ runner.os == 'Windows' }} uses: ilammy/msvc-dev-cmd@v1 @@ -56,17 +56,17 @@ jobs: - name: Run tests on Linux (offscreen) if: ${{ runner.os == 'Linux' }} - run: ctest --test-dir ./build-${{ matrix.preset.name }} --output-on-failure + run: ctest --test-dir ./build --output-on-failure env: QT_QPA_PLATFORM: offscreen QT_QUICK_BACKEND: software - name: Run tests on Window/macOS if: ${{ runner.os != 'Linux' }} - run: ctest --test-dir ./build-${{ matrix.preset.name }} --output-on-failure + run: ctest --test-dir ./build --output-on-failure - name: Read tests log when it fails uses: andstor/file-reader-action@v1 if: ${{ failure() && startsWith(matrix.preset.name, 'ci-dev-') }} with: - path: "./build-${{ matrix.preset.name }}/Testing/Temporary/LastTest.log" + path: "./build/Testing/Temporary/LastTest.log" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..530f17a --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company +# +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only + +name: CI Nightly + +on: + schedule: + - cron: '0 3 * * *' + + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: + - ubuntu-latest + + config: + - name: clang-tidy + cmake_arg: '-DCMAKE_CXX_CLANG_TIDY=clang-tidy' + qt_version: "5.15" + + - name: clazy + cmake_arg: '-DCMAKE_CXX_COMPILER=clazy' + qt_version: "6.6.0" + apt_pgks: + - clazy + + steps: + - name: Install Qt ${{ matrix.config.qt_version }} with options and default aqtversion + uses: jurplel/install-qt-action@v3 + with: + version: ${{ matrix.config.qt_version }} + cache: true + + - name: Install ninja-build tool (must be after Qt due PATH changes) + uses: turtlesec-no/get-ninja@main + + - name: Install dependencies on Ubuntu (${{ join(matrix.config.apt_pgks, ' ') }}) + if: ${{ runner.os == 'Linux' && matrix.config.apt_pgks }} + run: | + sudo apt update -qq + echo ${{ join(matrix.config.apt_pgks, ' ') }} | xargs sudo apt install -y + + - uses: actions/checkout@v4 + #with: + #ref: '2.0' # schedule.cron do not allow branch setting + + - name: Fetch Git submodule + run: git submodule update --init --recursive + + - name: Configure project + run: > + cmake -S . -B ./build -G Ninja ${{ matrix.config.cmake_arg }} + --warn-uninitialized -Werror=dev + -DCMAKE_BUILD_TYPE=Debug + + - name: Build Project + run: cmake --build ./build diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a9ac05..450a3f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ project(KDToolBox LANGUAGES CXX) option(KDTOOLBOX_CXX20 "Enabling C++20 tests" OFF) +include(GNUInstallDirs) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -18,7 +20,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE TRUE) set(CMAKE_LINK_DEPENDS_NO_SHARED TRUE) set(QT_REQUIRED_VERSION "5.15.0") -set(QT_VERSION_MAJOR 5) # KDAB CI fails with Qt6 if(NOT DEFINED QT_VERSION_MAJOR) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) endif() diff --git a/qt/KDSignalThrottler/examples/signalThrottlersDemo/CMakeLists.txt b/qt/KDSignalThrottler/examples/signalThrottlersDemo/CMakeLists.txt index fec2a4c..d5adacb 100644 --- a/qt/KDSignalThrottler/examples/signalThrottlersDemo/CMakeLists.txt +++ b/qt/KDSignalThrottler/examples/signalThrottlersDemo/CMakeLists.txt @@ -4,6 +4,9 @@ # # SPDX-License-Identifier: MIT # + +set(CMAKE_CXX_STANDARD 14) + find_package( Qt${QT_VERSION_MAJOR} ${QT_REQUIRED_VERSION} diff --git a/qt/qt6_natvis/CMakeLists.txt b/qt/qt6_natvis/CMakeLists.txt index fdaef60..80fd351 100644 --- a/qt/qt6_natvis/CMakeLists.txt +++ b/qt/qt6_natvis/CMakeLists.txt @@ -14,6 +14,7 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) diff --git a/qt/stringtokenizer/tests/qstringtokenizer/tst_qstringtokenizer.cpp b/qt/stringtokenizer/tests/qstringtokenizer/tst_qstringtokenizer.cpp index 298ac78..41ebe18 100644 --- a/qt/stringtokenizer/tests/qstringtokenizer/tst_qstringtokenizer.cpp +++ b/qt/stringtokenizer/tests/qstringtokenizer/tst_qstringtokenizer.cpp @@ -96,8 +96,8 @@ void tst_QStringTokenizer::basics() const QFETCH(const Qt::CaseSensitivity, cs); auto expected = QStringList{ - QStringLiteral(""), QStringLiteral("a"), QStringLiteral("b"), QStringLiteral("c"), - QStringLiteral("d"), QStringLiteral("e"), QStringLiteral(""), + QLatin1String(""), QStringLiteral("a"), QStringLiteral("b"), QStringLiteral("c"), + QStringLiteral("d"), QStringLiteral("e"), QLatin1String(""), }; if (sb & Qt::SkipEmptyParts) expected = skipped(expected);