Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
simasch committed Nov 20, 2021
2 parents 190ade9 + c93271d commit 58afcd0
Show file tree
Hide file tree
Showing 92 changed files with 5,016 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Eclipse
.classpath
.project
.settings/

# Intellij
.idea/
*.iml
*.iws

# Mac
.DS_Store

# Bash
*.swp

# Maven
log/
target/
.mvn
log.txt
**/pom.xml.versionsBackup
dependency-reduced-pom.xml

# Docs
doc/
62 changes: 62 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
sudo: required
language: java

services:
- docker

jdk:
- openjdk8

env:
global:
- DOCKER_CFG=$HOME/.docker
- DOCKER_REPO="utplsqlv3/oracledb"
- CACHE_DIR=$HOME/.cache
- MAVEN_HOME=/usr/local/maven
- MAVEN_CFG=$HOME/.m2
- DB_URL="127.0.0.1:1521:XE"
- DB_UT3_USER=ut3
- DB_UT3_PASS=ut3
- ORACLE_VERSION="11g-r2-xe"
- DOCKER_OPTIONS="--shm-size=1g"

cache:
directories:
- $DOCKER_CFG
- $CACHE_DIR
- $MAVEN_CFG

install:
- bash .travis/maven_cfg.sh
- bash .travis/start_db.sh
- bash .travis/install_utplsql.sh
- bash .travis/install_demo_project.sh

script:
- echo "Run Verify with Coverage"
- mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}"

before_deploy:
- echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import
- echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust

deploy:
- provider: script
skip_cleanup: true
script: bash .travis/deploy_snapshot.sh
on:
repo: utPLSQL/utPLSQL-maven-plugin
branch: develop
- provider: script
skip_cleanup: true
script: bash .travis/deploy_release.sh
on:
repo: utPLSQL/utPLSQL-maven-plugin
branch: main

notifications:
slack:
rooms:
- secure: "Gz0pGOOM6xbnz8Q/B3RzOFoVr8QGXsDSHcgCloPnO3ZkEOh4JJikqWAVdZrksMxhewIBRpbdIWAZOgsNXvW+cEDXxfml3X9Clj2wg5Uon97UeI+5WEHDhLYHn7t9EYr9QvVSOuQgBIiddk6kURxY4N0eAA4VUti8BDcMRq+gPxF1w/toFJXVR/I/tkLxcHPTbWQ9X87nNWcQgMoHe2AixYpglntmtoLXJ5F8MF08fcyTX7GJQ5xjq7HbYy+/39nEhQo2ZPhHHfk2rS6gIUY0wc+MAqobxvesplgGDybdTQyrdl48VjJ/CiQDedglUbNN9VYTFjPIYMdWCUCLV1uL866aNMiBpB7CQoNhi5WS7RERE9gblVPX2k6tOda27fEWlhjha6OmdK6TQ9qTITU7U4OTSOz41dDPeVfqMHRggxo3ozlLONTiZ1y9fz/Ez9WjiJjtUDt60vgnVIo7BcQV/yDJcqAtQbfWyf0n73g5lMBvLGnO2Agm2N7hNEeCbpr+PZUoqkEM/e4SxdUCQGi8Ppi9Zp0E4v0iG7hyjzol+G4T8JN0bUGg0OOow/bfZa5J2aUsrC1qP/ZLpMA94NI6ZlL2wRHhZ9JtVSDLjtSwq9yW5XF7o7kdqBWBCslbGnYPoCoHOzfZuUvArSlRoGNu75dw/Qhoo9gFl1RG/RlChaU="
on_success: change
on_failure: always
7 changes: 7 additions & 0 deletions .travis/deploy_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -ev

VERSION=$(tr -d "/v/" <<<${TRAVIS_TAG})
mvn org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=${VERSION}

mvn deploy -DskipTests -U -Prelease
12 changes: 12 additions & 0 deletions .travis/deploy_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ev

