-
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 (#11)
Signed-off-by: usamoi <[email protected]>
- Loading branch information
Showing
5 changed files
with
51 additions
and
11 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/') | ||
|
@@ -105,7 +100,7 @@ jobs: | |
export TAG=${{ github.event.inputs.tag }} | ||
export PLATFORM=$(echo $ARCH | sed 's/aarch64/arm64/; s/x86_64/amd64/') | ||
gh release upload --clobber $TAG ./build/pg_bestmatch-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip | ||
gh release upload --clobber $TAG ./build/pg_bestmatch-pg${VERSION}_${SEMVER}_${PLATFORM}.deb | ||
gh release upload --clobber $TAG ./build/postgresql-${VERSION}-pg-bestmatch_${SEMVER}_${PLATFORM}.deb | ||
- name: Post Set up Cache | ||
uses: actions/cache/save@v4 | ||
if: ${{ !steps.cache.outputs.cache-hit }} | ||
|
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: postgresql-${VERSION}-pg-bestmatch | ||
Version: ${SEMVER} | ||
Section: database | ||
Priority: optional | ||
Architecture: ${PLATFORM} | ||
Maintainer: Tensorchord <[email protected]> | ||
Description: Generate BM25 sparse vector inside PostgreSQL | ||
Homepage: https://github.com/tensorchord/pg_bestmatch.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/postgresql-${VERSION}-pg-bestmatch_${SEMVER}_${PLATFORM}.deb |
Empty file.
Empty file.
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