Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc27b12

Browse files
committed
Code refactor and trying build matrix.
1 parent 451e5ca commit bc27b12

7 files changed

Lines changed: 89 additions & 49 deletions

File tree

.travis.yml

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,45 @@ language: python
33

44
env:
55
global:
6-
- ORACLE_COOKIE=sqldev
7-
- ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
8-
- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
9-
- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
10-
- ORACLE_BASE=/u01/app/oracle
11-
- LD_LIBRARY_PATH=$ORACLE_HOME/lib
12-
- PATH=$PATH:$ORACLE_HOME/jdbc/lib:$ORACLE_HOME/bin
13-
- DATABASE_VERSION=11.2.0.2
14-
- ORACLE_SID=XE
15-
- DATABASE_NAME=XE
16-
- ORA_SDTZ='Europe/London' #Needed as a client parameter
17-
- TZ='Europe/London' #Needed as a DB Server parameter
6+
#- ORACLE_COOKIE=sqldev
7+
#- ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
8+
#- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
9+
#- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
10+
#- ORACLE_BASE=/u01/app/oracle
11+
#- LD_LIBRARY_PATH=$ORACLE_HOME/lib
12+
#- PATH=$PATH:$ORACLE_HOME/jdbc/lib:$ORACLE_HOME/bin
13+
#- DATABASE_VERSION=11.2.0.2
14+
#- ORACLE_SID=XE
15+
#- DATABASE_NAME=XE
16+
#- ORA_SDTZ='Europe/London' #Needed as a client parameter
17+
#- TZ='Europe/London' #Needed as a DB Server parameter
1818
- UT3_OWNER=ut3
1919
- UT3_OWNER_PASSWORD=ut3
2020
- UT3_OWNER_TABLESPACE=users
2121
- UT3_USER=ut3_user
2222
- UT3_USER_PASSWORD=ut3
2323
- UT3_USER_TABLESPACE=users
24-
# Target Branch and Directory for Deployment of Docs
24+
# Target Branch and Directory for Deployment of Docs
2525
- PAGES_TARGET_BRANCH="gh-pages"
2626
- PAGES_VERSION_BASE="version3"
27-
- SQLCLI=$HOME/.cache/sqlcl/bin/sql
27+
- CACHE_DIR=$HOME/.cache
28+
# Database Env
29+
- SQLCLI=sql
30+
- ORACLE_PWD=oracle
2831
- CONTAINER_IP=""
2932
- CONNECTION_STR=""
33+
- ORACLE_12cR1SE="12c-r1-se"
34+
- ORACLE_11gR2XE="11g-r2-xe"
35+
matrix:
36+
- ORACLE_VERSION=$ORACLE_12cR1SE
37+
- ORACLE_VERSION=$ORACLE_11gR2XE
3038

3139
addons:
3240
apt:
3341
packages:
3442
#packages required by oracle
35-
- bc
36-
- rpm
43+
#- bc
44+
#- rpm
3745
- unzip
3846
- oracle-java8-set-default
3947

@@ -42,35 +50,24 @@ services:
4250

4351
cache:
4452
directories:
45-
- .cache
46-
- $HOME/.cache
53+
#- .cache
54+
#- $HOME/.cache
55+
- $CACHE_DIR
4756

48-
before_install:
49-
- npm install -g phantomjs-prebuilt casperjs
50-
- bash .travis/download_sqlcl.sh
51-
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
52-
- docker pull viniciusam/oracle-12c-r1-se
57+
#before_install:
5358
# On trusty, download the zip file into a cachable directory
54-
#- test "$DIST" = precise || export ORACLE_ZIP_DIR=$HOME/.cache
59+
#- test "$DIST" = precise || export ORACLE_ZIP_DIR=$CACHE_DIR
5560
# If the zip file already exists, do not download it again
5661
#- test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh
5762

5863
install:
5964
- sudo pip install -r .travis/python_req.txt
65+
- npm install -g phantomjs-prebuilt casperjs
66+
- bash .travis/install_sqlcl.sh
67+
- bash .travis/start_db.sh
6068
#- bash .travis/oracle/install.sh
6169

6270
script:
63-
- docker run -d --name oracle-12c-r1-se -p 1521:1521 -p 5500:5500 viniciusam/oracle-12c-r1-se
64-
- docker logs -f oracle-12c-r1-se | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
65-
- docker exec oracle-12c-r1-se ./setPassword.sh oracle
66-
- CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' oracle-12c-r1-se)
67-
- CONNECTION_STR="$CONTAINER_IP:1521/ORCLPDB1"
68-
# TODO:
69-
# create oracle user
70-
# run the image using a volume owned by oracle user
71-
# save oradata to cache
72-
# run tests
73-
# next time get oradata from cache
7471
- bash .travis/create_utplsql_owner.sh
7572
- bash .travis/create_utplsql_user.sh
7673
- bash .travis/install_libraries.sh
@@ -79,7 +76,8 @@ script:
7976
- bash .travis/run_examples_as_owner.sh
8077
- bash .travis/run_test_as_owner.sh
8178
- bash .travis/run_examples_as_user.sh
82-
- bash .travis/create_release.sh
79+
#- bash .travis/create_release.sh
80+
8381
# - bash .travis/run_test_as_user.sh
8482
# - bash .travis/build_docs.sh
8583
# - bash .travis/push_docs_to_gh_pages.sh

