forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor github workflows (babelfish-for-postgresql#95)
Remove a lot of duplicated code between the various workflows by using Github composite actions.
- Loading branch information
Showing
14 changed files
with
371 additions
and
452 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'Build Extensions' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: 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 | ||
shell: bash |
16 changes: 16 additions & 0 deletions
16
.github/composite-actions/build-modified-postgres/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,16 @@ | ||
name: 'Build Modified Postgres' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout, Build, and Install the Modified PostgreSQL Instance and Run Tests | ||
run: | | ||
cd .. | ||
git clone https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git | ||
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 | ||
make check | ||
cd contrib && make && sudo make install | ||
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,22 @@ | ||
name: 'Compile ANTLR' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: Compile ANTLR | ||
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 -j 4 | ||
sudo make install | ||
cp "/usr/local/lib/libantlr4-runtime.so.$ANTLR_VERSION" ~/postgres/lib/ | ||
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,12 @@ | ||
name: 'Install Dependencies' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Dependencies | ||
run: | | ||
cd ~ | ||
sudo apt-get update | ||
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 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 mssql-tools unixodbc-dev | ||
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,21 @@ | ||
name: 'Install Extensions' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Extensions | ||
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 | ||
~/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" -f .github/scripts/create_extension.sql | ||
sqlcmd -S localhost -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO" | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
name: Dotnet Framework Tests | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
run-babelfish-dotnet-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
id: checkout | ||
|
||
- 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' | ||
uses: ./.github/composite-actions/install-extensions | ||
|
||
- name: Install Dotnet | ||
id: install-dotnet | ||
if: always() && steps.install-extensions.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 | ||
- 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;TestTvp.txt;TestAuthentication.txt;TestText.txt" \ | ||
dotnet test |
Oops, something went wrong.