builder_derive_more 0.1.0

Additional procedural macros for the builder pattern.
Documentation
name: Rust

on:
  push:
    branches:
      - main
  pull_request:
  release:
    types: [published]
  workflow_dispatch:

concurrency:
  group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  LIB_PACKAGE_NAME: builder_derive_more

jobs:
  rustfmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      ## cargo fmt
      - name: cargo fmt
        run: cargo fmt --all --check --verbose

  cargo:
    needs: rustfmt
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain:
          - "1.64" # Minimal supported Rust version (MSRV)
          - stable
          - beta
    steps:
      - uses: actions/checkout@v4
      - uses: Swatinem/rust-cache@v2
        with:
          save-if: ${{ github.event_name == 'push'}}
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}
          components: clippy

      ## cargo check
      - name: cargo check
        run: cargo check --workspace --all-targets --verbose
      - name: cargo check --no-default-features
        run: cargo check --workspace --all-targets --no-default-features --verbose
      - name: cargo check --all-features
        run: cargo check --workspace --all-targets --all-features --verbose

      ## cargo test
      - name: cargo test (default features)
        run: cargo test --workspace --all-targets --verbose
      - name: cargo test --no-default-features
        run: cargo test --workspace --all-targets --no-default-features --verbose
      - name: cargo test --all-features
        run: cargo test --workspace --all-targets --all-features --verbose

      ## cargo test --doc
      - name: cargo test --doc (default features)
        run: cargo test --workspace --doc --verbose
      - name: cargo test --doc --no-default-features
        run: cargo test --workspace --doc --no-default-features --verbose
      - name: cargo test --doc --all-features
        run: cargo test --workspace --doc --all-features --verbose

      ## cargo clippy
      - name: cargo clippy (stable only)
        if: ${{ matrix.toolchain == 'stable' }}
        run: cargo clippy --workspace --all-targets --all-features --no-deps --verbose -- --deny warnings

      ## cargo doc
      - name: doc --document-private-items (stable only)
        if: ${{ matrix.toolchain == 'stable' }}
        run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose

  cross:
    needs: cargo
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain:
          - stable
          - beta
        target:
          - aarch64-unknown-linux-gnu
    steps:
      - uses: actions/checkout@v4
      - uses: Swatinem/rust-cache@v2
        with:
          save-if: ${{ github.event_name == 'push'}}
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}
          targets: ${{ matrix.target }}

      ## Install cross
      - name: Install cross
        run: cargo install cross --locked

      ## cross check
      - name: cross check
        run: cross check --workspace --all-targets --target ${{ matrix.target }} --verbose
      - name: cross check --no-default-features
        run: cross check --workspace --all-targets --no-default-features --target ${{ matrix.target }} --verbose
      - name: cross check --all-features
        run: cross check --workspace --all-targets --all-features --target ${{ matrix.target }} --verbose

  miri:
    needs: cargo
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: Swatinem/rust-cache@v2
        with:
          save-if: ${{ github.event_name == 'push'}}
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: miri, rust-src

      - name: cargo miri test (default features)
        run: cargo miri test --workspace --verbose
      - name: cargo miri test --no-default-features
        run: cargo miri test --workspace --no-default-features --verbose
      - name: cargo miri test --all-features
        run: cargo miri test --workspace --all-features --verbose

  deny:
    needs: cargo
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v1
        with:
          command: check bans licenses sources

  publish:
    if: ${{ github.event_name == 'release' }}
    needs:
      - cargo
      - cross
      - miri
      - deny
    runs-on: ubuntu-latest
    env:
      CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable

      ## Publish to crates.io
      - name: Publish crate (library)
        if: ${{ env.CARGO_REGISTRY_TOKEN != '' }}
        run: cargo publish --no-verify --package ${{ env.LIB_PACKAGE_NAME }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

  codecov:
    needs: cargo
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: Swatinem/rust-cache@v2
        with:
          save-if: ${{ github.event_name == 'push'}}
      - uses: dtolnay/rust-toolchain@stable
      - uses: taiki-e/install-action@cargo-llvm-cov

      ## Generate coverage with cargo llvm-cov
      - name: Generate coverage
        run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info

      ## Upload coverage to codecov.io
      - name: Upload coverage
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: lcov.info
          fail_ci_if_error: true