Skip to content

Commit 13274df

Browse files
committed
Refactoring the workflow file
1 parent 2e5d1d3 commit 13274df

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,35 @@ jobs:
7777
- name: install gcovr 5.0
7878
run: |
7979
pip install gcovr==5.0 # 5.1 is not supported by sonarcloud
80-
- name: Install sonar-scanner and build-wrapper
81-
uses: SonarSource/sonarcloud-github-c-cpp@v3
80+
- name: Install Build Wrapper
81+
uses: SonarSource/sonarqube-scan-action/[email protected]
82+
# - name: Install sonar-scanner and build-wrapper
83+
# uses: SonarSource/sonarcloud-github-c-cpp@v3
8284
- name: Download all workflow run artifacts
8385
uses: actions/download-artifact@v4
8486
- name: Unpack Artifact
8587
run: >
8688
ls -l ./
8789
- name: Configure CMake
88-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
89-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
9090
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
9191
- name: Run build-wrapper
9292
run: |
9393
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
94-
- name: Run sonar-scanner
94+
- name: SonarQube Scan
95+
uses: SonarSource/[email protected]
9596
env:
9697
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
98-
run: |
99-
sonar-scanner \
100-
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \
101-
-Dsonar.coverageReportPaths=artifact/sonarqube-generic-coverage.xml
98+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
99+
with:
100+
# Consult https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options
101+
args: >
102+
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \
103+
# -Dsonar.coverageReportPaths=artifact/sonarqube-generic-coverage.xml
104+
# - name: Run sonar-scanner
105+
# env:
106+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
108+
# run: |
109+
# sonar-scanner \
110+
# --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" \
111+
# -Dsonar.coverageReportPaths=artifact/sonarqube-generic-coverage.xml

0 commit comments

Comments
 (0)