Skip to content

Commit

Permalink
Merge pull request #102 from utPLSQL/feature/github_actions
Browse files Browse the repository at this point in the history
Adding Github Action for building the project.
  • Loading branch information
jgebal committed Jan 14, 2022
2 parents d86b771 + 5b28231 commit a4a0eb5
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 16 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build, test, deploy documentation
on:
push:
branches: [ develop ]
tags:
- v*
pull_request:
branches: [ develop ]
workflow_dispatch:
repository_dispatch:
types: [utPLSQL-build]

defaults:
run:
shell: bash

jobs:
build:
name: Test on JDK ${{ matrix.jdk }} with utPLSQL ${{ matrix.utplsql_version }}
runs-on: ubuntu-latest
env:
ORACLE_VERSION: "gvenzl/oracle-xe:18.4.0-slim"
UTPLSQL_VERSION: ${{matrix.utplsql_version}}
UTPLSQL_FILE: ${{matrix.utplsql_file}}
ORACLE_PASSWORD: oracle
DB_URL: "127.0.0.1:1521:XE"
DB_USER: app
DB_PASS: app

strategy:
fail-fast: false
matrix:
utplsql_version: ["v3.0.1","v3.0.2","v3.0.3","v3.0.4","v3.1.1","v3.1.2","v3.1.3","v3.1.6","v3.1.7","v3.1.8","v3.1.9","v3.1.10","develop"]
utplsql_file: ["utPLSQL"]
jdk: ['8']
include:
- utplsql_version: "v3.0.0"
jdk: '8'
utplsql_file: "utPLSQLv3.0.0"
- utplsql_version: "develop"
jdk: '9'
utplsql_file: "utPLSQL"
- utplsql_version: "develop"
jdk: '10'
utplsql_file: "utPLSQL"
- utplsql_version: "develop"
jdk: '11'
utplsql_file: "utPLSQL"
- utplsql_version: "develop"
jdk: '12'
utplsql_file: "utPLSQL"
- utplsql_version: "develop"
jdk: '13'
utplsql_file: "utPLSQL"
services:
oracle:
image: gvenzl/oracle-xe:18.4.0-slim
env:
ORACLE_PASSWORD: oracle
ports:
- 1521:1521
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
--name oracle
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{matrix.jdk}}
cache: 'gradle'

- name: Install utplsql
run: .travis/install_utplsql.sh

- name: Install demo project
run: .travis/install_demo_project.sh

- name: Build and test
run: ./gradlew check

deploy:
name: Deploy snapshot
needs: [ build ]
concurrency: deploy
runs-on: ubuntu-latest
if: |
github.repository == 'utPLSQL/utPLSQL-java-api' &&
github.base_ref == null &&
(github.ref == 'refs/heads/develop' || startsWith( github.ref, 'refs/tags/v' ) )
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
cache: 'gradle'
- name: Upload archives
env:
PACKAGECLOUD_TOKEN: ${{secrets.PACKAGECLOUD_TOKEN}}
run: ./gradlew uploadArchives

slack-workflow-status:
if: always()
name: Post Workflow Status To Slack
needs: [ build, deploy ]
runs-on: ubuntu-latest
steps:
- name: Slack Workflow Notification
uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
name: 'Github Actions[bot]'
icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png'
Empty file modified .travis/create_api_user.sh
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions .travis/install_demo_project.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -ev
set -evx
cd $(dirname $(readlink -f $0))

PROJECT_FILE="utPLSQL-demo-project"
Expand All @@ -13,7 +13,7 @@ grant select any dictionary to ${DB_USER};
exit
SQL
cd ${PROJECT_FILE}
cd /${PROJECT_FILE}
sqlplus -S -L ${DB_USER}/${DB_PASS}@//127.0.0.1:1521/xe <<SQL
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback
Expand All @@ -39,6 +39,6 @@ exit
SQL
EOF

docker cp ./$PROJECT_FILE $ORACLE_VERSION:/$PROJECT_FILE
docker cp ./demo_project.sh.tmp $ORACLE_VERSION:/demo_project.sh
docker exec $ORACLE_VERSION bash demo_project.sh
docker cp ./${PROJECT_FILE} oracle:/${PROJECT_FILE}
docker cp ./demo_project.sh.tmp oracle:/demo_project.sh
docker exec oracle bash /demo_project.sh
21 changes: 10 additions & 11 deletions .travis/install_utplsql.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,30 @@ cd $(dirname $(readlink -f $0))

# Download the specified version of utPLSQL.
if [ "$UTPLSQL_VERSION" == "develop" ]
then
git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
tar -czf $UTPLSQL_FILE.tar.gz $UTPLSQL_FILE && rm -rf $UTPLSQL_FILE
then
git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
else
curl -L -O "https://github.com/utPLSQL/utPLSQL/releases/download/$UTPLSQL_VERSION/$UTPLSQL_FILE.tar.gz"
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
fi

chmod -R go+w ./${UTPLSQL_FILE}/{source,examples}
# Create a temporary install script.
cat > install.sh.tmp <<EOF
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
cd ${UTPLSQL_FILE}/source
cd /${UTPLSQL_FILE}/source
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA @install_headless.sql ut3 ut3 users
EOF

# Copy utPLSQL files to the container and install it.
docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz
docker cp ./${UTPLSQL_FILE} oracle:/${UTPLSQL_FILE}
# docker cp ./$UTPLSQL_FILE $ORACLE_VERSION:/$UTPLSQL_FILE
docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh
docker cp ./create_api_user.sh $ORACLE_VERSION:/create_api_user.sh

docker cp ./install.sh.tmp oracle:/install.sh
docker cp ./create_api_user.sh oracle:/create_api_user.sh
# Remove temporary files.
# rm $UTPLSQL_FILE.tar.gz
rm -rf $UTPLSQL_FILE
rm install.sh.tmp

# Execute the utPLSQL installation inside the container.
docker exec $ORACLE_VERSION bash install.sh
docker exec $ORACLE_VERSION bash create_api_user.sh
docker exec oracle bash /install.sh
docker exec oracle bash /create_api_user.sh
Empty file modified .travis/start_db.sh
100644 → 100755
Empty file.

0 comments on commit a4a0eb5

Please sign in to comment.