#DATE=`date +%Y%m%d%H%M`
# Using this solution to get version into variable: https://stackoverflow.com/a/26514030/1470603
#OLD_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
#VERSION=`sed "s/-SNAPSHOT/-${DATE}-SNAPSHOT/g" <<<"${OLD_VERSION}"`

#echo "Changing snapshot version, OLD: ${OLD_VERSION} NEW: ${VERSION}"
#mvn org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=${VERSION}

mvn deploy -DskipTests -U -Prelease
18 changes: 18 additions & 0 deletions .travis/install_demo_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -ev

DB_URL="//127.0.0.1:1521/XE"
SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION}
VOLUME="/project"

docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
sys/oracle@${DB_URL} as sysdba @.travis/sql/create_users.sql

docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
app/pass@${DB_URL} @.travis/sql/create_app_objects.sql

docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
code_owner/pass@${DB_URL} @.travis/sql/create_source_owner_objects.sql

docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
tests_owner/pass@${DB_URL} @.travis/sql/create_tests_owner_objects.sql
14 changes: 14 additions & 0 deletions .travis/install_utplsql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -ev
cd $(dirname $(readlink -f $0))

DB_URL="//127.0.0.1:1521/XE"
UTPLSQL_VERSION="v3.1.9"
UTPLSQL_DIR="utPLSQL"
SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION}
VOLUME="/utPLSQL"

git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR}

docker run --rm -v $(pwd)/${UTPLSQL_DIR}:${VOLUME} -w ${VOLUME}/source --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
sys/oracle@${DB_URL} as sysdba @install_headless.sql ${DB_UT3_USER} ${DB_UT3_PASS} users
5 changes: 5 additions & 0 deletions .travis/maven_cfg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -ev
cd $(dirname $(readlink -f $0))

cp settings.xml $MAVEN_CFG/settings.xml
26 changes: 26 additions & 0 deletions .travis/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>

<servers>
<server>
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
9 changes: 9 additions & 0 deletions .travis/sql/create_app_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

@src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab
@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc
@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy

@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc
@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy
6 changes: 6 additions & 0 deletions .travis/sql/create_source_owner_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

@src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab
@src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql
@src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql
7 changes: 7 additions & 0 deletions .travis/sql/create_tests_owner_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

create synonym TO_TEST_ME for CODE_OWNER.TO_TEST_ME;
create synonym PKG_TEST_ME for CODE_OWNER.PKG_TEST_ME;
@src/test/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql
@src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql
30 changes: 30 additions & 0 deletions .travis/sql/create_users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback
set echo off
set verify off

define UTPLSQL_USER = 'UT3';
define APP_USER = 'APP';
define CODE_OWNER = 'CODE_OWNER';
define TESTS_OWNER = 'TESTS_OWNER';
define DB_PASS = 'pass';

grant execute any procedure to &UTPLSQL_USER;
grant create any procedure to &UTPLSQL_USER;
grant execute on dbms_lob to &UTPLSQL_USER;
grant execute on dbms_sql to &UTPLSQL_USER;
grant execute on dbms_xmlgen to &UTPLSQL_USER;
grant execute on dbms_lock to &UTPLSQL_USER;

create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER;
grant select any dictionary to &APP_USER;

create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER;

create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER;
grant select any dictionary to &TESTS_OWNER;
grant select any table, delete any table, drop any table to &TESTS_OWNER;
grant execute any procedure to &TESTS_OWNER;
14 changes: 14 additions & 0 deletions .travis/start_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -ev

# If docker credentials are not cached, do the login.
if [ ! -f $DOCKER_CFG/config.json ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
else
echo "Using docker login from cache..."
fi

# Pull the specified db version from docker hub.
docker pull $DOCKER_REPO:$ORACLE_VERSION
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 127.0.0.1:1521:1521 $DOCKER_REPO:$ORACLE_VERSION
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
Loading

0 comments on commit 58afcd0

Please sign in to comment.