name: CI
on:
push:
branches:
- main
paths-ignore:
- 'README'
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- 'README'
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
nightly: nightly
stable: stable
jobs:
rustfmt:
name: rustfmt
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: clippy
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly --no-self-update && rustup default nightly && rustup component add clippy
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
run: cargo hack clippy --each-feature --exclude-all-features
build:
name: build
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install Rust
run: rustup update nightly --no-self-update && rustup default nightly
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Cache ~/.cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ matrix.os }}-coverage-dotcargo
- name: Run build
run: cargo hack build --feature-powerset --group-features debugger_visualizer,specialization,drain_filter,drain_keep_rest,may_dangle,union