-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add rust aarch64 target in release
Signed-off-by: usamoi <[email protected]>
- Loading branch information
Showing
3 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ jobs: | |
sudo apt-get install -y build-essential crossbuild-essential-arm64 | ||
sudo apt-get install -y qemu-user-static | ||
echo 'target.aarch64-unknown-linux-gnu.linker = "aarch64-linux-gnu-gcc"' | tee ~/.cargo/config.toml | ||
rustup target add aarch64-unknown-linux-gnu | ||
- name: Set up Sccache | ||
uses: mozilla-actions/[email protected] | ||
- name: Set up Cache | ||
|
@@ -71,12 +72,6 @@ jobs: | |
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.version }}-${{ matrix.arch }} | ||
- name: Set up Clang-16 | ||
run: | | ||
sudo sh -c 'echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-16 main" >> /etc/apt/sources.list' | ||
wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo apt-get update | ||
sudo apt-get install -y clang-16 | ||
- name: Set up Pgrx | ||
run: | | ||
# pg_config | ||
|
@@ -92,8 +87,8 @@ jobs: | |
echo PGRX_TARGET_INFO_PATH_PG$VERSION=$HOME/.pgrx_binding >> "$GITHUB_ENV" | ||
- name: Build | ||
run: | | ||
cargo build --lib --no-default-features --features pg$VERSION --release --target $ARCH-unknown-linux-gnu | ||
./tools/schema.sh --no-default-features --features pg$VERSION --release --target $ARCH-unknown-linux-gnu | expand -t 4 > ./target/pg_bestmatch--$SEMVER.sql | ||
cargo build --lib --features pg$VERSION --release --target $ARCH-unknown-linux-gnu | ||
./tools/schema.sh --features pg$VERSION --release --target $ARCH-unknown-linux-gnu | expand -t 4 > ./target/pg_bestmatch--$SEMVER.sql | ||
- name: Package | ||
run: | | ||
export PLATFORM=$(echo $ARCH | sed 's/aarch64/arm64/; s/x86_64/amd64/') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
printf "SEMVER = ${SEMVER}\n" | ||
printf "VERSION = ${VERSION}\n" | ||
printf "ARCH = ${ARCH}\n" | ||
printf "PLATFORM = ${PLATFORM}\n" | ||
|
||
rm -rf ./build/dir_zip | ||
rm -rf ./build/pg_bestmatch-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip | ||
rm -rf ./build/dir_deb | ||
rm -rf ./build/pg_bestmatch-pg${VERSION}_${SEMVER}_${PLATFORM}.deb | ||
|
||
mkdir -p ./build/dir_zip | ||
cp -a ./sql/upgrade/. ./build/dir_zip/ | ||
cp ./target/pg_bestmatch--$SEMVER.sql ./build/dir_zip/pg_bestmatch--$SEMVER.sql | ||
sed -e "s/@CARGO_VERSION@/$SEMVER/g" < ./pg_bestmatch.control > ./build/dir_zip/pg_bestmatch.control | ||
cp ./target/${ARCH}-unknown-linux-gnu/release/libpg_bestmatch.so ./build/dir_zip/pg_bestmatch.so | ||
zip ./build/pg_bestmatch-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip -j ./build/dir_zip/* | ||
|
||
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 | ||
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 | ||
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 | ||
done | ||
echo "Package: pg_bestmatch-pg${VERSION} | ||
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 | ||
Homepage: https://pgvecto.rs/ | ||
License: apache2" \ | ||
> ./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 --build ./build/dir_deb/ ./build/pg_bestmatch-pg${VERSION}_${SEMVER}_${PLATFORM}.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters