Skip to content

Add github actions to check Rust code #4

Add github actions to check Rust code

Add github actions to check Rust code #4

Workflow file for this run

name: Rust
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup protoc
uses: arduino/setup-protoc@v1.1.2
- uses: actions-rs/cargo@v1
with:
command: check
args: --all
lints:
name: clippy and fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: clippy,rustfmt
- name: Run cargo fmt
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings