From 36895d7d36818f5244996e38c23ae5b27d9f8800 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Mon, 9 Dec 2024 17:17:54 +0800 Subject: [PATCH 1/4] update github action platform names --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b314c3f..c823ee9 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,12 @@ The following table shows the compatibility matrix for different PostgreSQL vers | Platform | Architecture | PostgreSQL 14 | PostgreSQL 15 | PostgreSQL 16 | PostgreSQL 17 | |----------|-------------|:-------------:|:-------------:|:-------------:|:-------------:| -| Ubuntu Latest | x86_64 | ✅ | ✅ | ✅ | ✅ | -| Ubuntu 24.04 | x86_64 | ✅ | ✅ | ✅ | ✅ | -| Windows Latest | x86_64 | ✅ | ✅ | ✅ | ✅ | -| Windows 2019 | x86_64 | ✅ | ✅ | ✅ | ✅ | -| macOS Latest | arm64 | ✅ | ✅ | ✅ | ✅ | -| macOS 13 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| ubuntu-latest | x86_64 | ✅ | ✅ | ✅ | ✅ | +| ubuntu-24.04 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| windows-latest | x86_64 | ✅ | ✅ | ✅ | ✅ | +| windows-2019 | x86_64 | ✅ | ✅ | ✅ | ✅ | +| macos-latest | arm64 | ✅ | ✅ | ✅ | ✅ | +| macos-13 | x86_64 | ✅ | ✅ | ✅ | ✅ | ## Quick Start From 8f9571ea245588adb3f0ba684ff89c342cbdedb5 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Mon, 9 Dec 2024 17:18:43 +0800 Subject: [PATCH 2/4] fail fast --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 833d890..e1cf853 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,7 @@ on: jobs: test: - continue-on-error: true strategy: - fail-fast: false matrix: postgres-version: [14, 15, 16, 17] os: [ubuntu-latest, ubuntu-24.04, windows-latest, windows-2019, macos-latest, macos-13] From 0a3df694120f7649ed9eee9e07fd91cfa93eaee1 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Mon, 9 Dec 2024 17:21:45 +0800 Subject: [PATCH 3/4] refactor: improve installation scripts and documentation 1. Use temporary directories for building pgvector - Add mktemp -d for temporary directory creation - Clean up build files properly after installation - Prevent cluttering user's workspace 2. Update platform support documentation - Add compatibility matrix in README - Use GitHub Actions runner names (ubuntu-latest, etc.) - Document architecture support (x86_64, arm64) 3. CI workflow improvements - Remove continue-on-error and fail-fast settings - Ensure consistent testing across all platforms --- scripts/install-macos.sh | 15 +++++++++++---- scripts/install-ubuntu.sh | 6 +++++- scripts/install-windows.sh | 19 ++++++++++++------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/scripts/install-macos.sh b/scripts/install-macos.sh index dcb9d16..0dab365 100644 --- a/scripts/install-macos.sh +++ b/scripts/install-macos.sh @@ -49,12 +49,19 @@ if [ "$PGDATABASE" != "postgres" ]; then fi # Build and install pgvector -git clone --branch "v$PGVECTOR_VERSION" https://github.com/pgvector/pgvector.git +echo "Building pgvector from source..." +brew install git + +# Create and use temporary directory +TEMP_DIR=$(mktemp -d) +cd "$TEMP_DIR" +git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector -make -make install +make clean +PG_CONFIG="$PG_PATH/pg_config" make +sudo PG_CONFIG="$PG_PATH/pg_config" make install cd .. -rm -rf pgvector +rm -rf "$TEMP_DIR" # Create and configure pgvector extension psql -d $PGDATABASE -c 'CREATE EXTENSION IF NOT EXISTS vector;' diff --git a/scripts/install-ubuntu.sh b/scripts/install-ubuntu.sh index e0c6a4c..b63f7d1 100644 --- a/scripts/install-ubuntu.sh +++ b/scripts/install-ubuntu.sh @@ -38,13 +38,17 @@ echo "Installing pgvector..." # Always build from source to match PostgreSQL version echo "Building pgvector from source..." sudo apt-get install -y postgresql-server-dev-${PG_MAJOR_VERSION} build-essential git + +# Create and use temporary directory +TEMP_DIR=$(mktemp -d) +cd "$TEMP_DIR" git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector make clean PG_CONFIG=/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_config make sudo PG_CONFIG=/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_config make install cd .. -rm -rf pgvector +rm -rf "$TEMP_DIR" # Configure PostgreSQL authentication for CI echo "local all postgres trust" | sudo tee /etc/postgresql/${PG_VERSION}/main/pg_hba.conf diff --git a/scripts/install-windows.sh b/scripts/install-windows.sh index 1b66e30..e7b4141 100644 --- a/scripts/install-windows.sh +++ b/scripts/install-windows.sh @@ -83,17 +83,22 @@ fi export PATH="/mingw64/bin:$PATH" export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$PKG_CONFIG_PATH" -# Build and install pgvector -git clone --branch "v$PGVECTOR_VERSION" https://github.com/pgvector/pgvector.git +# Install pgvector +echo "Building pgvector from source..." +pacman -S --noconfirm git make gcc + +# Create and use temporary directory +TEMP_DIR=$(mktemp -d) +cd "$TEMP_DIR" +git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector make clean -PG_CONFIG=/mingw64/bin/pg_config make -PG_CONFIG=/mingw64/bin/pg_config make install +PATH=$PATH:/mingw64/bin make USE_PGXS=1 +PATH=$PATH:/mingw64/bin make USE_PGXS=1 install cd .. -rm -rf pgvector +rm -rf "$TEMP_DIR" -# Create and configure pgvector extension -echo "Creating pgvector extension..." +# Create extension PGPASSWORD=$PGPASSWORD psql -h localhost -U $PGUSER -d $PGDATABASE -c "CREATE EXTENSION IF NOT EXISTS vector;" # Verify installation From 9072225d7a6eeb17b94d7aff6b0c9925d6f6206b Mon Sep 17 00:00:00 2001 From: Li Jie Date: Mon, 9 Dec 2024 17:24:14 +0800 Subject: [PATCH 4/4] fix: preserve working directory when cleaning up - Store original directory path before changing to temp directory - Return to original directory before removing temp directory - Fix 'could not identify current directory' error - Ensure subsequent commands run from valid directory --- scripts/install-macos.sh | 3 ++- scripts/install-ubuntu.sh | 3 ++- scripts/install-windows.sh | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/install-macos.sh b/scripts/install-macos.sh index 0dab365..ccdfe80 100644 --- a/scripts/install-macos.sh +++ b/scripts/install-macos.sh @@ -54,13 +54,14 @@ brew install git # Create and use temporary directory TEMP_DIR=$(mktemp -d) +ORIG_DIR=$(pwd) cd "$TEMP_DIR" git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector make clean PG_CONFIG="$PG_PATH/pg_config" make sudo PG_CONFIG="$PG_PATH/pg_config" make install -cd .. +cd "$ORIG_DIR" rm -rf "$TEMP_DIR" # Create and configure pgvector extension diff --git a/scripts/install-ubuntu.sh b/scripts/install-ubuntu.sh index b63f7d1..63dc518 100644 --- a/scripts/install-ubuntu.sh +++ b/scripts/install-ubuntu.sh @@ -41,13 +41,14 @@ sudo apt-get install -y postgresql-server-dev-${PG_MAJOR_VERSION} build-essentia # Create and use temporary directory TEMP_DIR=$(mktemp -d) +ORIG_DIR=$(pwd) cd "$TEMP_DIR" git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector make clean PG_CONFIG=/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_config make sudo PG_CONFIG=/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_config make install -cd .. +cd "$ORIG_DIR" rm -rf "$TEMP_DIR" # Configure PostgreSQL authentication for CI diff --git a/scripts/install-windows.sh b/scripts/install-windows.sh index e7b4141..5a0cc8e 100644 --- a/scripts/install-windows.sh +++ b/scripts/install-windows.sh @@ -89,13 +89,14 @@ pacman -S --noconfirm git make gcc # Create and use temporary directory TEMP_DIR=$(mktemp -d) +ORIG_DIR=$(pwd) cd "$TEMP_DIR" git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git cd pgvector make clean PATH=$PATH:/mingw64/bin make USE_PGXS=1 PATH=$PATH:/mingw64/bin make USE_PGXS=1 install -cd .. +cd "$ORIG_DIR" rm -rf "$TEMP_DIR" # Create extension