7
7
8
8
jobs :
9
9
analysis :
10
- runs-on : ubuntu-20.04
10
+ runs-on : ubuntu-latest
11
11
env :
12
- SONAR_SCANNER_VERSION : 4.6.1.2450
13
- SONAR_SERVER_URL : " https://sonarcloud.io"
12
+ BUILD_WRAPPER_OUT_DIR : build_wrapper_output_directory
14
13
steps :
15
- - uses : actions/checkout@v2
14
+ - uses : actions/checkout@v3
16
15
with :
17
16
submodules : ' recursive'
18
17
fetch-depth : 0
19
18
20
- - name : " Set up JDK 11"
21
- uses : actions/setup-java@v1
22
- with :
23
- java-version : 11
24
-
25
- - name : " Download and set up sonar-scanner"
26
- env :
27
- SONAR_SCANNER_DOWNLOAD_URL : https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
28
- run : |
29
- mkdir -p $HOME/.sonar
30
- curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
31
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
32
- echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
33
-
34
- - name : " Configure sonar-scanner"
35
- working-directory : ${{ github.workspace }}
36
- run : |
37
- echo "sonar.projectVersion=${{ github.sha }}" >> sonar-project.properties
38
- echo "sonar.cfamily.compile-commands=${{ github.workspace }}/build/compile_commands.json" >> sonar-project.properties
39
- echo "sonar.host.url=${{ env.SONAR_SERVER_URL }}" >> sonar-project.properties
19
+ - name : " Install sonar-scanner and build-wrapper"
20
+ uses : SonarSource/sonarcloud-github-c-cpp@v2
40
21
41
22
- name : " Configure build"
42
23
working-directory : ${{ github.workspace }}
@@ -47,13 +28,16 @@ jobs:
47
28
-D TACHYON_TOOLS_ENABLE_FORMATTING=OFF \
48
29
-D TACHYON_TOOLS_ENABLE_TAGS=OFF
49
30
50
- - name : " Build "
31
+ - name : " Run build-wrapper "
51
32
working-directory : ${{ github.workspace }}/build
52
- run : cmake --build .
33
+ run : |
34
+ build-wrapper-linux-x86-64 --out-dir ${{ github.workspace }}/${{ env.BUILD_WRAPPER_OUT_DIR }} \
35
+ cmake --build .
53
36
54
37
- name : " Run sonar-scanner and upload the results"
55
38
working-directory : ${{ github.workspace }}
56
39
env :
57
40
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
41
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
59
- run : sonar-scanner
42
+ run : |
43
+ sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
0 commit comments