Merge pull request #27 from guibranco/dependabot/github_actions/pasca… #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --message-format json > my-clippy-report.json | |
cargo sonar --issues clippy --clippy-path my-clippy-report.json | |
- 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 | |