Skip to content

Commit

Permalink
ci: update release package (#36)
Browse files Browse the repository at this point in the history
Update:
- add `Vectorchord` into `vchord_bm25-postgres` docker image
- align package name to
tensorchord/VectorChord#179
- change runner from `ubicloud-standard-4` to `ubuntu-22.04`

test action:
https://github.com/silver-ymz/VectorChord-bm25/actions/runs/13177519564

---------

Signed-off-by: Mingzhuo Yin <[email protected]>
  • Loading branch information
silver-ymz authored Feb 6, 2025
1 parent 6ce2886 commit d938e20
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 205 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
strategy:
matrix:
version: ["14", "15", "16", "17"]
runner: ["ubicloud-standard-4", "ubicloud-standard-4-arm"]
runner: ["ubuntu-22.04", "ubuntu-22.04-arm"]
env:
PGRX_IMAGE: "ghcr.io/tensorchord/vectorchord-pgrx:0.12.9-nightly-2024-12-25"
SEMVER: ${{ needs.semver.outputs.SEMVER }}
ARCH: ${{ matrix.runner == 'ubicloud-standard-4' && 'x86_64' || 'aarch64' }}
PLATFORM: ${{ matrix.runner == 'ubicloud-standard-4' && 'amd64' || 'arm64' }}
ARCH: ${{ matrix.runner == 'ubuntu-22.04' && 'x86_64' || 'aarch64' }}
PLATFORM: ${{ matrix.runner == 'ubuntu-22.04' && 'amd64' || 'arm64' }}

steps:
- uses: actions/checkout@v4
Expand All @@ -65,15 +65,17 @@ jobs:
- name: Build
env:
VERSION: ${{ matrix.version }}
GH_TOKEN: ${{ github.token }}
run: |
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE cargo build --lib --features pg$VERSION --release
docker run --rm -v .:/workspace $CACHE_ENVS -e SEMVER=${SEMVER} $PGRX_IMAGE ./tools/schema.sh --features pg$VERSION --release
./tools/package.sh
docker run --rm -v .:/workspace $CACHE_ENVS \
-e SEMVER=$SEMVER \
-e VERSION=${{ matrix.version }} \
-e ARCH=$ARCH \
-e PLATFORM=$PLATFORM \
$PGRX_IMAGE ./tools/package.sh
ls ./build
gh release upload --clobber $SEMVER ./build/vchord-bm25-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
gh release upload --clobber $SEMVER ./build/vchord-bm25-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip
gh release upload --clobber $SEMVER ./build/postgresql-${{ matrix.version }}-vchord-bm25_${SEMVER}-1_${PLATFORM}.deb
gh release upload --clobber $SEMVER ./build/postgresql-${{ matrix.version }}-vchord-bm25_${SEMVER}_${ARCH}-linux-gnu.zip
docker:
runs-on: ubuntu-latest
Expand All @@ -94,7 +96,7 @@ jobs:
run: |
mkdir -p build
for arch in amd64 arm64; do
gh release download $SEMVER --pattern "vchord-bm25-pg${{ matrix.version }}_${SEMVER}_${arch}.deb" --output ./build/vchord-bm25-pg${{ matrix.version }}_${SEMVER}_${arch}.deb
gh release download $SEMVER --pattern "postgresql-${{ matrix.version }}-vchord-bm25_${SEMVER}-1_${arch}.deb" --output ./build/postgresql-${{ matrix.version }}-vchord-bm25_${SEMVER}-1_${arch}.deb
done
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -137,4 +139,4 @@ jobs:
build-args: |
PG_VERSION=${{ matrix.version }}
SEMVER=${{ env.SEMVER }}
PGVECTOR=0.8.0
VCHORD_VERSION=0.2.0
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bytemuck = "1.18"
generator = "0.8.4"
lazy_static = "1.5"
lending-iterator = "0.1.7"
pgrx = { version = "=0.12.8", default-features = false, features = ["cshim"] }
pgrx = { version = "=0.12.9", default-features = false, features = ["cshim"] }
regex = "1.11.1"
rust-stemmers = { git = "https://github.com/tensorchord/rust-stemmers.git" }
serde = { version = "1.0.217", features = ["derive"] }
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ARG PG_VERSION=17
ARG PGVECTOR=0.8.0
ARG VCHORD_VERSION=0.2.0

FROM pgvector/pgvector:${PGVECTOR}-pg${PG_VERSION}
FROM tensorchord/vchord-postgres:pg${PG_VERSION}-v${VCHORD_VERSION}

ARG PG_VERSION
ARG SEMVER=0.0.0
ARG TARGETARCH

RUN echo ${PG_VERSION}
COPY ./build/vchord-bm25-pg${PG_VERSION}_${SEMVER}_${TARGETARCH}.deb /tmp/vchord-bm25.deb
COPY ./build/postgresql-${PG_VERSION}-vchord-bm25_${SEMVER}-1_${TARGETARCH}.deb /tmp/vchord-bm25.deb
RUN apt-get install -y /tmp/vchord-bm25.deb && rm -f /tmp/vchord-bm25.deb

CMD ["postgres", "-c" ,"shared_preload_libraries=vchord_bm25.so"]
CMD ["postgres", "-c" ,"shared_preload_libraries=vchord.so,vchord_bm25.so"]
2 changes: 1 addition & 1 deletion docker/binary.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ ARG PG_VERSION
ARG TARGETARCH

WORKDIR /workspace
COPY ./build/vchord-bm25-pg${PG_VERSION}_${SEMVER}_${TARGETARCH}.deb /workspace/
COPY ./build/postgresql-${PG_VERSION}-vchord-bm25_${SEMVER}-1_${TARGETARCH}.deb /workspace/
51 changes: 26 additions & 25 deletions tools/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,40 @@ printf "VERSION = ${VERSION}\n"
printf "ARCH = ${ARCH}\n"
printf "PLATFORM = ${PLATFORM}\n"

rm -rf ./build/dir_zip
rm -rf ./build/vchord-bm25-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip
rm -rf ./build/dir_deb
rm -rf ./build/vchord-bm25-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
cargo build --lib --features pg$VERSION --release
cargo pgrx schema --features pg$VERSION --out ./target/schema.sql

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

mkdir -p ./build/dir_deb
mkdir -p ./build/dir_deb/DEBIAN
mkdir -p ./build/dir_deb/usr/share/postgresql/$VERSION/extension/
mkdir -p ./build/dir_deb/usr/lib/postgresql/$VERSION/lib/
for file in $(ls ./build/dir_zip/*.sql | xargs -n 1 basename); do
cp ./build/dir_zip/$file ./build/dir_deb/usr/share/postgresql/$VERSION/extension/$file
mkdir -p ./build/zip
[[ -d ./sql/upgrade ]] && cp -a ./sql/upgrade/. ./build/zip/
cp ./target/schema.sql ./build/zip/vchord_bm25--$SEMVER.sql
sed -e "s/@CARGO_VERSION@/$SEMVER/g" < ./vchord_bm25.control > ./build/zip/vchord_bm25.control
cp ./target/release/libvchord_bm25.so ./build/zip/vchord_bm25.so
zip ./build/postgresql-${VERSION}-vchord-bm25_${SEMVER}_${ARCH}-linux-gnu.zip -j ./build/zip/*

mkdir -p ./build/deb
mkdir -p ./build/deb/DEBIAN
mkdir -p ./build/deb/usr/share/postgresql/$VERSION/extension/
mkdir -p ./build/deb/usr/lib/postgresql/$VERSION/lib/
for file in $(ls ./build/zip/*.sql | xargs -n 1 basename); do
cp ./build/zip/$file ./build/deb/usr/share/postgresql/$VERSION/extension/$file
done
for file in $(ls ./build/dir_zip/*.control | xargs -n 1 basename); do
cp ./build/dir_zip/$file ./build/dir_deb/usr/share/postgresql/$VERSION/extension/$file
for file in $(ls ./build/zip/*.control | xargs -n 1 basename); do
cp ./build/zip/$file ./build/deb/usr/share/postgresql/$VERSION/extension/$file
done
for file in $(ls ./build/dir_zip/*.so | xargs -n 1 basename); do
cp ./build/dir_zip/$file ./build/dir_deb/usr/lib/postgresql/$VERSION/lib/$file
for file in $(ls ./build/zip/*.so | xargs -n 1 basename); do
cp ./build/zip/$file ./build/deb/usr/lib/postgresql/$VERSION/lib/$file
done
echo "Package: vchord-bm25-pg${VERSION}
echo "Package: postgresql-${VERSION}-vchord-bm25
Version: ${SEMVER}
Section: database
Priority: optional
Architecture: ${PLATFORM}
Maintainer: Tensorchord <[email protected]>
Description: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
Description: Native BM25 Ranking Index in PostgreSQL
Homepage: https://github.com/tensorchord/VectorChord-bm25/
License: AGPLv3 or ELv2" \
> ./build/dir_deb/DEBIAN/control
(cd ./build/dir_deb && md5sum usr/share/postgresql/$VERSION/extension/* usr/lib/postgresql/$VERSION/lib/*) > ./build/dir_deb/DEBIAN/md5sums
dpkg-deb -Zxz --build ./build/dir_deb/ ./build/vchord-bm25-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
License: AGPL-3.0-only or Elastic-2.0" \
> ./build/deb/DEBIAN/control
(cd ./build/deb && md5sum usr/share/postgresql/$VERSION/extension/* usr/lib/postgresql/$VERSION/lib/*) > ./build/deb/DEBIAN/md5sums
dpkg-deb --root-owner-group -Zxz --build ./build/deb/ ./build/postgresql-${VERSION}-vchord-bm25_${SEMVER}-1_${PLATFORM}.deb
77 changes: 0 additions & 77 deletions tools/pg_config.sh

This file was deleted.

43 changes: 0 additions & 43 deletions tools/schema-codegen.sh

This file was deleted.

43 changes: 0 additions & 43 deletions tools/schema.sh

This file was deleted.

0 comments on commit d938e20

Please sign in to comment.