ruvector/.github/workflows/postgres-extension-ci.yml
rUv 48eac863c2 fix(postgres): Remove pg18 feature (requires pgrx 0.15.0+)
PostgreSQL 18 support requires pgrx 0.15.0 or later, but we're on
pgrx 0.12.x. Remove pg18 feature flag for now and revert to PG17
as the latest supported version.

Changes:
- Remove pg18 feature from Cargo.toml (pgrx 0.12 incompatible)
- Update CI workflow matrix to test PG14-17 only
- Update Dockerfile default to PG17
- Add comments noting PG18 planned for future pgrx upgrade

PostgreSQL 18 support will be added when upgrading to pgrx 0.15.0+
in a future major release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 17:35:52 +00:00

294 lines
8.7 KiB
YAML

name: PostgreSQL Extension CI
on:
push:
branches: [main, develop, "claude/**"]
paths:
- 'crates/ruvector-postgres/**'
- '.github/workflows/postgres-extension-ci.yml'
pull_request:
branches: [main, develop]
paths:
- 'crates/ruvector-postgres/**'
- '.github/workflows/postgres-extension-ci.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Build and test matrix for multiple PostgreSQL versions
test:
name: Test PostgreSQL ${{ matrix.pg_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
pg_version: [14, 15, 16, 17]
rust: [stable]
include:
# Test on macOS for pg16 and pg17
- os: macos-latest
pg_version: 16
rust: stable
- os: macos-latest
pg_version: 17
rust: stable
services:
postgres:
image: postgres:${{ matrix.pg_version }}
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Install PostgreSQL (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y postgresql-${{ matrix.pg_version }} postgresql-server-dev-${{ matrix.pg_version }}
echo "/usr/lib/postgresql/${{ matrix.pg_version }}/bin" >> $GITHUB_PATH
- name: Install PostgreSQL (macOS)
if: runner.os == 'macOS'
run: |
brew install postgresql@${{ matrix.pg_version }}
echo "/opt/homebrew/opt/postgresql@${{ matrix.pg_version }}/bin" >> $GITHUB_PATH
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.pg_version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-${{ matrix.pg_version }}-
- name: Install cargo-pgrx
run: cargo install cargo-pgrx --version 0.12.0 --locked
- name: Initialize pgrx
run: cargo pgrx init --pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config
working-directory: crates/ruvector-postgres
- name: Check code formatting
run: cargo fmt --all -- --check
working-directory: crates/ruvector-postgres
- name: Run clippy
run: cargo clippy --features pg${{ matrix.pg_version }} -- -D warnings
working-directory: crates/ruvector-postgres
- name: Build extension
run: cargo build --features pg${{ matrix.pg_version }} --release
working-directory: crates/ruvector-postgres
- name: Run tests
run: cargo pgrx test pg${{ matrix.pg_version }}
working-directory: crates/ruvector-postgres
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
# Test with all features enabled
test-all-features:
name: Test All Features (PostgreSQL 16)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql-16 postgresql-server-dev-16
- name: Install cargo-pgrx
run: cargo install cargo-pgrx --version 0.12.0 --locked
- name: Initialize pgrx
run: cargo pgrx init --pg16=/usr/lib/postgresql/16/bin/pg_config
working-directory: crates/ruvector-postgres
- name: Build with all features
run: |
cargo build --features pg16,index-all,quant-all,hybrid-search,filtered-search --release
working-directory: crates/ruvector-postgres
- name: Test with all features
run: |
cargo pgrx test pg16 --features index-all,quant-all,hybrid-search,filtered-search
working-directory: crates/ruvector-postgres
# Benchmark on pull requests
benchmark:
name: Benchmark
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql-16 postgresql-server-dev-16
- name: Run benchmarks
run: cargo bench --features pg16 -- --output-format bencher | tee benchmark-output.txt
working-directory: crates/ruvector-postgres
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Benchmark
tool: 'cargo'
output-file-path: crates/ruvector-postgres/benchmark-output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false
# Security audit
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run cargo audit
uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: crates/ruvector-postgres
# Package the extension
package:
name: Package Extension
runs-on: ubuntu-latest
needs: [test, test-all-features]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
strategy:
matrix:
pg_version: [14, 15, 16, 17]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql-${{ matrix.pg_version }} postgresql-server-dev-${{ matrix.pg_version }}
- name: Install cargo-pgrx
run: cargo install cargo-pgrx --version 0.12.0 --locked
- name: Initialize pgrx
run: cargo pgrx init --pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config
working-directory: crates/ruvector-postgres
- name: Package extension
run: cargo pgrx package --features pg${{ matrix.pg_version }}
working-directory: crates/ruvector-postgres
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ruvector-postgres-pg${{ matrix.pg_version }}
path: target/release/ruvector-postgres-pg${{ matrix.pg_version }}/
retention-days: 30
# Integration tests with Docker
integration-test:
name: Integration Test (Docker)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: crates/ruvector-postgres/Dockerfile
push: false
tags: ruvector-postgres:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run integration tests
run: |
docker run --rm ruvector-postgres:test psql --version
docker run --rm ruvector-postgres:test pg_config --version