-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added jdbc test workflow for 2-x-dev
- Loading branch information
Rohit Bhagat
committed
Nov 23, 2023
1 parent
b978d8c
commit 78f4e3d
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
.github/workflows/jdbc-tests-with-non-default-params-2-x-dev.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,100 @@ | ||
name: JDBC Tests | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
run-babelfish-jdbc-tests: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: babelfish-for-postgresql/babelfish_extensions | ||
ref: BABEL_2_X_DEV | ||
|
||
- name: Install Dependencies | ||
id: install-dependencies | ||
if: always() | ||
uses: ./.github/composite-actions/install-dependencies | ||
|
||
- name: Build Modified Postgres | ||
id: build-modified-postgres | ||
if: always() && steps.install-dependencies.outcome == 'success' | ||
uses: ./.github/composite-actions/build-modified-postgres | ||
|
||
- name: Compile ANTLR | ||
id: compile-antlr | ||
if: always() && steps.build-modified-postgres.outcome == 'success' | ||
uses: ./.github/composite-actions/compile-antlr | ||
|
||
- name: Build Extensions | ||
id: build-extensions | ||
if: always() && steps.compile-antlr.outcome == 'success' | ||
uses: ./.github/composite-actions/build-extensions | ||
|
||
- name: Install Extensions | ||
id: install-extensions | ||
if: always() && steps.build-extensions.outcome == 'success' | ||
run: | | ||
cd ~ | ||
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 | ||
sudo echo "babelfishpg_tsql.server_collation_name = 'chinese_prc_ci_as'" >> postgresql.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="jdbc_user" -v db="jdbc_testdb" -v migration_mode="single-db" -v parallel_query_mode=false -f .github/scripts/create_extension.sql | ||
sqlcmd -S localhost -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO" | ||
shell: bash | ||
|
||
- name: Run JDBC Tests | ||
id: jdbc | ||
if: always() && steps.install-extensions.outcome == 'success' | ||
timeout-minutes: 60 | ||
run: | | ||
cd test/JDBC/ | ||
mvn test | ||
- name: Cleanup babelfish database | ||
id: cleanup | ||
if: always() && steps.install-extensions.outcome == 'success' | ||
run: | | ||
sudo ~/postgres/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql | ||
- name: Upload Log | ||
if: always() && steps.jdbc.outcome == '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 | ||
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 == '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.jdbc.outcome == 'failure' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: output-diff.diff | ||
path: test/JDBC/Info/output-diff.diff |