feoxdb 0.5.3

Iron-oxide fast embedded database - nanosecond-level key-value storage
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta, nightly]
    steps:
      - uses: actions/checkout@v5

      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
          components: rustfmt, clippy
      
      - name: Cache cargo registry
        uses: actions/cache@v5
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Cache cargo index
        uses: actions/cache@v5
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Cache cargo build
        uses: actions/cache@v5
        with:
          path: target
          key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
      
      - name: Check formatting
        run: cargo fmt -- --check
        if: matrix.rust == 'stable'

      - name: Run clippy (Unix)
        run: cargo clippy --all-features -- -D warnings
        if: matrix.rust == 'stable' && matrix.os != 'windows-latest'

      - name: Run clippy (Windows)
        run: cargo clippy --no-default-features --features "persistent" -- -D warnings
        if: matrix.rust == 'stable' && matrix.os == 'windows-latest'

      - name: Build (Unix)
        if: matrix.os != 'windows-latest'
        run: cargo build --verbose --all-features

      - name: Build (Windows)
        if: matrix.os == 'windows-latest'
        run: cargo build --verbose --no-default-features --features "persistent"

      - name: Run tests (Unix)
        if: matrix.os != 'windows-latest'
        run: cargo test --verbose --all-features
        timeout-minutes: 10

      - name: Run tests (Windows)
        if: matrix.os == 'windows-latest'
        run: cargo test --verbose --no-default-features --features "persistent"
        timeout-minutes: 10

      - name: Build examples (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          cargo build --example deterministic_test --release
          cargo build --example persistence_test --release

      - name: Build examples (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          cargo build --example deterministic_test --release --no-default-features --features "persistent"
          cargo build --example persistence_test --release --no-default-features --features "persistent"
      
      - name: Run deterministic test
        run: ./target/release/examples/deterministic_test 1000 10
        if: matrix.os != 'windows-latest'
        timeout-minutes: 5
      
      - name: Run deterministic test (Windows)
        run: ./target/release/examples/deterministic_test.exe 1000 10
        if: matrix.os == 'windows-latest'
        timeout-minutes: 5

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview

      - name: Install cargo-llvm-cov
        run: cargo install cargo-llvm-cov || true

      - name: Generate code coverage
        run: |
          cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
          cargo llvm-cov --all-features --workspace --html
        timeout-minutes: 10
      
      - name: Upload coverage artifact
        uses: actions/upload-artifact@v6
        with:
          name: coverage-report
          path: target/llvm-cov/html/

  security-audit:
    name: Security Audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable

      - name: Install cargo-audit
        run: cargo install cargo-audit || true

      - name: Run security audit
        run: cargo audit

  docs:
    name: Documentation
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pages: write
      id-token: write
    steps:
      - uses: actions/checkout@v5

      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable

      - name: Build documentation
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings
      
      - name: Add redirect index.html
        run: |
          echo '<meta http-equiv="refresh" content="0; url=feoxdb/index.html">' > target/doc/index.html
      
      - name: Upload docs artifact
        uses: actions/upload-artifact@v6
        with:
          name: docs
          path: target/doc/