-
Notifications
You must be signed in to change notification settings - Fork 72
67 lines (64 loc) · 2.3 KB
/
extension_upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: PGMQ Extension Upgrade
defaults:
run:
shell: bash
working-directory: ./
on:
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- created
jobs:
test:
name: Upgrade Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "pgmq-extension-test"
workspaces: |
pgmq
# Additional directories to cache
cache-directories: |
/home/runner/.pgrx
- uses: ./.github/actions/pgx-init
with:
working-directory: ./
- name: upgrade and test
run: |
sudo apt-get update && sudo apt-get install -y postgresql-server-dev-14
git clone https://github.com/pgpartman/pg_partman.git && \
cd pg_partman && \
sudo make install && cd ../
cp /usr/share/postgresql/14/extension/pg_partman* ~/.pgrx/15.4/pgrx-install/share/postgresql/extension/
cp /usr/lib/postgresql/14/lib/pg_partman_bgw.so ~/.pgrx/15.4/pgrx-install/lib/postgresql/
rm -rf ./target/pgrx-test-data-* || true
# Config
pg_version=$(stoml Cargo.toml features.default)
# Get current branch
export DATABASE_URL=postgres://$USER:postgres@localhost:28815/pgmq
export CI_BRANCH=$(git name-rev --name-only HEAD)
# Build and install old pgmq version
git fetch --tags
git checkout tags/v0.14.2
SQLX_OFFLINE=true cargo pgrx run ${pg_version} --pgcli || true
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');"
# Checkout branch and attempt to update extension version
git checkout $CI_BRANCH
SQLX_OFFLINE=true cargo pgrx run ${pg_version} --pgcli || true
psql $DATABASE_URL -c "ALTER EXTENSION pgmq UPDATE;"
# Run extension tests
SQLX_OFFLINE=true cargo pgrx test ${pg_version}