on: [push, pull_request]
name: Rust CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all
test:
name: Test Suite
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all
fmt:
name: Rustfmt
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
docs:
name: Docs
needs: [test, fmt, clippy]
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features
- run: |
cd target/doc
git init
git add .
git -c user.name='ci' -c user.email='ci' commit -m 'Deploy documentation'
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
publish:
name: Publish
needs: [test, fmt, clippy]
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: publish