allow permissions for sarif upload #10
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: Rust | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
permissions: | |
contents: read | |
security-events: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Apply caching | |
uses: swatinem/rust-cache@v2 | |
- name: Install required cargo | |
run: cargo install clippy-sarif sarif-fmt | |
- name: Build with cargo | |
run: cargo build --verbose | |
- name: Run tests with cargo | |
run: cargo test --verbose | |
- name: Check format | |
run: cargo fmt --check | |
- name: Perform linting | |
run: | |
cargo clippy | |
--all-features | |
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
continue-on-error: true | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
- name: Perform audit | |
run: cargo audit |