Skip to content

ci: change rustup and cache actions #84

ci: change rustup and cache actions

ci: change rustup and cache actions #84

Workflow file for this run

name: tests
on:
push:
branches:
- 'main'
- "ci"
pull_request:
branches:
- 'main'
- 'dev'
env:
RUST_BACKTRACE: 1
jobs:
tests:
strategy:
fail-fast: false
matrix:
# minimum supported rust version
rust: [1.61.0, stable]
on:
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
runs-on: ${{ matrix.on.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.on.target }}
- name: Generate lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build tests
run: cargo test --no-run --locked --all-features
- name: Run tests
run: cargo test --locked --all-features
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run rustfmt
run: cargo fmt -- --check
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: cargo doc
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings
run: cargo doc --no-deps --all-features --document-private-items
clippy:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [default, cli-error, error, report]
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Generate lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all --examples --tests -- -D warnings --no-default-features --features ${{ matrix.feature }}