name: Rust
on:
push:
branches: [main]
pull_request:
env:
RUSTFLAGS: -Dwarnings -Dclippy::all -Dclippy::pedantic
jobs:
complete:
if: always()
needs: [fmt, build-and-test, docs, publish-dry-run]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: make fmt
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: rustup install nightly
- run: rustup default stable
- uses: stellar/binaries@v17
with:
name: cargo-hack
version: 0.5.28
- uses: stellar/binaries@v17
with:
name: cargo-fuzz
version: 0.11.2
- run: make build
- run: make test
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: rustup install nightly
- run: rustup default stable
- uses: stellar/binaries@v17
with:
name: cargo-hack
version: 0.5.28
- run: make doc
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- uses: stellar/binaries@v17
with:
name: cargo-readme
version: 3.3.1
- run: make readme
- run: git add -N . && git diff HEAD --exit-code
publish-dry-run:
if: startsWith(github.head_ref, 'release/')
uses: stellar/actions/.github/workflows/rust-publish-dry-run.yml@main