Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and use composite actions for code coverage workflow to improve maintainability #2100

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/composite-actions/build-modified-postgres/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: 'Tap Tests Enabled'
required: no
default: no
code_coverage:
description: 'Is code coverage flag needed'
required: false
default: 'no'

runs:
using: "composite"
Expand Down Expand Up @@ -41,6 +45,8 @@ runs:
cd postgresql_modified_for_babelfish
if [[ ${{inputs.tap_tests}} == "yes" ]]; then
./configure CC='ccache gcc' --prefix=$HOME/${{ inputs.install_dir }}/ --with-python PYTHON=/usr/bin/python3.8 --enable-cassert CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu --enable-tap-tests --with-gssapi
elif [[ ${{inputs.code_coverage}} == "yes" ]]; then
./configure CC='ccache gcc' --prefix=$HOME/${{ inputs.install_dir }}/ --with-python PYTHON=/usr/bin/python3.8 --enable-coverage --enable-cassert CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu
else
./configure CC='ccache gcc' --prefix=$HOME/${{ inputs.install_dir }}/ --with-python PYTHON=/usr/bin/python3.8 --enable-cassert CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu
fi
Expand Down
44 changes: 44 additions & 0 deletions .github/composite-actions/install-and-run-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Run Dotnet tests'
description: 'Install and Run Babel Dotnet Tests'

runs:
using: "composite"
steps:
- name: Install MSSQL Tools
id: install-mssql-tools
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-get install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
shell: bash

- name: Install Dotnet
id: install-dotnet
if: always() && steps.install-mssql-tools.outcome == 'success'
run: |
cd ~
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get install -y apt-transport-https
sudo apt-get install -y dotnet-sdk-5.0
sudo apt-get install -y apt-transport-https
sudo apt-get install -y aspnetcore-runtime-5.0
shell: bash

- name: Run Dotnet Tests
if: always() && steps.install-dotnet.outcome == 'success'
run: |
cd test/dotnet
dotnet build
babel_URL=localhost \
babel_port=1433 \
babel_databaseName=master \
babel_user=jdbc_user \
babel_password=12345678 \
testName="all---TestUDD.txt;TestChar.txt;TestSqlVariant.txt;TestVarChar.txt;TestAuthentication.txt;TestText.txt" \
dotnet test
shell: bash
64 changes: 64 additions & 0 deletions .github/composite-actions/install-and-run-odbc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'Run ODBC Tests'
description: 'Install and Run Babel ODBC test framework'

runs:
using: "composite"
steps:
- name: Install SQL Server ODBC Driver
id: install-sql-server-odbc-driver
run: |
cd ~
sudo apt-get install msodbcsql17
shell: bash

- name: Install unixODBC Driver
id: install-unix-odbc-driver
if: always() && steps.install-sql-server-odbc-driver.outcome == 'success'
run: |
cd ~
wget http://www.unixodbc.org/unixODBC-2.3.11.tar.gz
gunzip unixODBC*.tar.gz
tar xvf unixODBC*.tar
cd unixODBC-2.3.11
./configure
make
sudo make install
shell: bash

- name: Install psqlODBC Driver
id: install-psql-odbc-driver
if: always() && steps.install-unix-odbc-driver.outcome=='success'
run: |
cd ~
wget https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-16.00.0000.tar.gz
tar -zxvf psqlodbc-16.00.0000.tar.gz
cd psqlodbc-16.00.0000
./configure
sudo make
sudo make install
echo '[ODBC_Driver_16_for_PostgreSQL]' | sudo tee -a /etc/odbcinst.ini > /dev/null
echo 'Description=ODBC Driver 16 for PostgreSQL Server' | sudo tee -a /etc/odbcinst.ini > /dev/null
echo 'Driver=/usr/local/lib/psqlodbcw.so' | sudo tee -a /etc/odbcinst.ini > /dev/null
echo 'UsageCount=1' | sudo tee -a /etc/odbcinst.ini > /dev/null
shell: bash

- name: Run ODBC Tests
if: always() && steps.install-sql-server-odbc-driver.outcome == 'success' && steps.install-psql-odbc-driver.outcome == 'success'
run: |
cd test/odbc
cmake -S . -B build
cmake --build build
MSSQL_ODBC_DRIVER_NAME="ODBC Driver 17 for SQL Server" \
MSSQL_BABEL_DB_SERVER=localhost \
MSSQL_BABEL_DB_PORT=1433 \
MSSQL_BABEL_DB_USER=jdbc_user \
MSSQL_BABEL_DB_PASSWORD=12345678 \
MSSQL_BABEL_DB_NAME=master \
PSQL_ODBC_DRIVER_NAME=ODBC_Driver_16_for_PostgreSQL \
PSQL_BABEL_DB_SERVER=localhost \
PSQL_BABEL_DB_PORT=5432 \
PSQL_BABEL_DB_USER=jdbc_user \
PSQL_BABEL_DB_PASSWORD=12345678 \
PSQL_BABEL_DB_NAME=jdbc_testdb \
./build/main
shell: bash
43 changes: 43 additions & 0 deletions .github/composite-actions/install-and-run-python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Run Python Tests'
description: 'Install and Run Babel Python test framework'

runs:
using: "composite"
steps:
- name: Install Python
id: install-python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Configure Python Environment
id: configure-python-environment
if: always() && steps.install-python.outcome == 'success'
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
mkdir sqltoolsservice
cd sqltoolsservice
wget https://github.com/microsoft/sqltoolsservice/releases/download/4.4.0.12/Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz && tar -xzvf Microsoft.SqlTools.ServiceLayer-rhel-x64-net6.0.tar.gz
cd ../
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 python3-dev
pip3 install pyodbc==4.0.35 pymssql pytest pytest-xdist
shell: bash

- name: Run Python Tests
if: always() && steps.configure-python-environment.outcome == 'success'
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=jdbc_user \
fileGenerator_password=12345678 \
pytest -s --tb=long -q .
shell: bash
13 changes: 13 additions & 0 deletions .github/composite-actions/run-jdbc-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Run JDBC Tests'
description: 'Run Babel JDBC test framework'

runs:
using: "composite"
steps:
- name: Run JDBC Tests
run: |
export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
cd test/JDBC/
mvn test
shell: bash
Loading
Loading