Skip to content

fix 1.5.0 migration per issue #362 #869

fix 1.5.0 migration per issue #362

fix 1.5.0 migration per issue #362 #869

name: PGMQ Extension Upgrade
defaults:
run:
shell: bash
working-directory: ./pgmq-extension
on:
pull_request:
branches:
- main
paths:
- "pgmq-extension/**"
- ".github/workflows/extension_upgrade.yml"
push:
branches:
- main
paths:
- "pgmq-extension/**"
- ".github/workflows/extension_upgrade.yml"
release:
types:
- created
jobs:
test:
name: Upgrade Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "pgmq-extension-upgrade-test"
workspaces: |
pgmq
# Additional directories to cache
cache-directories: |
/home/runner/.pgrx
- name: Get current version
id: current-version
run: echo "CI_BRANCH=$(git name-rev --name-only HEAD)" >> $GITHUB_OUTPUT
- uses: ./.github/actions/pgx-init
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y postgresql-server-dev-14
- name: Set PG_CONFIG environment variable
run: echo "PG_CONFIG=$(cargo pgrx info pg-config pg16)" >> $GITHUB_ENV
- name: Install pg_partman
run: |
git clone https://github.com/pgpartman/pg_partman.git && \
cd pg_partman && \
git checkout v4.7.4 && \
sed -i "s|PG_CONFIG = pg_config|PG_CONFIG = ${PG_CONFIG}|" Makefile && \
make && \
make install
- name: Checkout old version (1.0.0)
run: |
git fetch --tags
git checkout tags/v1.0.0
- name: Run old version (1.0.0)
run: |
rm -rf ./target/pgrx-test-data-* || true
cargo install cargo-pgrx --version 0.11.0
SQLX_OFFLINE=true cargo pgrx run pg16 --pgcli || true
export DATABASE_URL=postgres://$USER:postgres@localhost:28816/pgmq
psql $DATABASE_URL -c "DROP EXTENSION IF EXISTS pgmq CASCADE;"
psql $DATABASE_URL -c "DROP EXTENSION IF EXISTS pg_partman CASCADE;"
psql $DATABASE_URL -c "CREATE EXTENSION pg_partman;"
psql $DATABASE_URL -c "CREATE EXTENSION pgmq;"
psql $DATABASE_URL -c "select * from pgmq.create('test_queue_1')"
psql $DATABASE_URL -c "select * from pgmq.create_partitioned('test_partitioned_queue_1');"
- name: Checkout branch's version
env:
CI_BRANCH: ${{ steps.current-version.outputs.CI_BRANCH }}
run: |
git checkout $CI_BRANCH
- name: Upgrade extension version
run: |
make clean
make
make install
psql postgres://$USER:postgres@localhost:28816/pgmq -c "ALTER EXTENSION pgmq UPDATE;"
- name: Run tests
env:
PGPASSWORD: postgres
PGHOST: localhost
PGPORT: 28816
REGRESS_OPTS: --inputdir=test --dbname=pgmq
run: |
status=0
make installcheck || status=$?
[ $status != 0 ] && find . -name regression.diffs -exec cat {} +
exit $status