Skip to content

Instantly share code, notes, and snippets.

@domnikl
Last active May 27, 2024 13:44
Show Gist options
  • Save domnikl/ccb8d0b82056fbe5cf7f4f145ac7f44b to your computer and use it in GitHub Desktop.
Save domnikl/ccb8d0b82056fbe5cf7f4f145ac7f44b to your computer and use it in GitHub Desktop.
GitHub Action Workflow to build a Rust project with tests and clippy
name: main
on:
push:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: setup toolchain
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: cargo test
run: cargo test --all-features
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --all --all-features --tests -- -D warnings
@Kile
Copy link

Kile commented May 27, 2024

Thanks, very useful :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment