Merge pull request #6 from Jhuighuy/matrix-shapes #420
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
# Copyright (C) 2020-2023 Oleg Butakov | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to | |
# deal in the Software without restriction, including without limitation the | |
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
# sell copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
# IN THE SOFTWARE. | |
# ------------------------------------------------------------------------------ | |
name: SonarCloud | |
# ------------------------------------------------------------------------------ | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# ------------------------------------------------------------------------------ | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
env: | |
# g++ and gcov executables. | |
GXX_EXE: g++-12 | |
GCOV_EXE: gcov-12 | |
# Coverage report file path. | |
SONAR_COVERAGE_REPORT_PATH: sonar_coverage.xml | |
CODECOV_COVERAGE_REPORT_PATH: codecov_coverage.xml | |
# Directory where build-wrapper output will be placed. | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory | |
steps: | |
# ------------------------------------------------------------------------ | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# ------------------------------------------------------------------------ | |
- name: Install mold | |
uses: rui314/setup-mold@v1 | |
with: | |
make-default: false | |
continue-on-error: true # might fail for unknown reason. | |
# ------------------------------------------------------------------------ | |
- name: Install gcovr | |
run: | | |
pip install gcovr | |
# ------------------------------------------------------------------------ | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v1 | |
# ------------------------------------------------------------------------ | |
- name: Run build-wrapper | |
run: | | |
./scripts/configure.py -cxx=${{ env.GXX_EXE }} -std=c++20 -cfg=Coverage | |
build-wrapper-linux-x86-64 \ | |
--out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ./scripts/build.py -j | |
# ------------------------------------------------------------------------ | |
- name: Run tests | |
run: | | |
./bin/StormRuler_UnitTests | |
# ------------------------------------------------------------------------ | |
- name: Run gcovr | |
run: | | |
gcovr \ | |
-e "build/vcpkg_installed/*" -e "test/*" \ | |
--exclude-throw-branches \ | |
--gcov-executable "${{ env.GCOV_EXE }}" \ | |
--xml "{{ env.CODECOV_COVERAGE_REPORT_PATH }}" \ | |
--sonarqube "${{ env.SONAR_COVERAGE_REPORT_PATH }}" | |
# See why `--exclude-throw-branches` below: | |
# https://www.gcovr.com/en/stable/faq.html#why-does-c-code-have-so-many-uncovered-branches | |
# ------------------------------------------------------------------------ | |
- name: Upload to CodeCov | |
uses: codecov/codecov-action@v2 | |
with: | |
files: "{{ env.CODECOV_COVERAGE_REPORT_PATH }}" | |
# ------------------------------------------------------------------------ | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | |
--define sonar.coverageReportPaths="${{ env.SONAR_COVERAGE_REPORT_PATH }}" | |
# ------------------------------------------------------------------------------ |