feat: github workflows

Run clippy, tests and cargo fmt checks at PR and push time.
This commit is contained in:
David Soria Parra 2025-02-21 20:28:48 +00:00
commit e56d91c4a9
No known key found for this signature in database
3 changed files with 89 additions and 0 deletions

33
.github/workflows/clippy.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Clippy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
clippy:
name: Lint with Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

23
.github/workflows/fmt.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: Format
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Check formatting
run: cargo fmt --all -- --check

33
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Run tests
run: cargo test --all-features