62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
on: [push, pull_request]
|
|
|
|
name: CI
|
|
|
|
jobs:
|
|
|
|
build-test:
|
|
name: Build and test
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- version: 1.60.0 # STABLE
|
|
clippy: true
|
|
- version: 1.57.0 # MSRV
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: Generate cache key
|
|
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
|
|
- name: cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
|
- name: Set default toolchain
|
|
run: rustup default ${{ matrix.rust.version }}
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Add clippy
|
|
if: ${{ matrix.rust.clippy }}
|
|
run: rustup component add clippy
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Build
|
|
run: cargo build
|
|
- name: Clippy
|
|
if: ${{ matrix.rust.clippy }}
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
- name: Test
|
|
run: cargo test
|
|
|
|
fmt:
|
|
name: Rust fmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Set default toolchain
|
|
run: rustup default nightly
|
|
- name: Set profile
|
|
run: rustup set profile minimal
|
|
- name: Add rustfmt
|
|
run: rustup component add rustfmt
|
|
- name: Update toolchain
|
|
run: rustup update
|
|
- name: Check fmt
|
|
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
|