Skip to content

Commit 92a7cff

Browse files
author
ahernandez
committed
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL-maven-plugin.git into develop
2 parents ee999b8 + 54ec57f commit 92a7cff

File tree

8 files changed

+278
-0
lines changed

8 files changed

+278
-0
lines changed

.travis.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
sudo: required
2+
language: java
3+
4+
services:
5+
- docker
6+
7+
jdk:
8+
- oraclejdk8
9+
10+
env:
11+
global:
12+
- DOCKER_CFG=$HOME/.docker
13+
- DOCKER_REPO="utplsqlv3/oracledb"
14+
- CACHE_DIR=$HOME/.cache
15+
- MAVEN_HOME=/usr/local/maven
16+
- MAVEN_CFG=$HOME/.m2
17+
- DB_URL="127.0.0.1:1521:XE"
18+
- DB_USER=app
19+
- DB_PASS=app
20+
- ORACLE_VERSION="11g-r2-xe"
21+
- DOCKER_OPTIONS="--shm-size=1g"
22+
23+
cache:
24+
directories:
25+
- $DOCKER_CFG
26+
- $CACHE_DIR
27+
- $MAVEN_CFG
28+
29+
install:
30+
- bash .travis/maven_cfg.sh
31+
- bash .travis/start_db.sh
32+
- bash .travis/install_utplsql.sh
33+
- bash .travis/install_demo_project.sh
34+
35+
script:
36+
- mvn package -ddbUrl="${DB_URL}" -ddbUser="${DB_USER}" -ddbPass="${DB_PASS}"
37+
38+
#before_deploy:
39+
# - bash .travis/create_release.sh
40+
# - if [ ! -z "$TRAVIS_TAG" ]; then VERSION=$(tr -d "/v/" <<<$TRAVIS_TAG); mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=${VERSION}; fi
41+
#
42+
#deploy:
43+
# - provider: releases
44+
# api_key: $GITHUB_API_TOKEN
45+
# file: utPLSQL-cli.zip
46+
# skip_cleanup: true
47+
# on:
48+
# repository: utPLSQL/utPLSQL-cli
49+
# tags: true
50+
# - provider: bintray
51+
# file: bintray.json
52+
# user: ${BINTRAY_USER}
53+
# key: ${BINTRAY_API_KEY}
54+
# dry-run: false
55+
# skip_cleanup: true
56+
# on:
57+
# repository: utPLSQL/utPLSQL-cli
58+
# branch: develop
59+
#
60+
61+
notifications:
62+
slack:
63+
rooms:
64+
- secure: "Gz0pGOOM6xbnz8Q/B3RzOFoVr8QGXsDSHcgCloPnO3ZkEOh4JJikqWAVdZrksMxhewIBRpbdIWAZOgsNXvW+cEDXxfml3X9Clj2wg5Uon97UeI+5WEHDhLYHn7t9EYr9QvVSOuQgBIiddk6kURxY4N0eAA4VUti8BDcMRq+gPxF1w/toFJXVR/I/tkLxcHPTbWQ9X87nNWcQgMoHe2AixYpglntmtoLXJ5F8MF08fcyTX7GJQ5xjq7HbYy+/39nEhQo2ZPhHHfk2rS6gIUY0wc+MAqobxvesplgGDybdTQyrdl48VjJ/CiQDedglUbNN9VYTFjPIYMdWCUCLV1uL866aNMiBpB7CQoNhi5WS7RERE9gblVPX2k6tOda27fEWlhjha6OmdK6TQ9qTITU7U4OTSOz41dDPeVfqMHRggxo3ozlLONTiZ1y9fz/Ez9WjiJjtUDt60vgnVIo7BcQV/yDJcqAtQbfWyf0n73g5lMBvLGnO2Agm2N7hNEeCbpr+PZUoqkEM/e4SxdUCQGi8Ppi9Zp0E4v0iG7hyjzol+G4T8JN0bUGg0OOow/bfZa5J2aUsrC1qP/ZLpMA94NI6ZlL2wRHhZ9JtVSDLjtSwq9yW5XF7o7kdqBWBCslbGnYPoCoHOzfZuUvArSlRoGNu75dw/Qhoo9gFl1RG/RlChaU="
65+
on_success: change
66+
on_failure: always

