ci: fix #532
Workflow file for this run
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: CI - Build and Test | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
build: | |
name: ${{ matrix.os }}, ${{ matrix.cmake_name }}, ${{ matrix.qt_name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest, macos-11, ubuntu-20.04, ubuntu-22.04 ] | |
cmake: [ 3.24, 3.x ] | |
qt: [ "5.15.2", "6.5.0" ] | |
include: | |
- os: ubuntu-20.04 | |
COVERAGE: ON | |
GCOV_TOOL: gcov-9 | |
- os: windows-latest | |
cmake: 3.24 | |
WARNINGS_AS_ERRORS: OFF | |
- os: windows-latest | |
static_postfix: _static | |
CXX: cl | |
- cmake: 3.24 | |
cmake_name: CMake 3.24 | |
- cmake: 3.x | |
cmake_name: CMake Latest | |
- qt: "5.15.2" | |
qt_name: Qt5 | |
- qt: "6.5.0" | |
qt_name: Qt6 | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
# CMake 3.15 doesn't detect Visual Studio correctly without these. | |
CXX: ${{ matrix.CXX }} | |
CC: ${{ matrix.CXX }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: abdes/gha-setup-ninja@master | |
- name: Setup Windows environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7.x | |
cache: 'pip' | |
- name: Install pip dependencies | |
run: | | |
pip3 install wheel setuptools | |
pip3 install conan | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1.14 | |
with: | |
cmake-version: ${{matrix.cmake}} | |
- name: Print CMake version | |
run: cmake --version | |
- name: Install and cache apt dependencies | |
if: runner.os == 'Linux' | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: lcov ^libxcb-* | |
version: 1.0 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
cache: true | |
version: ${{ matrix.qt }} | |
aqtversion: '==3.1.*' | |
- name: Set CMake arguments | |
id: cmake_args | |
run: echo "CMAKE_ARGS=-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -DUNIT_TESTS_RUN_ON_CI=1 -Daide_WARNINGS_AS_ERRORS=${{ matrix.WARNINGS_AS_ERRORS || 'ON' }} -Daide_ENABLE_CLANG_TIDY=OFF -Daide_ENABLE_CPPCHECK=OFF -Daide_ENABLE_SANITIZER_ADDRESS=OFF -Daide_ENABLE_SANITIZER_UNDEFINED=OFF -Daide_ENABLE_IPO=OFF" >> $GITHUB_OUTPUT | |
# Static Debug | |
- name: "Static Debug: Configure" | |
run: cmake -G Ninja -S . -B build-static-dbg -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_DEBUG_POSTFIX=d${{matrix.static_postfix}}" ${{ steps.cmake_args.outputs.CMAKE_ARGS }} | |
- name: "Static Debug: Build" | |
run: cmake --build build-static-dbg --parallel | |
- name: "Static Debug: Test" | |
run: ctest --output-on-failure --stop-on-failure | |
working-directory: build-static-dbg | |
env: | |
QT_QPA_PLATFORM: offscreen | |
# Shared Debug | |
- name: "Shared Debug: Configure" | |
run: cmake -G Ninja -S . -B build-shared-dbg -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=d -DBUILD_SHARED_LIBS=ON "-Daide_ENABLE_COVERAGE=${{ matrix.COVERAGE }}" ${{ steps.cmake_args.outputs.CMAKE_ARGS }} | |
- name: "Shared Debug: Build" | |
run: cmake --build build-shared-dbg --parallel | |
- name: "Shared Debug: Test" | |
run: ctest --output-on-failure --stop-on-failure | |
working-directory: build-shared-dbg | |
env: | |
QT_QPA_PLATFORM: offscreen | |
# Static Release | |
- name: "Static Release: Configure" | |
run: cmake -G Ninja -S . -B build-static-rel -DCMAKE_BUILD_TYPE=Release "-DCMAKE_RELEASE_POSTFIX=${{matrix.static_postfix}}" ${{ steps.cmake_args.outputs.CMAKE_ARGS }} | |
- name: "Static Release: Build" | |
run: cmake --build build-static-rel --parallel | |
- name: "Static Release: Test" | |
run: ctest --output-on-failure --stop-on-failure | |
working-directory: build-static-rel | |
env: | |
QT_QPA_PLATFORM: offscreen | |
# Shared Release | |
- name: "Shared Release: Configure" | |
run: cmake -G Ninja -S . -B build-shared-rel -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ${{ steps.cmake_args.outputs.CMAKE_ARGS }} | |
- name: "Shared Release: Build" | |
run: cmake --build build-shared-rel --parallel | |
- name: "Shared Release: Test" | |
run: ctest --output-on-failure --stop-on-failure | |
working-directory: build-shared-rel | |
env: | |
QT_QPA_PLATFORM: offscreen | |
# Joint install | |
- name: Install | |
run: | | |
cmake --install build-shared-dbg --prefix install | |
cmake --install build-static-dbg --prefix install | |
cmake --install build-shared-rel --prefix install | |
cmake --install build-static-rel --prefix install | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test_results_${{ matrix.os }} | |
path: build*/**/*.xml | |
- name: Generate and upload coverage reports | |
if: matrix.COVERAGE == 'ON' | |
working-directory: build-shared-dbg | |
run: | | |
lcov --gcov-tool ${{ matrix.GCOV_TOOL }} --directory . --capture --output-file coverage.info # capture coverage info | |
lcov --gcov-tool ${{ matrix.GCOV_TOOL }} --remove coverage.info '/usr/*' --output-file coverage.info # filter out system | |
lcov --gcov-tool ${{ matrix.GCOV_TOOL }} --list coverage.info #debug info | |
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" | |
publish-test-results: | |
name: "Publish Unit Test Results from ${{ matrix. os }}" | |
needs: build | |
if: always() | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04 ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Publish Unit Test Results ${{ matrix.os }} | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
check_name: Unit Test Results ${{ matrix.os }} | |
comment_mode: always | |
junit_files: artifacts/test_results_${{ matrix. os}}/**/tests/ut/*.xml | |
report_individual_runs: true | |
deduplicate_classes_by_file_name: false | |