Skip to content

Commit fb07d3b

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

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.github/workflows/rust-coverage.yml

Lines changed: 28 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,21 @@ 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+
- uses: actions/checkout@v4
72+
with:
73+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
74+
75+
- name: SonarCloud Scan
76+
uses: SonarSource/sonarqube-scan-action@master
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
79+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
80+
with:
81+
args: >
82+
-Dsonar.externalIssuesReportPaths=sonar-issues.json
83+
-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)