Apply a bunch of suggested fixes #228
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: SonarCloud | |
on: [push, pull_request, workflow_dispatch] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
env: | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup | |
run: | | |
sudo apt update | |
sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache lcov | |
- name: Setup GCC | |
uses: pkgxdev/setup@v1 | |
with: | |
+: gcc@13 | |
- run: gcc --version | |
- name: Install sonar-scanner and build-wrapper | |
uses: sonarsource/sonarcloud-github-c-cpp@v2 | |
- name: Restore artifacts or setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgGitCommitId: 23ceb9cbf9b6d32f485cf039547b70102a6ef9d8 | |
- name: Configure | |
run: cmake -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D ENABLE_TESTING:BOOL=TRUE -D ENABLE_COVERAGE:BOOL=TRUE -S . -B build | |
- name: Build | |
run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build | |
- name: Test | |
working-directory: build | |
continue-on-error: true | |
run: ctest --rerun-failed --output-on-failure -j 2 | |
- name: Generate coverage info | |
working-directory: build | |
continue-on-error: true | |
run: | | |
mkdir gcov-reports | |
pushd gcov-reports | |
for f in `find ../tests/CMakeFiles/CDT_test.dir -name '*.o'`; do | |
echo "Processing $f file..." | |
gcov -o ${f} x | |
done | |
ls | wc -l | |
popd | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR info, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" |