chryso 0.0.2

Chryso is a Calcite-style SQL parser + optimizer engine in Rust.
Documentation
name: ci

on:
  push:
    branches: 
      - main

jobs:
  velox-full:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest]
    steps:
      - name: Checkout (with submodules)
        uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Setup Rust
        uses: dtolnay/rust-toolchain@nightly
        with:
          toolchain: nightly-2026-01-19
      - name: Cache cargo
        uses: Swatinem/rust-cache@v2
      - name: Cache ccache
        uses: actions/cache@v4
        with:
          path: ~/.ccache
          key: ${{ runner.os }}-ccache-velox-${{ hashFiles('ffi/velox/velox/**', 'ffi/velox/CMakeLists.txt') }}
          restore-keys: |
            ${{ runner.os }}-ccache-velox-
      - name: Restore velox build dir
        id: velox-build-cache
        uses: actions/cache/restore@v4
        with:
          path: ffi/velox/build
          key: ${{ runner.os }}-velox-build-${{ hashFiles('ffi/velox/velox/**', 'ffi/velox/CMakeLists.txt') }}
          restore-keys: |
            ${{ runner.os }}-velox-build-
      - name: Restore velox deps cache
        id: velox-deps-cache
        uses: actions/cache/restore@v4
        with:
          path: |
            deps-install
            deps-download
          key: ${{ runner.os }}-velox-deps-${{ hashFiles('ffi/velox/velox/**', 'ffi/velox/CMakeLists.txt') }}
          restore-keys: |
            ${{ runner.os }}-velox-deps-
      - name: Install Velox dependencies (linux)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y cmake ninja-build build-essential ccache
          ./ffi/velox/velox/scripts/setup-ubuntu.sh
      - name: Install Velox dependencies (macos)
        if: runner.os == 'macOS'
        run: |
          brew update
          brew install m4
          echo "/opt/homebrew/opt/m4/bin" >> "$GITHUB_PATH"
          python3 - <<'PY'
          from pathlib import Path

          path = Path("ffi/velox/velox/scripts/setup-macos.sh")
          text = path.read_text()
          old = 'OS_CXXFLAGS=" -isystem $(brew --prefix)/include "'
          new = 'OS_CXXFLAGS=${OS_CXXFLAGS-" -isystem $(brew --prefix)/include "}'
          if old not in text:
              raise SystemExit("OS_CXXFLAGS line not found")
          path.write_text(text.replace(old, new, 1))
          PY
          export INSTALL_PREFIX="${GITHUB_WORKSPACE}/deps-install"
          export DEPENDENCY_DIR="${GITHUB_WORKSPACE}/deps-download"
          export OS_CXXFLAGS=""
          source ffi/velox/velox/scripts/setup-macos.sh
          install_build_prerequisites
          install_velox_deps_from_brew
          install_faiss_deps
          install_double_conversion
          install_arrow
          install_glog
          echo "${INSTALL_PREFIX}/bin" >> "$GITHUB_PATH"
      - name: Save velox deps cache
        if: ${{ always() }}
        uses: actions/cache/save@v4
        with:
          path: |
            deps-install
            deps-download
          key: ${{ runner.os }}-velox-deps-${{ hashFiles('ffi/velox/velox/**', 'ffi/velox/CMakeLists.txt') }}
      - name: Build Velox FFI (submodule + Arrow)
        run: |
          cmake -S ffi/velox -B ffi/velox/build \
            -DCHRYSO_VELOX_USE_SUBMODULE=ON \
            -DCHRYSO_VELOX_USE_ARROW=ON \
            -DCHRYSO_ARROW_STRICT_VERSION=OFF \
            -DCHRYSO_VELOX_BUILD_TESTS=ON
          cmake --build ffi/velox/build -j 2
        env:
          CMAKE_PREFIX_PATH: ${{ github.workspace }}/deps-install
          CMAKE_IGNORE_PREFIX_PATH: /opt/homebrew
          OS_CXXFLAGS: ""
      - name: Save velox build dir
        if: ${{ always() }}
        uses: actions/cache/save@v4
        with:
          path: ffi/velox/build
          key: ${{ runner.os }}-velox-build-${{ hashFiles('ffi/velox/velox/**', 'ffi/velox/CMakeLists.txt') }}
      - name: Test Velox FFI (C++)
        run: ctest --test-dir ffi/velox/build -R chryso_velox_ffi_escape_test
      - name: Build velox adapter
        env:
          CHRYSO_VELOX_FFI_DIR: ${{ github.workspace }}/ffi/velox/build
        run: cargo build -p chryso-adapter-velox --features velox-ffi
      - name: Test velox adapter (macos)
        if: runner.os == 'macOS'
        env:
          CHRYSO_VELOX_FFI_DIR: ${{ github.workspace }}/ffi/velox/build
          DYLD_LIBRARY_PATH: ${{ github.workspace }}/ffi/velox/build
        run: cargo test -p chryso-adapter-velox --features velox-ffi
      - name: Run velox demo (linux)
        if: runner.os == 'Linux'
        env:
          CHRYSO_VELOX_FFI_DIR: ${{ github.workspace }}/ffi/velox/build
          LD_LIBRARY_PATH: ${{ github.workspace }}/ffi/velox/build
        run: cargo run --example velox_demo --features velox
      - name: Run velox demo (macos)
        if: runner.os == 'macOS'
        env:
          CHRYSO_VELOX_FFI_DIR: ${{ github.workspace }}/ffi/velox/build
          DYLD_LIBRARY_PATH: ${{ github.workspace }}/ffi/velox/build
        run: cargo run --example velox_demo --features velox