try-specialize 0.1.2

Zero-cost specialization in generic context on stable Rust
Documentation
name: build

on:
  pull_request:
  push:
    branches:
      - master

defaults:
  run:
    shell: bash

env:
  CARGO_TERM_COLOR: always

jobs:
  cargo-fmt:
    name: Check formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install nightly --profile minimal --component rustfmt
      - run: cargo +nightly fmt --all -- --check

  cargo-clippy:
    name: Run linter
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust-toolchain:
          - stable
          - beta
          - nightly
          - 1.82.0
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal --component clippy
      - run: rustup default ${{ matrix.rust-toolchain }}
      - run: cargo clippy --all-targets -- -D warnings
      - run: cargo clippy --all-targets --no-default-features -- -D warnings
      - run: cargo clippy --all-targets --no-default-features --features "alloc" -- -D warnings
      - run: cargo clippy --all-targets --no-default-features --features "std" -- -D warnings
      - run: cargo clippy --all-targets --no-default-features --features "std,unreliable" -- -D warnings
      - run: cargo clippy --all-targets --all-features -- -D warnings

  cargo-test:
    name: Test sources
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust-toolchain:
          - stable
          - beta
          - nightly
          - 1.82.0
        cargo-flags:
          - ""
          - "--release"
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal
      - run: rustup default ${{ matrix.rust-toolchain }}
      - run: cargo test --all-targets ${{ matrix.cargo-flags }}
      - run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features
      - run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "alloc"
      - run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "std"
      - run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "std,unreliable"
      - run: cargo test --all-targets ${{ matrix.cargo-flags }} --all-features

  cargo-deny:
    name: Check licenses/bans/advisories/sources
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: rustup toolchain install stable --profile minimal
      - run: cargo install cargo-deny
      - run: cargo deny --workspace --all-features check