-
Notifications
You must be signed in to change notification settings - Fork 94
167 lines (147 loc) · 6.92 KB
/
major-version-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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Major Version Upgrade Tests for empty database
on: [push, pull_request]
jobs:
run-babelfish-mvu-tests:
env:
OLD_INSTALL_DIR: postgres13
NEW_INSTALL_DIR: postgres14
ENGINE_BRANCH_FROM: BABEL_1_X_DEV__PG_13_X
EXTENSION_BRANCH_FROM: BABEL_1_X_DEV
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
id: install-dependencies
if: always()
uses: ./.github/composite-actions/install-dependencies
- name: Build Modified Postgres using ${{env.ENGINE_BRANCH_FROM}}
id: build-modified-postgres-old
if: always() && steps.install-dependencies.outcome == 'success'
run: |
cd ..
git clone --branch ${{env.ENGINE_BRANCH_FROM}} https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git
cd postgresql_modified_for_babelfish
./configure --prefix=$HOME/${{env.OLD_INSTALL_DIR}} --with-python PYTHON=/usr/bin/python2.7 --enable-debug --enable-cassert CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu
make clean
make -j 4 2>error.txt
make install
make check
cd contrib && make && sudo make install
shell: bash
- name: Compile ANTLR
id: compile-antlr
if: always() && steps.build-modified-postgres-old.outcome == 'success'
uses: ./.github/composite-actions/compile-antlr
with:
install_dir: ${{env.OLD_INSTALL_DIR}}
- uses: actions/checkout@v2
with:
repository: babelfish-for-postgresql/babelfish_extensions
ref: ${{env.EXTENSION_BRANCH_FROM}}
- name: Build Extensions using ${{env.EXTENSION_BRANCH_FROM}}
id: build-extensions-old
if: always() && steps.compile-antlr.outcome == 'success'
run: |
export PG_CONFIG=~/${{env.OLD_INSTALL_DIR}}/bin/pg_config
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
export cmake=$(which cmake)
cd contrib/babelfishpg_money
make && make install
cd ../babelfishpg_common
make && make install
cd ../babelfishpg_tds
make && make install
cd ../babelfishpg_tsql
make && make install
- name: Install Extensions using ${{env.EXTENSION_BRANCH_FROM}}
id: install-extensions-old
if: always() && steps.build-extensions-old.outcome == 'success'
run: |
cd ~
export PATH=/opt/mssql-tools/bin:$PATH
~/${{env.OLD_INSTALL_DIR}}/bin/initdb -D ~/${{env.OLD_INSTALL_DIR}}/data
~/${{env.OLD_INSTALL_DIR}}/bin/pg_ctl -D ~/${{env.OLD_INSTALL_DIR}}/data -l ~/${{env.OLD_INSTALL_DIR}}/data/logfile start
cd ${{env.OLD_INSTALL_DIR}}/data
sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" postgresql.conf
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf
ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}')
sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf
~/${{env.OLD_INSTALL_DIR}}/bin/pg_ctl -D ~/${{env.OLD_INSTALL_DIR}}/data -l ~/${{env.OLD_INSTALL_DIR}}/data/logfile restart
cd ~/work/babelfish_extensions/babelfish_extensions/
sudo ~/${{env.OLD_INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/create_extension.sql
sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT @@version GO"
shell: bash
- uses: actions/checkout@v2
- name: Build Modified Postgres using latest version
id: build-modified-postgres-new
if: always() && steps.install-extensions-old.outcome == 'success'
uses: ./.github/composite-actions/build-modified-postgres
with:
install_dir: ${{env.NEW_INSTALL_DIR}}
- name: Copy ANTLR
run: cp "/usr/local/lib/libantlr4-runtime.so.4.9.3" ~/${{env.NEW_INSTALL_DIR}}/lib/
- name: Build Extensions using latest version
id: build-extensions-new
if: always() && steps.build-modified-postgres-new.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
with:
install_dir: ${{env.NEW_INSTALL_DIR}}
- name: Setup new data directory
id: setup-new-datadir
if: always() && steps.build-extensions-new.outcome == 'success'
run: |
cd ~
~/${{env.NEW_INSTALL_DIR}}/bin/initdb -D ~/${{env.NEW_INSTALL_DIR}}/data
cd ~/${{env.NEW_INSTALL_DIR}}/data
sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" postgresql.conf
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf
ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}')
sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf
shell: bash
- name: Run pg_upgrade
id: run-pg_upgrade
if: always() && steps.setup-new-datadir.outcome == 'success'
uses: ./.github/composite-actions/run-pg-upgrade
- name: Run JDBC Tests
id: jdbc
timeout-minutes: 60
if: always() && steps.run-pg_upgrade.outcome == 'success'
run: |
cd test/JDBC/
# temporarily ignore test BABEL-2086
echo 'ignore#!#BABEL-2086' >> jdbc_schedule
mvn test
- name: Upload Postgres log
if: always() && steps.jdbc.outcome == 'failure'
uses: actions/upload-artifact@v2
with:
name: postgres-log
path: ~/${{env.NEW_INSTALL_DIR}}/data/logfile
- name: Upload upgrade Log
if: always() && steps.run-pg_upgrade.outcome == 'failure'
uses: actions/upload-artifact@v2
with:
name: upgrade-logs
path: ~/upgrade/*.log
# The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions
- name: Rename Test Summary Files
id: test-file-rename
if: always() && steps.jdbc.outcome == 'failure'
run: |
cd test/JDBC/Info
timestamp=`ls -Art | tail -n 1`
cd $timestamp
mv $timestamp.diff ../output-diff.diff
mv "$timestamp"_runSummary.log ../run-summary.log
- name: Upload Run Summary
if: always() && steps.test-file-rename.outcome == 'success'
uses: actions/upload-artifact@v2
with:
name: run-summary.log
path: test/JDBC/Info/run-summary.log
- name: Upload Output Diff
if: always() && steps.test-file-rename.outcome == 'success'
uses: actions/upload-artifact@v2
with:
name: output-diff.diff
path: test/JDBC/Info/output-diff.diff