-
Notifications
You must be signed in to change notification settings - Fork 894
113 lines (103 loc) · 4.42 KB
/
pg_upgrade-test.yaml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: pg_upgrade test
"on":
push:
branches:
- main
- prerelease_test
pull_request:
jobs:
pg_upgrade_test:
name: pg_upgrade test from PG${{ matrix.pg_version_old }} to PG${{ matrix.pg_version_new }}
runs-on: 'ubuntu-latest'
strategy:
matrix:
include:
- pg_version_old: 14 # 14 to 15
pg_version_new: 15
- pg_version_old: 14 # 14 to 16
pg_version_new: 16
- pg_version_old: 15 # 15 to 16
pg_version_new: 16
- pg_version_old: 14 # 14 to 17
pg_version_new: 17
- pg_version_old: 15 # 15 to 17
pg_version_new: 17
- pg_version_old: 16 # 16 to 17
pg_version_new: 17
fail-fast: false
env:
OUTPUT_DIR: ${{ github.workspace }}/pg_upgrade_test
steps:
- name: Install Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install pip postgresql-common libkrb5-dev
- name: Install testgres
run: |
pip install testgres
- name: Install PostgreSQL ${{ matrix.pg_version_old}} and ${{ matrix.pg_version_new }}
run: |
yes | sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y \
postgresql-${{ matrix.pg_version_old }} postgresql-server-dev-${{ matrix.pg_version_old }} \
postgresql-${{ matrix.pg_version_new }} postgresql-server-dev-${{ matrix.pg_version_new }}
sudo apt-get install -y --no-install-recommends \
timescaledb-2-postgresql-${{ matrix.pg_version_old }} \
timescaledb-2-postgresql-${{ matrix.pg_version_new }}
- name: Checkout TimescaleDB
uses: actions/checkout@v4
- name: Build and install TimescaleDB on PostgreSQL ${{ matrix.pg_version_old}}
env:
BUILD_DIR: pg${{ matrix.pg_version_old }}
run: |
PATH="/usr/lib/postgresql/${{ matrix.pg_version_old }}/bin:$PATH"
./bootstrap -DCMAKE_BUILD_TYPE=Release -DWARNINGS_AS_ERRORS=OFF -DASSERTIONS=ON -DLINTER=OFF -DGENERATE_DOWNGRADE_SCRIPT=OFF -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF
make -j -C pg${{ matrix.pg_version_old }}
sudo make -j -C pg${{ matrix.pg_version_old }} install
- name: Build and install TimescaleDB on PostgreSQL ${{ matrix.pg_version_new}}
env:
BUILD_DIR: pg${{ matrix.pg_version_new }}
run: |
PATH="/usr/lib/postgresql/${{ matrix.pg_version_new }}/bin:$PATH"
./bootstrap -DCMAKE_BUILD_TYPE=Release -DWARNINGS_AS_ERRORS=OFF -DASSERTIONS=ON -DLINTER=OFF -DGENERATE_DOWNGRADE_SCRIPT=OFF -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF
make -j -C pg${{ matrix.pg_version_new }}
sudo make -j -C pg${{ matrix.pg_version_new }} install
- name: Run pg_upgrade test
env:
PGVERSIONOLD: ${{ matrix.pg_version_old }}
PGVERSIONNEW: ${{ matrix.pg_version_new }}
DIFFFILE: ${{ env.OUTPUT_DIR }}/upgrade_check.diff
run: |
scripts/test_pg_upgrade.py
diff -u \
"${OUTPUT_DIR}/post.pg${PGVERSIONOLD}.log" \
"${OUTPUT_DIR}/post.pg${PGVERSIONNEW}.log" | \
tee "${DIFFFILE}"
if [[ -s "${DIFFFILE}" ]]; then
echo "pg_upgrade test for ${PGVERSIONOLD} -> ${PGVERSIONNEW} failed"
exit 1
fi
- name: Show pg_upgrade diffs
if: always()
env:
DIFFFILE: ${{ env.OUTPUT_DIR }}/upgrade_check.diff
DIROLD: pg${{ matrix.pg_version_old }}
DIRNEW: pg${{ matrix.pg_version_new }}
run: |
cd ${OUTPUT_DIR}
cat ${DIFFFILE}
tar czf /tmp/pg_upgrade_artifacts.tgz \
${DIFFFILE} \
${OUTPUT_DIR}/*.log \
${OUTPUT_DIR}/${DIROLD}/logs/* \
${OUTPUT_DIR}/${DIRNEW}/logs/* \
${OUTPUT_DIR}/${DIRNEW}/data/pg_upgrade_output.d/*
- name: Upload pg_upgrade logs
if: always()
uses: actions/upload-artifact@v4
with:
name: pg_upgrade logs from ${{ matrix.pg_version_old }} to ${{ matrix.pg_version_new }}
path: /tmp/pg_upgrade_artifacts.tgz