.travis/create_api_user.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA <<EOF
5+
create user api identified by api
6+
quota unlimited on USERS
7+
default tablespace USERS;
8+
grant create session,
9+
create procedure,
10+
create type,
11+
create table,
12+
create sequence,
13+
create view
14+
to api;
15+
grant select any dictionary to api;
16+
exit;
17+
EOF

.travis/create_release.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
VERSION=`date +%Y%m%d%H%M`
5+
6+
#overcome maven assemble issue: https://github.com/mojohaus/appassembler/issues/61
7+
sed -i '/CYGWIN\*) cygwin=true/c\ CYGWIN*|MINGW*) cygwin=true ;;' target/appassembler/bin/utplsql
8+
9+
mkdir dist
10+
mv target/appassembler utPLSQL-cli
11+
# Remove Oracle libraries du to licensing problems
12+
rm -f utPLSQL-cli/lib/ucp*.jar
13+
rm -f utPLSQL-cli/lib/ojdbc8*.jar
14+
rm -f utPLSQL-cli/lib/orai18n*.jar
15+
16+
zip -r -q dist/utPLSQL-cli-${TRAVIS_BRANCH}-${VERSION}.zip utPLSQL-cli
17+
zip -r -q utPLSQL-cli.zip utPLSQL-cli
18+
19+
cat > bintray.json <<EOF
20+
{
21+
"package": {
22+
"name": "utPLSQL-cli-${TRAVIS_BRANCH}",
23+
"repo": "utPLSQL-cli",
24+
"subject": "utplsql",
25+
"website_url": "https://github.com/utPLSQL/utPLSQL-cli",
26+
"vcs_url": "https://github.com/utPLSQL/utPLSQL-cli.git",
27+
"licenses": [ "MIT" ]
28+
},
29+
"version": { "name": "${TRAVIS_BRANCH}" },
30+
"files": [ { "includePattern": "dist/(.*)", "uploadPattern": "\$1" } ],
31+
"publish": true
32+
}
33+
EOF

.travis/install_demo_project.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -ev
3+
cd $(dirname $(readlink -f $0))
4+
5+
PROJECT_FILE="utPLSQL-demo-project"
6+
git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL-demo-project.git
7+
8+
cat > demo_project.sh.tmp <<EOF
9+
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA <<SQL
10+
create user ${DB_USER} identified by ${DB_PASS} quota unlimited on USERS default tablespace USERS;
11+
grant create session, create procedure, create type, create table, create sequence, create view to ${DB_USER};
12+
grant select any dictionary to ${DB_USER};
13+
exit
14+
SQL
15+
16+
cd ${PROJECT_FILE}
17+
sqlplus -S -L ${DB_USER}/${DB_PASS}@//127.0.0.1:1521/xe <<SQL
18+
whenever sqlerror exit failure rollback
19+
whenever oserror exit failure rollback
20+
21+
@source/award_bonus/employees_test.sql
22+
@source/award_bonus/award_bonus.prc
23+
24+
@source/between_string/betwnstr.fnc
25+
26+
@source/remove_rooms_by_name/rooms.sql
27+
@source/remove_rooms_by_name/remove_rooms_by_name.prc
28+
29+
@test/award_bonus/test_award_bonus.pks
30+
@test/award_bonus/test_award_bonus.pkb
31+
32+
@test/between_string/test_betwnstr.pks
33+
@test/between_string/test_betwnstr.pkb
34+
35+
@test/remove_rooms_by_name/test_remove_rooms_by_name.pks
36+
@test/remove_rooms_by_name/test_remove_rooms_by_name.pkb
37+
38+
exit
39+
SQL
40+
EOF
41+
42+
docker cp ./$PROJECT_FILE $ORACLE_VERSION:/$PROJECT_FILE
43+
docker cp ./demo_project.sh.tmp $ORACLE_VERSION:/demo_project.sh
44+
docker exec $ORACLE_VERSION bash demo_project.sh

