sonic-server 1.5.0

Fast, lightweight and schema-less search backend.
on:
  push:
    branches: [master]
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]

name: Test and Build

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest]
        rust-toolchain: [stable]
      # Do not cancel all jobs on failure.
      fail-fast: false

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Cache build artifacts
        id: cache-cargo
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: test-${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}

      - name: Cache integration artifacts
        id: cache-integration
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: |
            tests/integration/runner/node_modules
          key: test-${{ runner.os }}-integration-${{ matrix.rust-toolchain }}

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master on 2026-05-14
        with:
          toolchain: ${{ matrix.rust-toolchain }}
          components: rustfmt

      - name: Verify versions
        run: |-
          rustc --version
          rustup --version 2>/dev/null
          cargo --version
          node --version
          npm --version

      - name: Install cargo-binstall
        uses: cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1

      - name: Install cargo-deny
        run: cargo binstall cargo-deny@0.19.6 --no-confirm

      # NOTE: Run `cargo deny` first to reduce the risk of supply-chain attack.
      - name: Lint dependency graph
        run: cargo deny check --show-stats

      - name: Check code style
        run: cargo fmt --check

      - name: Lint code
        run: cargo clippy

      - name: Build code
        run: cargo build --locked

      - name: Test code
        run: cargo test --locked

      - name: Run integration tests
        run: tests/integration/scripts/run.sh