name: Rust
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
lint:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- name: Lint code
run: cargo clippy --all-features --no-deps -- -D clippy::all
release:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: [build, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: publish crate
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish