-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (41 loc) · 1.35 KB
/
sonar-cloud.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Sonar Cloud Analysis
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install Clippy
run: rustup component add clippy
- name: Install cargo-sonar and run Clippy
run: |
cargo install cargo-sonar
cargo clippy --all-features --all-targets --message-format=json -- --warn clippy::all > clippy.json
cargo sonar --clippy
- name: Build with coverage
run: |
RUSTFLAGS="-C instrument-coverage" cargo build
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.externalIssuesReportPaths=sonar-issues.json
-Dcommunity.rust.lcov.reportPaths=lcov.info