Update rust.yml

This commit is contained in:
Alexey
2025-12-31 05:59:20 +03:00
committed by GitHub
parent 153cb7f3a3
commit 06f34e55cd

View File

@@ -2,21 +2,55 @@ name: Rust
on:
push:
branches: [ "main" ]
branches: [ main ]
pull_request:
branches: [ "main" ]
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
- name: Checkout repository
uses: actions/checkout@v4
- name: Install latest stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry & build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check Format
run: cargo fmt -- --check
- name: Build Release
run: cargo build --release --verbose
- name: Run Tests
run: cargo test --verbose
- name: Run benchmarks (if any)
if: always()
run: cargo bench || true
- name: Check for unused dependencies
run: cargo udeps || true
# - uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: 1.76 # укажи свою MSRV из Cargo.toml
# - run: cargo check --all-targets