forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create and use composite actions for code coverage workflow to improv…
…e maintainability (babelfish-for-postgresql#2100) Github actions for running jdbc, odbc, python and dotnet were copied from the respective workflow files into code-coverage workflow file. Now any changes in the original action demands a similar change in the code coverage file as well increasing redundant effort. To improve maintainability we move these actions to new composite actions and reuse them in workflows. Also added a new optional variable in build-modified-postgres/action.yml to optionally build postgres with the enable code coverage flag. Issues Resolved [BABEL-4605] Signed-off-by: Tanzeel Khan [email protected]
- Loading branch information
1 parent
2ec266a
commit 2f83efa
Showing
10 changed files
with
208 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.github/composite-actions/install-and-run-dotnet/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
43
.github/composite-actions/install-and-run-python/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.