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

Skip to content

Commit a4a0eb5

Browse files
authored
Merge pull request #102 from utPLSQL/feature/github_actions
Adding Github Action for building the project.
2 parents d86b771 + 5b28231 commit a4a0eb5

File tree

5 files changed

+138
-16
lines changed

5 files changed

+138
-16
lines changed

.github/workflows/build.yml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build, test, deploy documentation
2+
on:
3+
push:
4+
branches: [ develop ]
5+
tags:
6+
- v*
7+
pull_request:
8+
branches: [ develop ]
9+
workflow_dispatch:
10+
repository_dispatch:
11+
types: [utPLSQL-build]
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
build:
19+
name: Test on JDK ${{ matrix.jdk }} with utPLSQL ${{ matrix.utplsql_version }}
20+
runs-on: ubuntu-latest
21+
env:
22+
ORACLE_VERSION: "gvenzl/oracle-xe:18.4.0-slim"
23+
UTPLSQL_VERSION: ${{matrix.utplsql_version}}
24+
UTPLSQL_FILE: ${{matrix.utplsql_file}}
25+
ORACLE_PASSWORD: oracle
26+
DB_URL: "127.0.0.1:1521:XE"
27+
DB_USER: app
28+
DB_PASS: app
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
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","develop"]
34+
utplsql_file: ["utPLSQL"]
35+
jdk: ['8']
36+
include:
37+
- utplsql_version: "v3.0.0"
38+
jdk: '8'
39+
utplsql_file: "utPLSQLv3.0.0"
40+
- utplsql_version: "develop"
41+
jdk: '9'
42+
utplsql_file: "utPLSQL"
43+
- utplsql_version: "develop"
44+
jdk: '10'
45+
utplsql_file: "utPLSQL"
46+
- utplsql_version: "develop"
47+
jdk: '11'
48+
utplsql_file: "utPLSQL"
49+
- utplsql_version: "develop"
50+
jdk: '12'
51+
utplsql_file: "utPLSQL"
52+
- utplsql_version: "develop"
53+
jdk: '13'
54+
utplsql_file: "utPLSQL"
55+
services:
56+
oracle:
57+
image: gvenzl/oracle-xe:18.4.0-slim
58+
env:
59+
ORACLE_PASSWORD: oracle
60+
ports:
61+
- 1521:1521
62+
options: >-
63+
--health-cmd healthcheck.sh
64+
--health-interval 10s
65+
--health-timeout 5s
66+
--health-retries 10
67+
--name oracle
68+
69+
steps:
70+
- uses: actions/checkout@v2
71+
with:
72+
fetch-depth: 0
73+
- uses: actions/setup-java@v2
74+
with:
75+
distribution: 'adopt'
76+
java-version: ${{matrix.jdk}}
77+
cache: 'gradle'
78+
79+
- name: Install utplsql
80+
run: .travis/install_utplsql.sh
81+
82+
- name: Install demo project
83+
run: .travis/install_demo_project.sh
84+
85+
- name: Build and test
86+
run: ./gradlew check
87+
88+
deploy:
89+
name: Deploy snapshot
90+
needs: [ build ]
91+
concurrency: deploy
92+
runs-on: ubuntu-latest
93+
if: |
94+
github.repository == 'utPLSQL/utPLSQL-java-api' &&
95+
github.base_ref == null &&
96+
(github.ref == 'refs/heads/develop' || startsWith( github.ref, 'refs/tags/v' ) )
97+
steps:
98+
- uses: actions/checkout@v2
99+
with:
100+
fetch-depth: 0
101+
- uses: actions/setup-java@v2
102+
with:
103+
distribution: 'adopt'
104+
java-version: '8'
105+
cache: 'gradle'
106+
- name: Upload archives
107+
env:
108+
PACKAGECLOUD_TOKEN: ${{secrets.PACKAGECLOUD_TOKEN}}
109+
run: ./gradlew uploadArchives
110+
111+
slack-workflow-status:
112+
if: always()
113+
name: Post Workflow Status To Slack
114+
needs: [ build, deploy ]
115+
runs-on: ubuntu-latest
116+
steps:
117+
- name: Slack Workflow Notification
118+
uses: Gamesight/slack-workflow-status@master
119+
with:
120+
repo_token: ${{secrets.GITHUB_TOKEN}}
121+
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
122+
name: 'Github Actions[bot]'
123+
icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png'

.travis/create_api_user.sh

100644100755
File mode changed.

.travis/install_demo_project.sh

100644100755
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -ev
2+
set -evx
33
cd $(dirname $(readlink -f $0))
44

55
PROJECT_FILE="utPLSQL-demo-project"
@@ -13,7 +13,7 @@ grant select any dictionary to ${DB_USER};
1313
exit
1414
SQL
1515
16-
cd ${PROJECT_FILE}
16+
cd /${PROJECT_FILE}
1717
sqlplus -S -L ${DB_USER}/${DB_PASS}@//127.0.0.1:1521/xe <<SQL
1818
whenever sqlerror exit failure rollback
1919
whenever oserror exit failure rollback
@@ -39,6 +39,6 @@ exit
3939
SQL
4040
EOF
4141

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
42+
docker cp ./${PROJECT_FILE} oracle:/${PROJECT_FILE}
43+
docker cp ./demo_project.sh.tmp oracle:/demo_project.sh
44+
docker exec oracle bash /demo_project.sh

.travis/install_utplsql.sh

100644100755
+10-11
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,30 @@ cd $(dirname $(readlink -f $0))
44

55
# Download the specified version of utPLSQL.
66
if [ "$UTPLSQL_VERSION" == "develop" ]
7-
then
8-
git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
9-
tar -czf $UTPLSQL_FILE.tar.gz $UTPLSQL_FILE && rm -rf $UTPLSQL_FILE
7+
then
8+
git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
109
else
1110
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
1212
fi
1313

14+
chmod -R go+w ./${UTPLSQL_FILE}/{source,examples}
1415
# Create a temporary install script.
1516
cat > install.sh.tmp <<EOF
16-
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
17-
cd ${UTPLSQL_FILE}/source
17+
cd /${UTPLSQL_FILE}/source
1818
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA @install_headless.sql ut3 ut3 users
1919
EOF
2020

2121
# Copy utPLSQL files to the container and install it.
22-
docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz
22+
docker cp ./${UTPLSQL_FILE} oracle:/${UTPLSQL_FILE}
2323
# docker cp ./$UTPLSQL_FILE $ORACLE_VERSION:/$UTPLSQL_FILE
24-
docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh
25-
docker cp ./create_api_user.sh $ORACLE_VERSION:/create_api_user.sh
26-
24+
docker cp ./install.sh.tmp oracle:/install.sh
25+
docker cp ./create_api_user.sh oracle:/create_api_user.sh
2726
# Remove temporary files.
2827
# rm $UTPLSQL_FILE.tar.gz
2928
rm -rf $UTPLSQL_FILE
3029
rm install.sh.tmp
3130

3231
# Execute the utPLSQL installation inside the container.
33-
docker exec $ORACLE_VERSION bash install.sh
34-
docker exec $ORACLE_VERSION bash create_api_user.sh
32+
docker exec oracle bash /install.sh
33+
docker exec oracle bash /create_api_user.sh

.travis/start_db.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)