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

Skip to content

Commit ae4bf27

Browse files
committed
Addes scripts
1 parent d926fa6 commit ae4bf27

12 files changed

+103
-103
lines changed

.github/workflows/build.yml

+5-30
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,17 @@ defaults:
1414

1515
jobs:
1616
build:
17-
name: Test on JDK ${{ matrix.jdk }} with utPLSQL ${{ matrix.utplsql_version }}
1817
runs-on: ubuntu-latest
18+
1919
env:
2020
ORACLE_VERSION: "gvenzl/oracle-xe:18.4.0-slim"
21-
UTPLSQL_VERSION: ${{matrix.utplsql_version}}
21+
UTPLSQL_VERSION: "3.1.13"
2222
UTPLSQL_FILE: ${{matrix.utplsql_file}}
2323
ORACLE_PASSWORD: oracle
2424
DB_URL: "127.0.0.1:1521:XE"
2525
DB_USER: app
2626
DB_PASS: app
2727

28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
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","v3.1.11","v3.1.13","develop" ]
32-
utplsql_file: [ "utPLSQL" ]
33-
jdk: [ '8' ]
34-
include:
35-
- utplsql_version: "v3.0.0"
36-
jdk: '8'
37-
utplsql_file: "utPLSQLv3.0.0"
38-
- utplsql_version: "develop"
39-
jdk: '9'
40-
utplsql_file: "utPLSQL"
41-
- utplsql_version: "develop"
42-
jdk: '10'
43-
utplsql_file: "utPLSQL"
44-
- utplsql_version: "develop"
45-
jdk: '11'
46-
utplsql_file: "utPLSQL"
47-
- utplsql_version: "develop"
48-
jdk: '12'
49-
utplsql_file: "utPLSQL"
50-
- utplsql_version: "develop"
51-
jdk: '13'
52-
utplsql_file: "utPLSQL"
5328
services:
5429
oracle:
5530
image: gvenzl/oracle-xe:18.4.0-slim
@@ -69,11 +44,11 @@ jobs:
6944
with:
7045
fetch-depth: 0
7146

72-
- name: Install utPLSQL
73-
run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh
47+
- name: Install utplsql
48+
run: scripts/install_utplsql.sh
7449

7550
- name: Install demo project
76-
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh
51+
run: scripts/install_demo_project.sh
7752

7853
- name: Set up JDK 11
7954
uses: actions/setup-java@v2

scripts/0_start_db.sh

-1
This file was deleted.

scripts/1_install_utplsql.sh

-8
This file was deleted.

scripts/2_install_demo_project.sh

-11
This file was deleted.

scripts/create_api_user.sh

+17
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

scripts/install_demo_project.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
set -evx
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+
@source/install.sql
21+
exit
22+
SQL
23+
24+
sqlplus -S -L ${DB_USER}/${DB_PASS}@//127.0.0.1:1521/xe <<SQL
25+
whenever sqlerror exit failure rollback
26+
whenever oserror exit failure rollback
27+
@test/install.sql
28+
exit
29+
SQL
30+
EOF
31+
32+
docker cp ./${PROJECT_FILE} oracle:/${PROJECT_FILE}
33+
docker cp ./demo_project.sh.tmp oracle:/demo_project.sh
34+
docker exec oracle bash /demo_project.sh

scripts/install_utplsql.sh

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

scripts/sql/create_app_objects.sql

-9
This file was deleted.

scripts/sql/create_source_owner_objects.sql

-6
This file was deleted.

scripts/sql/create_tests_owner_objects.sql

-8
This file was deleted.

scripts/sql/create_users.sql

-30
This file was deleted.

scripts/start_db.sh

+14
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)