Skip to content

Commit

Permalink
chore: fix the psql & release CI target, update readme (#158)
Browse files Browse the repository at this point in the history
- clean the target option
- fix release CI
- update readme about how to use the vectorchord-pgrx image

---------

Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy authored Dec 27, 2024
1 parent 3e23a14 commit b129dce
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/psql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
VERSION: ${{ matrix.version }}
PROFILE: "opt"
run: |
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE cargo build --lib --features pg${{ matrix.version }} --target $ARCH-unknown-linux-gnu --profile $PROFILE
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE ./tools/schema.sh --features pg${{ matrix.version }} --target $ARCH-unknown-linux-gnu --profile $PROFILE
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE cargo build --lib --features pg${{ matrix.version }} --profile $PROFILE
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE ./tools/schema.sh --features pg${{ matrix.version }} --profile $PROFILE
./tools/package.sh
docker build -t vchord:pg${{ matrix.version }} --build-arg PG_VERSION=${{ matrix.version }} -f ./docker/Dockerfile .
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ $$);
To simplify the workflow, we provide end-to-end scripts for external index pre-computation, see [scripts](./scripts/README.md#run-external-index-precomputation-toolkit).
### Build the Postgres Docker Image with VectorChord extension
Follow the steps in [Dev Guidance](./scripts/README.md#build-docker).
### Installing From Source
Install pgrx according to [pgrx's instruction](https://github.com/pgcentralfoundation/pgrx?tab=readme-ov-file#getting-started).
```bash
cargo install --locked cargo-pgrx
Expand Down
28 changes: 26 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
## Build Docker

Users can choose to build the package with the provided docker image or create the development environment by themselves.

- (option 1) With `vectorchord-pgrx` Image

```shell
# use the required version of `pgrx` and `rust`
export PGRX_VERSION=$(awk -F'version = "=|"' '/^pgrx\s*=.*version/ {print $2}' Cargo.toml)
export RUST_TOOLCHAIN=$(awk -F'"' '/^\s*channel\s*=/ {print $2}' rust-toolchain.toml)
export PGRX_IMAGE=ghcr.io/tensorchord/vectorchord-pgrx:$PGRX_VERSION-$RUST_TOOLCHAIN

docker run --rm -v .:/workspace $PGRX_IMAGE cargo build --lib --features pg16 --profile opt
docker run --rm -v .:/workspace $PGRX_IMAGE ./tools/schema.sh --features pg16 --profile opt
```

- (option 2) With Local Development Environment

```shell
sudo apt install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config clang
cargo install --locked cargo-pgrx
cargo pgrx init
cargo build --package vchord --lib --features pg16 --target x86_64-unknown-linux-gnu --profile opt
./tools/schema.sh --features pg16 --target x86_64-unknown-linux-gnu --profile opt
cargo build --package vchord --lib --features pg16 --profile opt
./tools/schema.sh --features pg16 --profile opt
```

- build the debian package

```shell
export SEMVER="0.0.0"
export VERSION="16"
export ARCH="x86_64"
export PLATFORM="amd64"
export PROFILE="opt"
./tools/package.sh
```

- build the docker image

```shell
docker build -t vchord:pg16-latest --build-arg PG_VERSION=16 -f ./docker/Dockerfile .
```

Expand Down
4 changes: 2 additions & 2 deletions tools/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ rm -rf ./build/dir_deb
rm -rf ./build/vchord-pg${VERSION}_${SEMVER}_${PLATFORM}.deb

mkdir -p ./build/dir_zip
cp ./target/${ARCH}-unknown-linux-gnu/${PROFILE}/schema.sql ./build/dir_zip/vchord--$SEMVER.sql
cp ./target/${PROFILE}/schema.sql ./build/dir_zip/vchord--$SEMVER.sql
sed -e "s/@CARGO_VERSION@/$SEMVER/g" < ./vchord.control > ./build/dir_zip/vchord.control
cp ./target/${ARCH}-unknown-linux-gnu/${PROFILE}/libvchord.so ./build/dir_zip/vchord.so
cp ./target/${PROFILE}/libvchord.so ./build/dir_zip/vchord.so
zip ./build/vchord-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip -j ./build/dir_zip/*

mkdir -p ./build/dir_deb
Expand Down

0 comments on commit b129dce

Please sign in to comment.