name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/checkout@v2
- name: Ready cache
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v1
id: cache
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Install cargo-cache
uses: actions-rs/install@v0.1
if: steps.cache.outputs.cache-hit != 'true'
with:
crate: cargo-cache
use-tool-cache: true
- name: Cleanup cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache -a