107 lines
2.3 KiB
YAML
107 lines
2.3 KiB
YAML
|
name: CI
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches: [main]
|
||
|
pull_request:
|
||
|
branches: [main]
|
||
|
|
||
|
env:
|
||
|
CARGO_TERM_COLOR: always
|
||
|
|
||
|
jobs:
|
||
|
tests:
|
||
|
strategy:
|
||
|
fail-fast: false
|
||
|
matrix:
|
||
|
os:
|
||
|
- ubuntu-latest
|
||
|
- macos-latest
|
||
|
- windows-latest
|
||
|
rust:
|
||
|
- 1.51.0 # msrv
|
||
|
- stable
|
||
|
- beta
|
||
|
- nightly
|
||
|
runs-on: ${{ matrix.os }}
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
|
||
|
- name: Restore cargo cache
|
||
|
uses: actions/cache@v2.1.7
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cargo/registry
|
||
|
~/.cargo/git
|
||
|
target
|
||
|
key: ${{ matrix.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
|
||
|
|
||
|
- name: Toolchain
|
||
|
uses: actions-rs/toolchain@v1
|
||
|
with:
|
||
|
profile: minimal
|
||
|
toolchain: ${{ matrix.rust }}
|
||
|
override: true
|
||
|
|
||
|
- name: Run tests
|
||
|
uses: actions-rs/cargo@v1
|
||
|
with:
|
||
|
command: test
|
||
|
args: --all-features --verbose
|
||
|
|
||
|
clippy:
|
||
|
name: clippy (ubuntu-latest, stable)
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
|
||
|
- name: Toolchain
|
||
|
uses: actions-rs/toolchain@v1
|
||
|
with:
|
||
|
toolchain: stable
|
||
|
override: true
|
||
|
components: clippy
|
||
|
|
||
|
- name: Restore cargo cache
|
||
|
uses: actions/cache@v2.1.7
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cargo/registry
|
||
|
~/.cargo/git
|
||
|
target
|
||
|
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
|
||
|
|
||
|
- name: Check clippy
|
||
|
uses: actions-rs/cargo@v1
|
||
|
with:
|
||
|
command: clippy
|
||
|
args: -- -D warnings
|
||
|
|
||
|
fmt:
|
||
|
name: fmt (ubuntu-latest, stable)
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
|
||
|
- name: Toolchain
|
||
|
uses: actions-rs/toolchain@v1
|
||
|
with:
|
||
|
toolchain: stable
|
||
|
override: true
|
||
|
components: rustfmt
|
||
|
|
||
|
- name: Restore cargo cache
|
||
|
uses: actions/cache@v2.1.7
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cargo/registry
|
||
|
~/.cargo/git
|
||
|
target
|
||
|
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
|
||
|
|
||
|
- name: Check format
|
||
|
uses: actions-rs/cargo@v1
|
||
|
with:
|
||
|
command: fmt
|
||
|
args: --all -- --check
|