Skip to content

Commit

Permalink
Makefile adjustments, CI replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
3manuek committed Apr 25, 2022
1 parent bcb525f commit 89c9697
Show file tree
Hide file tree
Showing 1,762 changed files with 468,076 additions and 34 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/jdbc_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: JDBC Unit Tests
on:
push:
branches:
- BABEL_1_2_0__PG_13_6__dist
pull_request:
branches:
- BABEL_1_2_0__PG_13_6__dist

env:
ANTLR4_VERSION: 4.9.3
PG_SRC: /home/runner/work/BABEL_1_2_0__PG13_6/BABEL_1_2_0__PG13_6/

jobs:
extension-tests:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Requirements
run: |
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 install -y --no-install-recommends \
build-essential flex libxml2-dev libxml2-utils \
libxslt-dev libssl-dev \
libreadline-dev zlib1g-dev libldap2-dev libpam0g-dev gettext \
uuid uuid-dev cmake lld apt-utils \
libossp-uuid-dev gnulib bison \
xsltproc icu-devtools libicu66 libicu-dev gawk curl \
openjdk-8-jre openssl g++ \
libssl-dev python-dev libpq-dev \
pkg-config unzip libutfcpp-dev gnupg mssql-tools unixodbc-dev
export PATH=/opt/mssql-tools/bin:$PATH
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
check-latest: true
- name: Copy ANTLR jar file
run: |
cd contrib/babelfishpg_tsql/antlr/thirdparty/antlr/
sudo cp antlr-${ANTLR4_VERSION}-complete.jar /usr/local/lib
- name: Compile ANTLR
run: |
cd ..
wget http://www.antlr.org/download/antlr4-cpp-runtime-${ANTLR4_VERSION}-source.zip
unzip -d antlr4 antlr4-cpp-runtime-${ANTLR4_VERSION}-source.zip
cd antlr4
mkdir build && cd build
cmake .. -D ANTLR_JAR_LOCATION=/usr/local/lib/antlr-${ANTLR4_VERSION}-complete.jar -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_DEMO=True
make -j 4
sudo make install
# cp /usr/local/lib/libantlr4-runtime.so.${ANTLR4_VERSION} ~/postgres/lib/
- name: Build, and binary installation
run: |
# CFLAGS="${CFLAGS:--Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic}"
./configure CFLAGS="-ggdb" \
--prefix=$HOME/postgres/ \
--enable-debug \
--with-ldap \
--with-libxml \
--with-pam \
--with-uuid=ossp \
--enable-nls \
--with-libxslt \
--with-icu
# Removed due to incompatibility with BABEL-2785 test, as host_os function
# uses the version string to extract the OS.
#--with-extra-version=" Babelfish for PostgreSQL"
make clean && make DESTDIR=~/postgres/ -j 4 2>error.txt
# make check
sudo make install
- name: Build antlr
run: |
export ANTLR4_JAVA_BIN=/usr/bin/java
export ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime
export ANTLR_EXECUTABLE=/usr/local/lib/antlr-${ANTLR4_VERSION}-complete.jar
export ANTLR_RUNTIME=../antlr4
#PG_SRC=~/work/BABEL_1_2_0__PG_13_6
export PG_SRC=/home/runner/work/BABEL_1_2_0__PG13_6/BABEL_1_2_0__PG13_6/
export PG_CONFIG=~/postgres/bin/pg_config
cmake=$(which cmake)
# Copy runtime in Postgres lib
sudo cp /usr/local/lib/libantlr4-runtime.so.${ANTLR4_VERSION} ~/postgres/lib
cd ${PG_SRC}/contrib/babelfishpg_tsql/antlr
cmake -Wno-dev .
- name: Compile and Install Extensions
run: |
export ANTLR4_JAVA_BIN=/usr/bin/java
export ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime
export ANTLR_EXECUTABLE=/usr/local/lib/antlr-${ANTLR4_VERSION}-complete.jar
export ANTLR_RUNTIME=../antlr4
export PG_SRC=/home/runner/work/BABEL_1_2_0__PG13_6/BABEL_1_2_0__PG13_6/
export PG_CONFIG=~/postgres/bin/pg_config
cmake=$(which cmake)
cd $PG_SRC/contrib/ && make && sudo make install
- name: Install extensions
run: |
cd ~
sudo chown -R runner: ~/postgres
~/postgres/bin/initdb -D ~/postgres/data/ -E "UTF8"
~/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
sudo ~/postgres/bin/psql -d postgres -U runner -c "CREATE USER jdbc_user WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '12345678' INHERIT;"
sudo ~/postgres/bin/psql -d postgres -U runner -c "DROP DATABASE IF EXISTS jdbc_testdb;"
sudo ~/postgres/bin/psql -d postgres -U runner -c "CREATE DATABASE jdbc_testdb OWNER jdbc_user;"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "set allow_system_table_mods = on;"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "CREATE EXTENSION IF NOT EXISTS "babelfishpg_tds" CASCADE;"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "GRANT ALL ON SCHEMA sys to jdbc_user;"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "ALTER USER jdbc_user CREATEDB;"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "ALTER SYSTEM SET babelfishpg_tsql.database_name = 'jdbc_testdb';"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "SELECT pg_reload_conf();"
sudo ~/postgres/bin/psql -d jdbc_testdb -U runner -c "CALL sys.initialize_babelfish('jdbc_user');"
sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT @@version GO"
- name: Run JDBC test framework
timeout-minutes: 15
run: |
cd $PG_SRC/contrib/test/JDBC/
mvn test
- name: Upload log
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: postgres-log
path: ~/postgres/data/logfile
# The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions
- name: Rename test summary files
if: ${{ failure() }}
run: |
cd $PG_SRC/contrib/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: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: run-summary.log
path: contrib/test/JDBC/Info/run-summary.log
- name: Upload output diff
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: output-diff.diff
path: contrib/test/JDBC/Info/output-diff.diff
34 changes: 0 additions & 34 deletions .github/workflows/main.yml

This file was deleted.

Loading

0 comments on commit 89c9697

Please sign in to comment.