name: Rust
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["*"]
types:
- opened
- reopened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
lints:
runs-on: ubuntu-latest
container: ghcr.io/mzaniolo/rust:latest
strategy:
matrix:
features: ["", "native_tls", "rustls"]
steps:
- uses: actions/checkout@v4
- name: Rustfmt
shell: bash
run: cargo +nightly fmt -- --check
- name: Clippy
shell: bash
run: |
if [ -n "${{ matrix.features }}" ]; then
cargo clippy --workspace --all-targets --features "${{ matrix.features }}" -- -D warnings
else
cargo clippy --workspace --all-targets -- -D warnings
fi
- name: Udeps
if: matrix.features == ''
shell: bash
run: cargo +nightly udeps
- name: Typos
if: matrix.features == ''
uses: crate-ci/typos@v1.39.2
tests:
runs-on: ubuntu-latest
container: ghcr.io/mzaniolo/rust:latest
strategy:
matrix:
features: ["", "native_tls", "rustls"]
steps:
- uses: actions/checkout@v4
- name: Test
shell: bash
run: |
if [ -n "${{ matrix.features }}" ]; then
cargo nextest --profile ci run --workspace --features "${{ matrix.features }}"
else
cargo nextest --profile ci run --workspace
fi