Sparse matrix error: detect ill conditions on-the-fly #8370
This file contains hidden or 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
| # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]> | |
| # | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: Sonar Cloud | |
| on: | |
| # run pipeline on push event of main branch | |
| push: | |
| branches: | |
| - main | |
| # run pipeline on pull request | |
| pull_request: | |
| # run pipeline on merge queue | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-sonar | |
| cancel-in-progress: true | |
| jobs: | |
| sonar-cloud: | |
| name: SonarCloud | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
| CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew | |
| LLVM_COV: llvm-cov-18 | |
| HOMEBREW_FORCE_BREWED_CURL: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: Install packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build clang-18 lcov gcovr | |
| sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang | |
| sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ | |
| - name: Enable brew | |
| run: | | |
| echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
| - name: Install C++ dependencies | |
| run: | | |
| brew update | |
| brew install boost eigen nlohmann-json msgpack-cxx doctest | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build-wrapper | |
| uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6 | |
| - name: Python test and coverage | |
| run: | | |
| CC=clang CXX=clang++ pip install -e .[dev] | |
| pytest | |
| - name: Run build-wrapper for C++ | |
| run: | | |
| cmake --preset ci-sonar | |
| VERBOSE=1 build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset ci-sonar | |
| - name: C++ test and coverage | |
| env: | |
| binaries: cpp_build/ci-sonar | |
| run: | | |
| cd cpp_build/ci-sonar | |
| ctest --test-dir . --output-on-failure | |
| PATH=${PATH}:${PWD}/../.. gcovr --gcov-executable llvm-gcov.sh --sonarqube ../../cpp_coverage.xml -r ../.. | |
| cd ../.. | |
| # remove branch hits count, since it does not make sense in heavy C++ templates | |
| sed -i -r "s/\s*branchesToCover\s*=\s*\"[0-9]+\"\s+coveredBranches\s*=\s*\"[0-9]+\"//g" cpp_coverage.xml | |
| - name: SonarQube Scan | |
| # only run sonar server in push event or pull request event from own repo | |
| if: ${{ (github.event_name == 'push') || (github.event.pull_request.head.repo.owner.login == 'PowerGridModel') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| uses: SonarSource/sonarqube-scan-action@v6 | |
| with: | |
| args: > | |
| --define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json |