name: CI
on: [push]
env:
CARGO_TERM_COLOR: always
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-cache-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}-
restore-keys: |
${{ runner.os }}-cargo-cache-${{ steps.toolchain.outputs.rustc_hash }}-
- name: Clippy
run: cargo clippy --tests --examples --workspace -- -D warnings -D clippy::todo -D clippy::dbg_macro -D clippy::unimplemented
- name: Build
run: cargo build --verbose --all --examples
- name: Run tests
run: cargo test --verbose --all --examples
- name: Publish (dry run)
run: cargo publish --dry-run
if: github.ref != 'refs/heads/master'
- name: Publish on crates.io
run: |
cargo login ${{ secrets.CRATES_IO_TOKEN }}
cargo publish
if: github.ref == 'refs/heads/master'