diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 79251f51..6a074f35 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,22 @@ -name: Rust - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - +name: rust +on: [push, pull_request] jobs: build: - - runs-on: ubuntu-latest - + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v2 + - run: rustup update stable + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - run: rustup component add rustfmt + - run: rustup component add clippy + - run: cargo build --all-features + - run: cargo test --all-features + - run: cargo fmt --all -- --check + - run: cargo clippy --all-features --all-targets -- --deny warnings