Skip to content

Commit

Permalink
chore: fix release ci (tensorchord#85)
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy authored Nov 14, 2024
1 parent f7f6c84 commit db1c2ed
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ concurrency:
jobs:
semver:
runs-on: ubuntu-latest
outputs:
SEMVER: ${{ steps.semver.outputs.SEMVER }}
steps:
- uses: actions/github-script@v7
id: semver
with:
script: |
const tag = github.context.payload.inputs?.tag || github.context.payload.release?.tag_name;
const tag = "${{ github.event.inputs.tag }}" || "${{ github.event.release.tag_name }}";
console.log(`Tag: ${tag}`);
const r = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
if (!r.test(tag)) {
core.setFailed(`Action failed with an invalid semver.`);
}
core.exportVariable('SEMVER', tag);
core.setOutput('SEMVER', tag);
build:
runs-on: ubuntu-latest
Expand All @@ -37,6 +41,7 @@ jobs:
arch: ["x86_64", "aarch64"]
env:
PGRX_IMAGE: "kemingy/pgrx:0.12.8"
SEMVER: ${{ needs.semver.outputs.SEMVER }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -65,8 +70,9 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
docker run --rm -v .:/workspace $CACHE_ENVS $PGRX_IMAGE build --lib --features pg${{ matrix.version }} --target ${{ matrix.arch }}-unknown-linux-gnu --profile $PROFILE
docker run --rm -v .:/workspace $CACHE_ENVS --entrypoint bash $PGRX_IMAGE ./tools/schema.sh --features pg${{ matrix.version }} --target ${{ matrix.arch }}-unknown-linux-gnu --profile $PROFILE
docker run --rm -v .:/workspace $CACHE_ENVS --entrypoint bash -e SEMVER=${SEMVER} $PGRX_IMAGE ./tools/schema.sh --features pg${{ matrix.version }} --target ${{ matrix.arch }}-unknown-linux-gnu --profile $PROFILE
./tools/package.sh
ls ./build
gh release upload --clobber $SEMVER ./build/vchord-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
gh release upload --clobber $SEMVER ./build/vchord-pg${VERSION}_${ARCH}-unknown-linux-gnu_${SEMVER}.zip
Expand All @@ -77,6 +83,8 @@ jobs:
matrix:
version: ["14", "15", "16", "17"]
platform: ["amd64", "arm64"]
env:
SEMVER: ${{ needs.semver.outputs.SEMVER }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vchord"
version = "0.0.0"
version = "0.1.0"
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions tools/package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -eu

printf "SEMVER = ${SEMVER}\n"
printf "VERSION = ${VERSION}\n"
Expand Down Expand Up @@ -42,4 +42,4 @@ 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-deb -Zxz --build ./build/dir_deb/ ./build/vchord-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
dpkg-deb -Zxz --build ./build/dir_deb/ ./build/vchord-pg${VERSION}_${SEMVER}_${PLATFORM}.deb
6 changes: 5 additions & 1 deletion tools/schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [[ " $@ " =~ --target' '([^ ]+) ]]; then
DIR="./target/$TARGET/release"
elif [[ " $@ " =~ " --profile opt " ]]; then
DIR="./target/$TARGET/opt"
elif [[ " $@ " =~ " --profile release " ]]; then
DIR="./target/$TARGET/release"
else
DIR="./target/$TARGET/debug"
fi
Expand All @@ -14,6 +16,8 @@ else
DIR="./target/release"
elif [[ " $@ " =~ " --profile opt " ]]; then
DIR="./target/opt"
elif [[ " $@ " =~ " --profile release " ]]; then
DIR="./target/release"
else
DIR="./target/debug"
fi
Expand Down Expand Up @@ -44,4 +48,4 @@ CONTROL_FILEPATH="./vchord.control" SO_FILEPATH="$DIR/libvchord.so" $(dirname "$

PGRX_EMBED=$code cargo rustc --package vchord --bin pgrx_embed_vchord "$@" -- --cfg pgrx_embed

CARGO_PKG_VERSION="0.0.0" QEMU_LD_PREFIX=$QEMU_LD_PREFIX "${RUNNER[@]}" "$DIR/pgrx_embed_vchord" | expand -t 4 > $DIR/schema.sql
CARGO_PKG_VERSION=${SEMVER} QEMU_LD_PREFIX=$QEMU_LD_PREFIX "${RUNNER[@]}" "$DIR/pgrx_embed_vchord" | expand -t 4 > $DIR/schema.sql

0 comments on commit db1c2ed

Please sign in to comment.