.travis/install_utplsql.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -ev
3+
cd $(dirname $(readlink -f $0))
4+
5+
# Download the specified version of utPLSQL.
6+
UTPLSQL_VERSION="v3.0.4"
7+
UTPLSQL_FILE="utPLSQL"
8+
curl -L -O "https://github.com/utPLSQL/utPLSQL/releases/download/$UTPLSQL_VERSION/$UTPLSQL_FILE.tar.gz"
9+
10+
# Download develop branch of utPLSQL.
11+
#UTPLSQL_VERSION="develop"
12+
#UTPLSQL_FILE="utPLSQL"
13+
#git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
14+
# tar -czf $UTPLSQL_FILE.tar.gz $UTPLSQL_FILE && rm -rf $UTPLSQL_FILE
15+
16+
# Create a temporary install script.
17+
cat > install.sh.tmp <<EOF
18+
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
19+
cd ${UTPLSQL_FILE}/source
20+
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA @install_headless.sql ut3 ut3 users
21+
EOF
22+
23+
# Copy utPLSQL files to the container and install it.
24+
docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz
25+
# docker cp ./$UTPLSQL_FILE $ORACLE_VERSION:/$UTPLSQL_FILE
26+
docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh
27+
docker cp ./create_api_user.sh $ORACLE_VERSION:/create_api_user.sh
28+
29+
# Remove temporary files.
30+
# rm $UTPLSQL_FILE.tar.gz
31+
rm -rf $UTPLSQL_FILE
32+
rm install.sh.tmp
33+
34+
# Execute the utPLSQL installation inside the container.
35+
docker exec $ORACLE_VERSION bash install.sh
36+
docker exec $ORACLE_VERSION bash create_api_user.sh

.travis/maven_cfg.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -ev
3+
cd $(dirname $(readlink -f $0))
4+
5+
# Download wagon-http recommended by Oracle.
6+
# On maven latest version this is not needed, but travis doesn't have it.
7+
if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then
8+
curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
9+
mv wagon-http-2.8-shaded.jar $CACHE_DIR/
10+
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
11+
else
12+
echo "Using cached wagon-http..."
13+
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
14+
fi
15+
16+
cp settings.xml $MAVEN_CFG/settings.xml
17+

.travis/settings.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
25+
26+
<servers>
27+
<server>
28+
<id>maven.oracle.com</id>
29+
<username>${env.ORACLE_OTN_USER}</username>
30+
<password>${env.ORACLE_OTN_PASSWORD}</password>
31+
<configuration>
32+
<basicAuthScope>
33+
<host>ANY</host>
34+
<port>ANY</port>
35+
<realm>OAM 11g</realm>
36+
</basicAuthScope>
37+
<httpConfiguration>
38+
<all>
39+
<params>
40+
<property>
41+
<name>http.protocol.allow-circular-redirects</name>
42+
<value>%b,true</value>
43+
</property>
44+
</params>
45+
</all>
46+
</httpConfiguration>
47+
</configuration>
48+
</server>
49+
</servers>
50+
51+
</settings>

.travis/start_db.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
# If docker credentials are not cached, do the login.
5+
if [ ! -f $DOCKER_CFG/config.json ]; then
6+
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
7+
else
8+
echo "Using docker login from cache..."
9+
fi
10+
11+
# Pull the specified db version from docker hub.
12+
docker pull $DOCKER_REPO:$ORACLE_VERSION
13+
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 1521:1521 $DOCKER_REPO:$ORACLE_VERSION
14+
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered

0 commit comments

Comments
 (0)