-
Notifications
You must be signed in to change notification settings - Fork 25
64 lines (52 loc) · 1.96 KB
/
sonarcloud.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: SonarCloud
on: [push, pull_request, workflow_dispatch]
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: 01acfdfde3ed99280d3883a8fccd5fa4408f5214
- 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 }}"