openlark 0.15.0

飞书开放平台 Rust SDK - 企业级高覆盖率 API 客户端,极简依赖一条命令
Documentation
name: Feature Matrix Testing

on:
  pull_request:
    branches: [main]
  push:
    branches: [main]
  schedule:
    # Run feature matrix testing every 3 days at 00:00 UTC
    - cron: '0 0 */3 * *'

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always
  CARGO_TOOLCHAIN: stable
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
  # Test core feature combinations
  feature-combinations:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        features:
          # Individual features (from root Cargo.toml)
          - "auth"
          - "docs"
          - "communication"
          - "hr"
          - "ai"
          - "meeting"
          - "cardkit"
          - "security"
          - "workflow"
          - "application"
          - "websocket"
          - "otel"
          - "platform"
          - "analytics"
          - "user"
          - "docs-base"
          - "docs-bitable"

          # Important combinations
          - "communication,auth"
          - "docs,auth"
          - "communication,docs"
          - "communication,websocket"
          - "hr,communication"
          - "docs,docs-base,docs-bitable"

          # Recommended feature sets
          - "essential"

          # Edge cases
          - "" # no features
          
    steps:
      - uses: actions/checkout@v4
        
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: ${{ env.CARGO_TOOLCHAIN }}

      - name: Cache Cargo build files
        uses: Swatinem/rust-cache@v2

      - name: Install Protoc
        uses: arduino/setup-protoc@v3
        with:
          version: 23.4
          repo-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Build with feature combination
        run: |
          echo "Testing feature combination: ${{ matrix.features }}"
          if [ -z "${{ matrix.features }}" ]; then
            echo "Building with no features (minimal build)"
            timeout 15m cargo build --no-default-features
          else
            echo "Building with features: ${{ matrix.features }}"
            timeout 15m cargo build --no-default-features --features "${{ matrix.features }}"
          fi

      - name: Test with feature combination
        run: |
          if [ -z "${{ matrix.features }}" ]; then
            echo "Testing with no features"
            timeout 10m cargo test --no-default-features --lib
          else
            echo "Testing with features: ${{ matrix.features }}"
            timeout 10m cargo test --no-default-features --features "${{ matrix.features }}" --lib
          fi

  # Advanced feature matrix testing using cargo-hack
  cargo-hack-testing:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
        
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: ${{ env.CARGO_TOOLCHAIN }}

      - name: Install cargo-hack
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-hack

      - name: Cache Cargo build files
        uses: Swatinem/rust-cache@v2

      - name: Install Protoc
        uses: arduino/setup-protoc@v3
        with:
          version: 23.4
          repo-token: ${{ secrets.GITHUB_TOKEN }}

      # Test each feature individually
      - name: Test each feature individually
        run: |
          echo "## Feature Testing Report" >> $GITHUB_STEP_SUMMARY
          echo "" >> $GITHUB_STEP_SUMMARY

          # Test each feature individually (excluding websocket due to heavy dependencies)
          timeout 30m cargo hack test --each-feature --exclude-features websocket --lib \
            || echo "❌ Some individual feature tests failed" >> $GITHUB_STEP_SUMMARY

      # Test feature combinations that are likely to be used together
      - name: Test core feature combinations
        run: |
          echo "### Core Feature Combinations" >> $GITHUB_STEP_SUMMARY

          # Test combinations of core features
          CORE_FEATURES="auth,docs,communication,hr,ai,websocket"
          echo "Testing core features: $CORE_FEATURES" >> $GITHUB_STEP_SUMMARY

          if timeout 20m cargo hack test --feature-powerset --depth 2 \
            --features "$CORE_FEATURES" --lib; then
            echo "✅ Core feature combinations passed" >> $GITHUB_STEP_SUMMARY
          else
            echo "❌ Some core feature combinations failed" >> $GITHUB_STEP_SUMMARY
          fi