Skip to content

Refactor CI

Refactor CI #52

Workflow file for this run

name: Check and Test
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- version: 1.58.1
run-all: false
- version: 1.80.1
run-all: true
steps:
- uses: actions/checkout@v2
- name: Cache Cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.rust.version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.rust.version }}-cargo-
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
source $HOME/.cargo/env
rustup update ${{ matrix.rust.version }} --no-self-update
rustup default ${{ matrix.rust.version }}
rustup component add rustfmt
- name: Check lib
run: $HOME/.cargo/bin/cargo check --lib
- name: Check all
# We can't use --all-targets because it includes benches which requires nightly compiler
run: $HOME/.cargo/bin/cargo check --workspace --lib --bins --examples --tests
if: ${{ matrix.rust.run-all }}
- name: Clippy
# We can't use --all-targets because it includes benches which requires nightly compiler
run: $HOME/.cargo/bin/cargo clippy --workspace --lib --bins --examples --tests
if: ${{ matrix.rust.run-all }}
- name: Check Format
run: $HOME/.cargo/bin/cargo fmt --check
if: ${{ matrix.rust.run-all }}
- name: Test
run: $HOME/.cargo/bin/cargo test --workspace
if: ${{ matrix.rust.run-all }}
env:
RUST_BACKTRACE: 1