feat(ci): Add combined format and Clippy check with Redis integration… #4
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", "develop" ] | |
pull_request: | |
branches: [ "main", "develop" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run tests | |
run: cargo test --all-targets --all-features | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check formatting | |
run: | | |
cargo fmt --check | |
- name: Run Clippy | |
if: always() | |
run: cargo clippy --all-targets --all-features -- -D warnings |