name: CI
on:
push:
branches:
- main
- 'feature/*'
- 'bugfix/*'
- 'release/*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1 with:
toolchain: stable
override: true
target: x86_64-unknown-linux-gnu
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-git-
- name: Build with cargo
run: cargo build --verbose
- name: Run Clippy (Linting)
run: cargo clippy -- -D warnings
- name: Check formatting
run: cargo fmt -- --check
- name: Test with cargo
run: cargo test --verbose