forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (105 loc) · 4.93 KB
/
isolation-tests.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
name: Babelfish Smoke Tests
on:
push:
branches:
pull_request:
branches:
jobs:
isolation-tests:
name: Isolation-Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Clone, build, and run tests for Postgres engine
id: postgres
if: always()
run: |
cd ..
git clone https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git
sudo apt-get update
sudo apt-get install uuid-dev openjdk-8-jre libicu-dev libxml2-dev openssl libssl-dev python-dev libossp-uuid-dev libpq-dev cmake pkg-config g++ build-essential bison
cd postgresql_modified_for_babelfish
./configure --prefix=$HOME/postgres/ --with-python PYTHON=/usr/bin/python2.7 --enable-debug CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu
make -j 4 2>error.txt
make install
cd contrib && make && sudo make install
- name: Compile ANTLR
id: compile-antlr
if: always() && steps.postgres.outcome == 'success'
run: |
ANTLR_VERSION=4.9.3
cd contrib/babelfishpg_tsql/antlr/thirdparty/antlr/
sudo cp "antlr-$ANTLR_VERSION-complete.jar" /usr/local/lib
cd ..
wget "http://www.antlr.org/download/antlr4-cpp-runtime-$ANTLR_VERSION-source.zip"
unzip -d antlr4 "antlr4-cpp-runtime-$ANTLR_VERSION-source.zip"
cd antlr4
mkdir build && cd build
cmake .. -D ANTLR_JAR_LOCATION="/usr/local/lib/antlr-$ANTLR_VERSION-complete.jar" -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_DEMO=True
make
sudo make install
cp "/usr/local/lib/libantlr4-runtime.so.$ANTLR_VERSION" ~/postgres/lib/
- name: Set env variables and build extensions
run: |
export PG_CONFIG=~/postgres/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
run: |
cd ~
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo apt-get install -y mssql-tools unixodbc-dev
export PATH=/opt/mssql-tools/bin:$PATH
~/postgres/bin/initdb -D ~/postgres/data/
~/postgres/bin/pg_ctl -D ~/postgres/data/ -l logfile start
cd postgres/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
~/postgres/bin/pg_ctl -D ~/postgres/data/ -l logfile restart
cd ~/work/babelfish_extensions/babelfish_extensions/
sudo ~/postgres/bin/psql -d postgres -U runner -v user="python_user" -v db="python_testdb" -f .github/scripts/create_extension.sql
sqlcmd -S localhost -U python_user -P 12345678 -Q "SELECT @@version GO"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Configure Python environment
run: |
cd ~
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
cd ~/work/babelfish_extensions/babelfish_extensions/test/python
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 python3-dev
pip3 install pyodbc pymssql pytest pytest-xdist antlr4-python3-runtime
- name: Generate .spec file parser
run: |
cd ~/work/babelfish_extensions/babelfish_extensions/test/python/isolationtest/
java -Xmx500M -cp /usr/local/lib/antlr-4.9.3-complete.jar org.antlr.v4.Tool -Dlanguage=Python3 ./parser/*.g4 -visitor -no-listener
- name: Run Isolation tests
run: |
cd test/python
compareWithFile=true \
driver=pyodbc \
runInParallel=false \
testName=all \
provider="ODBC Driver 17 for SQL Server" \
fileGenerator_URL=localhost \
fileGenerator_port=1433 \
fileGenerator_databaseName=master \
fileGenerator_user=python_user \
fileGenerator_password=12345678 \
inputFilesPath=./input/isolation \
runIsolationTests=true \
stepTimeLimit=30 \
pytest -s --tb=long -q .