trait-kit 0.4.2

Module Standard Interface and Capability Management Center — A lightweight Rust library that provides a standard interface for module definition and Kit capability management.
Documentation
# trait-kit CI 质量门禁:fmt / clippy / test / security / docs
name: trait-kit CI

on:
  push:
    branches: [main, master]
  pull_request:

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-D warnings"
  CARGO_NET_RETRY: "5"
  CARGO_HTTP_TIMEOUT: "120"

jobs:
  format:
    name: cargo fmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - uses: swatinem/rust-cache@v2
      - run: cargo fmt --all -- --check

  clippy:
    name: cargo clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: swatinem/rust-cache@v2
      - name: Install protoc
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - run: cargo clippy --all-targets --all-features -- -D warnings

  test:
    name: cargo test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
      - uses: swatinem/rust-cache@v2
      - name: Install protoc
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - run: cargo test --all-features --lib

  # 跨平台构建验证 — 确保 apple/windows/linux 平台都能编译
  cross-platform:
    name: Build (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
      - uses: swatinem/rust-cache@v2
        with:
          shared-key: cross-${{ runner.os }}
      - name: Install protoc (Linux)
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - name: Install protoc (macOS)
        if: runner.os == 'macOS'
        run: brew install protobuf
      - name: Install protoc (Windows)
        if: runner.os == 'Windows'
        run: choco install protoc -y
      - name: Build (all features)
        run: cargo build --all-features --lib
      - name: Build (no default features)
        run: cargo build --no-default-features --lib

  security:
    name: cargo deny
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
      - uses: swatinem/rust-cache@v2
      - run: cargo install cargo-deny
      - run: cargo deny check

  docs:
    name: cargo doc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.1
      - uses: dtolnay/rust-toolchain@stable
      - uses: swatinem/rust-cache@v2
      - name: Install protoc
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - run: cargo doc --no-deps --all-features