Skip to content

Commit e32a71d

Browse files
pesseSamuel Nitsche
authored andcommitted
Just copied the travis settings from api project
don't understand them all yet, but let's see if it works
1 parent 7617e78 commit e32a71d

File tree

5 files changed

+128
-3
lines changed

5 files changed

+128
-3
lines changed

.travis.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
sudo: required
22
language: java
33

4+
services:
5+
- docker
6+
47
jdk:
58
- oraclejdk8
69

710
env:
811
global:
9-
- CACHE_DIR=$HOME/.cache
10-
- MAVEN_HOME=/usr/local/maven
11-
- MAVEN_CFG=$HOME/.m2
12+
- DOCKER_CFG=$HOME/.docker
13+
- DOCKER_REPO="viniciusam/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+
matrix:
21+
- ORACLE_VERSION="11g-xe-r2" DOCKER_OPTIONS="--shm-size=1g"
1222

1323
cache:
1424
directories:
25+
- $DOCKER_CFG
1526
- $CACHE_DIR
1627
- $MAVEN_CFG
1728

1829
install:
1930
- bash .travis/maven_cfg.sh
31+
- bash .travis/start_db.sh
32+
- bash .travis/install_utplsql.sh
33+
- bash .travis/install_demo_project.sh
2034

2135
script:
2236
- mvn package -DskipTests

.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/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/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)