Skip to content

Merge pull request #38 from sir-gon/renovate/github-codeql-action-4.x #159

Merge pull request #38 from sir-gon/renovate/github-codeql-action-4.x

Merge pull request #38 from sir-gon/renovate/github-codeql-action-4.x #159

Workflow file for this run

---
name: Rust Coverage
on: # yamllint disable-line rule:truthy
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
workflow_dispatch:
jobs:
coverage:
name: Rust Coverage
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: rustup update stable
- name: Install Clippy
run: rustup component add clippy
- name: Install cargo-llvm-cov
run: >
cargo install cargo-llvm-cov
- name: Install cargo-sonar and run Clippy
run: |
cargo install cargo-sonar
cargo clippy --message-format json > my-clippy-report.json
cargo sonar --clippy --clippy-path my-clippy-report.json
- name: Generate code coverage
run: >
cargo llvm-cov
--all-features
--workspace
--lcov
--output-path lcov.info
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
lcov.info
my-clippy-report.json
sonar-issues.json
codecov:
name: Upload to Codecov
runs-on: ubuntu-24.04
needs: coverage
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download coverage artifact
uses: actions/download-artifact@v5
with:
name: coverage-report
# yamllint disable rule:line-length
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
# yamllint enable rule:line-length
sonarqube:
name: SonarQube
runs-on: ubuntu-latest
needs: coverage
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download coverage artifact
uses: actions/download-artifact@v5
with:
name: coverage-report
# yamllint disable rule:line-length
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.externalIssuesReportPaths=sonar-issues.json
-Dsonar.rust.clippy.reportPaths=my-clippy-report.json
# yamllint enable rule:line-length