name: Rust
on:
push:
branches: [latest]
pull_request:
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
test:
name: Test stable on ${{ matrix.os }}
needs: [fmt]
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macOS-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets --all-features
clippy:
name: Check clippy
needs: [fmt, test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --lib --tests --all-features --all-targets --workspace -- -D warnings
docs:
name: Build docs
needs: [fmt, test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Check documentation
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
with:
command: doc
args: --no-deps --document-private-items --workspace
msrv:
name: Verify MSRV
needs: [fmt, test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install cargo msrv
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-msrv
- name: Run cargo msrv
run: cargo msrv verify