chore: add postgres sqllogicaltest for arm (#159) #186
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
name: PostgresSQL | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/psql.yml' | |
- 'src/**' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- '*.control' | |
- 'rust-toolchain.toml' | |
- 'tests/**' | |
- 'tools/**' | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/psql.yml' | |
- 'src/**' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- '*.control' | |
- 'rust-toolchain.toml' | |
- 'tests/**' | |
- 'tools/**' | |
merge_group: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: "-Dwarnings" | |
CARGO_PROFILE_OPT_BUILD_OVERRIDE_DEBUG: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
version: ["14", "15", "16", "17"] | |
runner: ["ubicloud-standard-4", "ubicloud-standard-4-arm"] | |
env: | |
PGRX_IMAGE: "ghcr.io/tensorchord/vectorchord-pgrx:0.12.9-nightly-2024-12-25" | |
SQLLOGICTEST: "0.25.0" | |
ARCH: ${{ matrix.runner == 'ubicloud-standard-4' && 'x86_64' || 'aarch64' }} | |
PLATFORM: ${{ matrix.runner == 'ubicloud-standard-4' && 'amd64' || 'arm64' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure sccache | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const url = process.env.ACTIONS_CACHE_URL || ''; | |
const token = process.env.ACTIONS_RUNTIME_TOKEN || ''; | |
core.exportVariable( | |
'CACHE_ENVS', | |
`-e CARGO_INCREMENTAL=0 -e SCCACHE_GHA_ENABLED=true -e RUSTC_WRAPPER=sccache -e ACTIONS_CACHE_URL=${url} -e ACTIONS_RUNTIME_TOKEN=${token}`, | |
); | |
- name: Set up pgrx docker images and permissions | |
run: | | |
docker pull $PGRX_IMAGE | |
echo "Default user: $(id -u):$(id -g)" | |
sudo chmod -R 777 . | |
- name: Build | |
env: | |
SEMVER: "0.0.0" | |
VERSION: ${{ matrix.version }} | |
PROFILE: "opt" | |
run: | | |
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 . | |
- name: Setup SQL Logic Test | |
run: | | |
curl -fsSL -o sqllogictest.tar.gz https://github.com/risinglightdb/sqllogictest-rs/releases/download/v${SQLLOGICTEST}/sqllogictest-bin-v${SQLLOGICTEST}-$ARCH-unknown-linux-musl.tar.gz | |
tar -xzf sqllogictest.tar.gz | |
mv sqllogictest /usr/local/bin/ | |
- name: SQL Test | |
env: | |
PGPASSWORD: postgres | |
run: | | |
docker run --rm --name test -d -e POSTGRES_PASSWORD=${PGPASSWORD} -p 5432:5432 vchord:pg${{ matrix.version }} | |
sleep 5 | |
psql -h localhost -U postgres -d postgres -c 'CREATE EXTENSION IF NOT EXISTS vchord CASCADE;' | |
sqllogictest './tests/**/*.slt' | |
docker stop test |