name: ci
on:
pull_request:
push:
branches: [master]
tags: ['**']
env:
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTFLAGS: --deny warnings -Cdebuginfo=0
RUSTDOCFLAGS: --deny warnings
jobs:
rust-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
- run: cargo clippy --workspace
- run: cargo fmt --all -- --check
rust-test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain != 'stable' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
include:
- { os: ubuntu-latest, toolchain: beta }
- { os: ubuntu-latest, toolchain: nightly }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
- run: cargo +${{ matrix.toolchain }} build --workspace
- run: cargo +${{ matrix.toolchain }} test --workspace --no-run
- run: cargo +${{ matrix.toolchain }} test --workspace
rust-publish-crate:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- rust-lint
- rust-test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- run: cargo publish --token ${{ secrets.CRATES_TOKEN }})