cache-kit 0.9.0

A type-safe, fully generic, production-ready caching framework for Rust
Documentation
name: CI - Main Library

on:
  pull_request:
    branches: [main, develop]

env:
  RUST_BACKTRACE: 1

jobs:
  checks:
    name: Checks (Format + Lint)
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Format and Clippy
        run: make dev

  test-inmemory:
    name: Test (InMemory Feature)
    runs-on: ubuntu-latest
    needs: checks

    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Run tests with inmemory feature
        run: cargo test --features inmemory

  test-all-features:
    name: Test (All Features)
    runs-on: ubuntu-latest
    needs: checks
    env:
      TEST_REDIS_URL: redis://localhost:6379
      TEST_MEMCACHED_URL: localhost:11211

    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Install docker-compose
        run: |
          sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
          sudo chmod +x /usr/local/bin/docker-compose
          docker-compose --version

      - name: Start docker containers
        run: make up

      - name: Run tests with all features
        run: make test FEATURES="--all-features"

      - name: Install LLVM tools
        run: rustup component add llvm-tools-preview

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Install lcov merge tool
        run: sudo apt-get update && sudo apt-get install -y lcov

      - name: Generate coverage
        run: |
          # Run memcached integration tests with single thread (matching make test behavior)
          echo "→ Running memcached integration tests with coverage (single-threaded)..."
          cargo llvm-cov \
            --test memcached_integration_test \
            --all-features \
            --lcov \
            --output-path lcov.memcached.info \
            -- --test-threads=1

          # Run all other tests with coverage
          echo "→ Running all other tests with coverage..."
          cargo llvm-cov \
            --all-features \
            --lcov \
            --output-path lcov.others.info \
            --lib \
            --bins \
            --test integration_test \
            --test integration_serialization \
            --test proptest_serialization \
            --test redis_integration_test \
            --test golden_blobs \
            --test golden_blob_generator

          # Merge coverage files
          echo "→ Merging coverage files..."
          lcov -a lcov.memcached.info -a lcov.others.info -o lcov.info

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v5
        with:
          files: lcov.info
          fail_ci_if_error: false
          token: ${{ secrets.CODECOV_TOKEN }}