test-tag 0.1.6

The #[tag] attribute for convenient tagging/grouping of #[test] tests.
Documentation
# Copyright (C) 2024-2026 Daniel Mueller <deso@posteo.net>
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

name: Test

on:
  pull_request:
  push:
  workflow_call:

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  # Build without debug information enabled to decrease compilation time
  # and binary sizes in CI. This option is assumed to only have marginal
  # effects on the generated code, likely only in terms of section
  # arrangement. See
  # https://doc.rust-lang.org/cargo/reference/environment-variables.html
  # https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo
  RUSTFLAGS: '-D warnings -C debuginfo=0'

jobs:
  build:
    name: Build [${{ matrix.rust }}, ${{ matrix.profile }}]
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [stable]
        profile: [dev, release]
    steps:
    - uses: actions/checkout@v6
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.rust }}
    - name: Build
      run: cargo build --profile=${{ matrix.profile }}
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    # At this time tests require a nightly toolchain.
    - uses: dtolnay/rust-toolchain@nightly
    - name: Test
      run: cargo test
  clippy:
    name: Lint with clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo clippy --workspace --no-deps --all-targets -- -A unknown_lints -A deprecated -D warnings
  rustfmt:
    name: Check code formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo +nightly fmt --all -- --check
  rustdoc:
    name: Generate documentation
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: '--cfg docsrs -D warnings'
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo doc --workspace --no-deps --document-private-items