Skip to content

rust-sonarqube analyze #21

rust-sonarqube analyze

rust-sonarqube analyze #21

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/
name: rust-sonarqube analyze
on:
push:
branches: ["main"]
paths:
- "**/**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "50 23 * * *"
jobs:
rust-sonar-analyze:
name: Run rust-clippy analyzing
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy, rustfmt
- name: Install required cargo
run: cargo install cargo-sonar cargo-audit && cargo install --locked cargo-outdated;
- name: Run clippy
run: cargo clippy --message-format=json > clippy-report.json
- name: Run audit
run: cargo audit --json > audit-report.json
- name: Run outdated
run: cargo outdated --format json --depth 1 > outdated-report.json
- name: Make report
run: cargo sonar --clippy --audit --outdated --clippy-path clippy-report.json --audit-path audit-report.json --outdated-path outdated-report.json
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: sonar-report
path: sonar-issues.json
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_KEY }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}