Skip to content

Commit

Permalink
Trying github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jgebal committed Nov 23, 2021
1 parent a0b235a commit 99463f0
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and deploy snapshot

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

workflow_dispatch:

jobs:
env:
UTPLSQL_VERSION: ${{matrix.utplsql-version}}
DB_IMAGE: ${{matrix.db_image}}
build:

runs-on: ubuntu-latest
startegy:
matrix:
utplsql-version: [develop, v3.0.0, v3.1.6, v3.1.11]
db_image: gvenzl/oracle-xe:11-full

services:
oracle:
image: ${{matrix.db_image}}
env:
ORACLE_PASSWORD: oracle
ports:
- 1521:1521
# options: >-
# --health-cmd healthcheck.sh
# --health-interval 10s
# --health-timeout 5s
# --health-retries 10

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install utPLSQL ${{matrix.utplsql-version}}
run: echo Installing ${UTPLSQL_VERSION} && sh ${{ github.workspace }}/scripts/1_install_utplsql.sh

- name: Install utPLSQL-cli
run: curl -Lk -o utPLSQL-cli.zip "https://github.com/utPLSQL/utPLSQL-cli/releases/download/v3.1.8/utPLSQL-cli.zip" && unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli

- name: Install demo project
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh

- name: Install unit tests
run: sh ${{ github.workspace }}/scripts/3_install_tests.sh

- name: Install run tests
run: sh ${{ github.workspace }}/scripts/4_run_tests.sh

1 change: 1 addition & 0 deletions scripts/0_start_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim
4 changes: 4 additions & 0 deletions scripts/1_install_utplsql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git utPLSQL

docker run --rm -v $(pwd)/utPLSQL:/utPLSQL -w /utPLSQL/source --network host \
--entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users
16 changes: 16 additions & 0 deletions scripts/2_install_demo_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
sys/oracle@//127.0.0.1:1521/XE as sysdba @source/create_users.sql

docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @source/award_bonus/employees_test.sql
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @source/award_bonus/award_bonus.prc

docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @source/between_string/betwnstr.fnc

docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @source/remove_rooms_by_name/rooms.sql
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @source/remove_rooms_by_name/remove_rooms_by_name.prc

14 changes: 14 additions & 0 deletions scripts/3_install_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/award_bonus/test_award_bonus.pks
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/award_bonus/test_award_bonus.pkb

docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/between_string/test_betwnstr.pks
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/between_string/test_betwnstr.pkb

docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/remove_rooms_by_name/test_remove_rooms_by_name.pks
docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \
ut3_demo/ut3_demo@//127.0.0.1:1521/XE @test/remove_rooms_by_name/test_remove_rooms_by_name.pkb
11 changes: 11 additions & 0 deletions scripts/4_run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -ev

utPLSQL-cli/bin/utplsql run ut3_demo/ut3_demo@//127.0.0.1:1521/XE \
-source_path=source -test_path=test \
-f=ut_documentation_reporter -c \
-f=ut_coverage_sonar_reporter -o=coverage.xml \
-f=ut_sonar_test_reporter -o=test_results.xml \
--failure-exit-code=0

6 changes: 6 additions & 0 deletions source/create_users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
create user ut3_demo identified by ut3_demo quota unlimited on USERS default tablespace USERS;

grant create session, create procedure, create type, create table, create sequence, create view to ut3_demo;
grant select any dictionary to ut3_demo;

exit

0 comments on commit 99463f0

Please sign in to comment.