From f1a6274d941537a0658cf014e260a2e844917d32 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Tue, 26 Dec 2023 12:41:31 -0300 Subject: [PATCH] CI: Create CI presets --- .github/workflows/build.yml | 52 +++++++------- .github/workflows/nightly.yml | 24 +++---- CMakePresets.json | 129 ++++++++++++++++++++++++++++++---- 3 files changed, 150 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61c1c5e162..b731cd94e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,20 +23,20 @@ jobs: - windows-latest - macos-latest - build_type: - - Release - - client_only: - - client_only - - client_and_ui - config: - - qt_major: 5 + - preset: ci-dev-client-only-qt5 qt_version: "5.15" - - qt_major: 6 + + - preset: ci-dev-client-only-qt6 qt_version: "6.5.*" qt_modules: qtshadertools qtscxml + - preset: ci-dev-client-and-ui-qt5 + qt_version: "5.15" + + - preset: ci-dev-client-and-ui-qt6 + qt_version: "6.5.*" + steps: - name: Install Qt with options and default aqtversion uses: jurplel/install-qt-action@v3 @@ -58,15 +58,11 @@ jobs: - name: Configure project run: > - cmake -S . -B ./build -G Ninja - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DGAMMARAY_CLIENT_ONLY_BUILD=${{ matrix.client_only == 'client_only' }} + cmake -S . -G Ninja --preset ${{ matrix.config.preset }} -DGAMMARAY_BUILD_DOCS=${{ runner.os == 'Linux' }} - -DGAMMARAY_INSTALL_QT_LAYOUT=ON - -DGAMMARAY_MULTI_BUILD=OFF - name: Build Project - run: cmake --build ./build + run: cmake --build ./build-${{ matrix.config.preset }} - name: Install dependencies on Ubuntu if: ${{ runner.os == 'Linux' }} @@ -81,9 +77,9 @@ jobs: # Exclude # quickmaterialtest|quicktexturetest fails because of QT_QUICK_BACKEND=software - name: Run tests on Linux Qt5 (offscreen) - if: ${{ runner.os == 'Linux' && matrix.config.qt_major == 5 }} + if: ${{ runner.os == 'Linux' && startsWith(matrix.config.qt_version, '5.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "quickmaterialtest|quicktexturetest|timertoptest" env: QT_QPA_PLATFORM: offscreen @@ -94,9 +90,9 @@ jobs: # quickinspectortest|quickinspectortest2 fails at CI, local with 6.2.4 passes # modelinspectortest fails in Qt6/CI passes locally - name: Run tests on Linux Qt6 (offscreen) - if: ${{ runner.os == 'Linux' && matrix.config.qt_major == 6 }} + if: ${{ runner.os == 'Linux' && startsWith(matrix.config.qt_version, '6.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "quickmaterialtest|quicktexturetest|bindinginspectortest|quickinspectortest|quickinspectortest2|modelinspectortest|timertoptest" env: QT_QPA_PLATFORM: offscreen @@ -107,9 +103,9 @@ jobs: #26 - launchertest (Failed) #37 - quickinspectortest2 (Failed) - name: Run tests Qt5 on macOS - if: ${{ runner.os == 'macOS' && matrix.config.qt_major == 5 }} + if: ${{ runner.os == 'macOS' && startsWith(matrix.config.qt_version, '5.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "probeabidetectortest|launchertest|quickinspectortest2|timertoptest" # Exclude @@ -120,9 +116,9 @@ jobs: # quickinspectortest2 # bindinginspectortest fails in client_and_ui - name: Run tests Qt6 on macOS - if: ${{ runner.os == 'macOS' && matrix.config.qt_major == 6 }} + if: ${{ runner.os == 'macOS' && startsWith(matrix.config.qt_version, '6.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "probeabidetectortest|launchertest|clientconnectiontest|modelinspectortest|quickinspectortest2|bindinginspectortest|quicktexturetest|timertoptest" @@ -130,9 +126,9 @@ jobs: # quicktexturetest # bindinginspectortest - name: Qt5 Run tests on Windows - if: ${{ runner.os == 'Windows' && matrix.config.qt_major == 5 }} + if: ${{ runner.os == 'Windows' && startsWith(matrix.config.qt_version, '5.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "quicktexturetest|bindinginspectortest|timertoptest" # Exclude @@ -140,13 +136,13 @@ jobs: # bindinginspectortest # modelinspectortest fails in Qt6/CI passes locally - name: Qt6 Run tests on Windows - if: ${{ runner.os == 'Windows' && matrix.config.qt_major == 6 }} + if: ${{ runner.os == 'Windows' && startsWith(matrix.config.qt_version, '6.') }} run: > - ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure + ctest --test-dir ./build-${{ matrix.config.preset }} -C 'Debug' --output-on-failure --exclude-regex "quicktexturetest|launchertest|bindinginspectortest|modelinspectortest|timertoptest|probesettingstest" - name: Read tests log when it fails uses: andstor/file-reader-action@v1 if: ${{ failure() }} with: - path: "./build/Testing/Temporary/LastTest.log" + path: "./build-${{ matrix.config.preset }}/Testing/Temporary/LastTest.log" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 31c67946bc..c210ef156d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -8,6 +8,13 @@ on: schedule: - cron: '0 3 * * *' + push: + branches: + - master + pull_request: + branches: + - master + jobs: build: runs-on: ${{ matrix.os }} @@ -18,13 +25,11 @@ jobs: - ubuntu-latest config: - - name: clang-tidy - cmake_arg: '-DCMAKE_CXX_CLANG_TIDY=clang-tidy' + - preset: ci-dev-clang-tidy-qt6 qt_version: "6.6" qt_modules: qtshadertools qtscxml - - name: clazy - cmake_arg: '-DCMAKE_CXX_COMPILER=clazy' + - preset: ci-dev-clazy-qt6 qt_version: "6.6" qt_modules: qtshadertools qtscxml apt_pgks: @@ -54,14 +59,7 @@ jobs: - name: Configure project run: > - cmake -S . -B ./build -G Ninja ${{ matrix.config.cmake_arg }} - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -Werror=dev - -DECM_ENABLE_SANITIZERS=address - -DGAMMARAY_QT6_BUILD=ON - -DGAMMARAY_DISABLE_FEEDBACK=ON - -DGAMMARAY_BUILD_DOCS=${{ matrix.config.name == 'clazy' }} - -DGAMMARAY_MULTI_BUILD=${{ matrix.config.name == 'clazy' }} + cmake -S . -G Ninja --preset ${{ matrix.config.preset }} - name: Build Project - run: cmake --build ./build + run: cmake --build ./build-${{ matrix.config.preset }} diff --git a/CMakePresets.json b/CMakePresets.json index 0b188ac7d3..e220467401 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,29 +1,42 @@ { "version": 2, "configurePresets": [ + { + "name": "base", + "generator": "Ninja", + "hidden": true, + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "warnings": { + "uninitialized": true + } + }, { "name": "dev", "displayName": "dev", - "generator": "Ninja", "binaryDir": "${sourceDir}/build-dev", "cacheVariables": { "QT_VERSION_MAJOR": "5", "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "GAMMARAY_USE_PCH": "ON" - } + }, + "inherits": [ + "base" + ] }, { "name": "dev6", "displayName": "dev qt6", - "generator": "Ninja", "binaryDir": "${sourceDir}/build-dev-qt6", "cacheVariables": { "QT_VERSION_MAJOR": "6", - "GAMMARAY_USE_PCH": "ON", "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" - } + "GAMMARAY_USE_PCH": "ON" + }, + "inherits": [ + "base" + ] }, { "name": "dev-asan", @@ -127,6 +140,100 @@ "CXX": "clazy", "CCACHE_DISABLE": "ON" } + }, + { + "name": "ci-dev-client-only-qt5", + "displayName": "ci-dev-client-only-qt5", + "description": "Qt5 client-only build", + "binaryDir": "${sourceDir}/build-ci-dev-client-only-qt5", + "generator": "Ninja", + "cacheVariables": { + "GAMMARAY_CLIENT_ONLY_BUILD": "ON", + "GAMMARAY_INSTALL_QT_LAYOUT": "ON", + "GAMMARAY_MULTI_BUILD": "OFF" + }, + "inherits": [ + "dev" + ] + }, + { + "name": "ci-dev-client-only-qt6", + "displayName": "ci-dev-client-only-qt6", + "description": "Qt6 client-only build", + "binaryDir": "${sourceDir}/build-ci-dev-client-only-qt6", + "generator": "Ninja", + "cacheVariables": { + "GAMMARAY_CLIENT_ONLY_BUILD": "ON", + "GAMMARAY_INSTALL_QT_LAYOUT": "ON", + "GAMMARAY_MULTI_BUILD": "OFF" + }, + "inherits": [ + "dev6" + ] + }, + { + "name": "ci-dev-client-and-ui-qt5", + "displayName": "ci-dev-client-and-ui-qt5", + "description": "Qt5 client and ui build", + "binaryDir": "${sourceDir}/build-ci-dev-client-and-ui-qt5", + "generator": "Ninja", + "cacheVariables": { + "GAMMARAY_CLIENT_ONLY_BUILD": "OFF", + "GAMMARAY_INSTALL_QT_LAYOUT": "ON", + "GAMMARAY_MULTI_BUILD": "OFF" + }, + "inherits": [ + "dev" + ] + }, + { + "name": "ci-dev-client-and-ui-qt6", + "displayName": "ci-dev-client-and-ui-qt6", + "description": "Qt6 client and ui build", + "binaryDir": "${sourceDir}/build-ci-dev-client-and-ui-qt6", + "generator": "Ninja", + "cacheVariables": { + "GAMMARAY_CLIENT_ONLY_BUILD": "OFF", + "GAMMARAY_INSTALL_QT_LAYOUT": "ON", + "GAMMARAY_MULTI_BUILD": "OFF" + }, + "inherits": [ + "dev6" + ] + }, + { + "name": "ci-dev-clang-tidy-qt6", + "displayName": "ci-dev-clang-tidy-qt6", + "description": "Qt6 clang-tidy build", + "binaryDir": "${sourceDir}/build-ci-dev-clang-tidy-qt6", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_CXX_CLANG_TIDY": "clang-tidy", + "ECM_ENABLE_SANITIZERS": "address", + "GAMMARAY_BUILD_DOCS": "OFF", + "GAMMARAY_MULTI_BUILD": "OFF", + "GAMMARAY_DISABLE_FEEDBACK": "ON" + }, + "inherits": [ + "dev6" + ] + }, + { + "name": "ci-dev-clazy-qt6", + "displayName": "ci-dev-clazy-qt6", + "description": "Qt6 clazy build", + "binaryDir": "${sourceDir}/build-ci-dev-clazy-qt6", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clazy", + "ECM_ENABLE_SANITIZERS": "address", + "GAMMARAY_BUILD_DOCS": "ON", + "GAMMARAY_MULTI_BUILD": "ON", + "GAMMARAY_DISABLE_FEEDBACK": "ON" + }, + "inherits": [ + "dev6" + ] } ], "buildPresets": [ @@ -135,10 +242,7 @@ "configurePreset": "dev", "targets": [ "all" - ], - "cacheVariables": { - "QT_VERSION_MAJOR": "5" - } + ] }, { "name": "clazy", @@ -146,9 +250,6 @@ "environment": { "CLAZY_CHECKS": "level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo", "CCACHE_DISABLE": "ON" - }, - "cacheVariables": { - "QT_VERSION_MAJOR": "5" } } ]