Skip to content

Commit 5301276

Browse files
author
Gonzalo Diaz
committed
[Github Actions] sonarcloud added.
1 parent f5dd3e8 commit 5301276

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

.github/workflows/rust-coverage.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
run: rustup update stable
2121
- name: Install cargo-llvm-cov
2222
uses: taiki-e/install-action@cargo-llvm-cov
23+
- name: Install Clippy
24+
run: rustup component add clippy
25+
- name: Install cargo-sonar and run Clippy
26+
run: |
27+
cargo install cargo-sonar
28+
cargo clippy --message-format json > my-clippy-report.json
29+
cargo sonar --clippy --clippy-path my-clippy-report.json
2330
- name: Generate code coverage
2431
run: >
2532
cargo llvm-cov
@@ -31,7 +38,9 @@ jobs:
3138
uses: actions/upload-artifact@v4
3239
with:
3340
name: coverage-report
34-
path: lcov.info
41+
path: |
42+
lcov.info
43+
sonar-issues.json
3544
3645
codecov:
3746
name: Upload to Codecov
@@ -54,3 +63,25 @@ jobs:
5463
files: coverage.out
5564
token: ${{ secrets.CODECOV_TOKEN }} # required
5665
verbose: true # optional (default = false)
66+
67+
sonarqube:
68+
name: SonarQube
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout repository
72+
uses: actions/checkout@v5
73+
with:
74+
fetch-depth: 0
75+
- name: Download coverage artifact
76+
uses: actions/download-artifact@v5
77+
with:
78+
name: coverage-report
79+
- name: SonarCloud Scan
80+
uses: SonarSource/sonarqube-scan-action@master
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
83+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
84+
with:
85+
args: >
86+
-Dsonar.externalIssuesReportPaths=sonar-issues.json
87+
-Dcommunity.rust.lcov.reportPaths=lcov.info

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=sir-gon_algorithm-exercises-rust
2+
sonar.organization=sir-gon
3+
4+
5+
# This is the name and version displayed in the SonarCloud UI.
6+
#sonar.projectName=algorithm-exercises-rust
7+
#sonar.projectVersion=1.0
8+
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
#sonar.sources=.
12+
13+
# Encoding of the source code. Default is default system encoding
14+
#sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)