Skip to content

Commit fd1424d

Browse files
committed
Git: Updated SonarCloud GitHub Actions
1 parent 0b0ed36 commit fd1424d

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

.github/workflows/sonarcloud.yml

+11-27
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,17 @@ on:
77

88
jobs:
99
analysis:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111
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
1413
steps:
15-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1615
with:
1716
submodules: 'recursive'
1817
fetch-depth: 0
1918

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
4021

4122
- name: "Configure build"
4223
working-directory: ${{ github.workspace }}
@@ -47,13 +28,16 @@ jobs:
4728
-D TACHYON_TOOLS_ENABLE_FORMATTING=OFF \
4829
-D TACHYON_TOOLS_ENABLE_TAGS=OFF
4930
50-
- name: "Build"
31+
- name: "Run build-wrapper"
5132
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 .
5336
5437
- name: "Run sonar-scanner and upload the results"
5538
working-directory: ${{ github.workspace }}
5639
env:
5740
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5841
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"

sonar-project.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
sonar.projectName=repo-template
22
sonar.projectKey=tachyon-computer_repo-template
33
sonar.organization=tachyon-computer
4-
sonar.cfamily.cache.enabled=false
54
sonar.cfamily.threads=2
65
sonar.sources=src
76
sonar.tests=tests

0 commit comments

Comments
 (0)