---
name: Sonar
"on":
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
CARGO_TERM_COLOR: always
jobs:
sonar:
name: SonarQube scan
runs-on: ubuntu-latest
timeout-minutes: 45
if: >-
github.event_name == 'push' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
fetch-depth: 0
persist-credentials: false
- name: Cache cargo downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: dl-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
dl-${{ runner.os }}-
- name: Install stable clippy
run: |
rustup toolchain install stable \
--profile minimal \
--component clippy
- name: Clippy report
run: cargo clippy --message-format=json > clippy-report.json
- name: SonarQube scan
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}