.travis/create_utplsql_owner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ev
33

44
cd $(dirname "$(readlink -f "$0")")
55
#create user
6-
"$SQLCLI" -L -S sys/oracle@//$CONNECTION_STR AS SYSDBA <<SQL
6+
"$SQLCLI" -L -S sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<SQL
77
set echo off
88
@@create_utplsql_owner.sql $UT3_OWNER $UT3_OWNER_PASSWORD $UT3_OWNER_TABLESPACE
99
SQL

.travis/create_utplsql_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ev
33

44
cd $(dirname "$(readlink -f "$0")")
55
#create user
6-
"$SQLCLI" -L -S sys/oracle@//$CONNECTION_STR AS SYSDBA <<SQL
6+
"$SQLCLI" -L -S sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<SQL
77
set echo off
88
@@create_utplsql_user.sql $UT3_USER $UT3_USER_PASSWORD $UT3_USER_TABLESPACE
99
SQL

.travis/download_sqlcl.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.travis/grant_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -ev
44

55
cd source
66
#grant framework user
7-
"$SQLCLI" -L -S sys/oracle@//$CONNECTION_STR AS SYSDBA <<SQL
7+
"$SQLCLI" -L -S sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<SQL
88
@create_synonyms_and_grants_for_user.sql $UT3_OWNER $UT3_USER
99
SQL

.travis/install_sqlcl.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SQLCL_FILE=sqlcl-4.2.0.16.355.0402-no-jre.zip
5+
6+
# Download if not present on cache dir.
7+
if [ ! -f $CACHE_DIR/$SQLCL_FILE ]; then
8+
sh .travis/download.sh -p sqlcl
9+
mv $SQLCL_FILE $CACHE_DIR
10+
fi;
11+
12+
# Install sqlcl.
13+
unzip -q $CACHE_DIR/$SQLCL_FILE -d /usr/share
14+
ln -s /usr/share/sqlcl/bin/sql /usr/bin/sql
15+
16+
# Check if it is installed correctly.
17+
sql -v

.travis/start_db.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Create the dir to host oracledata and check if it is present on cache.
5+
mkdir -p $HOME/$ORACLE_VERSION && chmod -R 775 $HOME/$ORACLE_VERSION
6+
if [ ! -f $HOME/$ORACLE_VERSION.tar.gz ]; then
7+
tar -zxf $HOME/$ORACLE_VERSION.tar.gz -C $HOME/$ORACLE_VERSION
8+
fi
9+
10+
# Oracle 12c R1 SE
11+
if [ $ORACLE_VERSION = $ORACLE_12cR1SE ]; then
12+
docker login -u "$DOCKER_12cR1SE_USER" -p "$DOCKER_12cR1SE_PASS"
13+
docker run -d --name $ORACLE_VERSION -p 1521:1521 -v $HOME/$ORACLE_VERSION:/opt/oracle/oradata viniciusam/oracle-12c-r1-se
14+
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
15+
docker exec $ORACLE_VERSION ./setPassword.sh $ORACLE_PWD
16+
17+
export CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $ORACLE_VERSION)
18+
export CONNECTION_STR="$CONTAINER_IP:1521/ORCLPDB1"
19+
fi
20+
21+
# Oracle 11g R2 XE
22+
if [ $ORACLE_VERSION = $ORACLE_11gR2XE ]; then
23+
docker login -u "$DOCKER_11gR2XE_USER" -p "$DOCKER_11gR2XE_PASS"
24+
docker run --name $ORACLE_VERSION --shm-size=1g -p 1521:1521 -v $HOME/$ORACLE_VERSION:/u01/app/oracle/oradata vavellar/oracle-11g-r2-xe
25+
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
26+
docker exec $ORACLE_VERSION ./setPassword.sh $ORACLE_PWD
27+
28+
export CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $ORACLE_VERSION)
29+
export CONNECTION_STR="$CONTAINER_IP:1521/XE"
30+
fi
31+
32+
# Save the oracledata dir to cache.
33+
if [ ! -f $HOME/$ORACLE_VERSION.tar.gz ]; then
34+
tar -zcf $CACHE_DIR/$ORACLE_VERSION.tar.gz $HOME/$ORACLE_VERSION
35+
fi

0 commit comments

Comments
 (0)