From 99463f0035c4517a0b42a6ea6a55840c82828e86 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Tue, 23 Nov 2021 22:26:15 +0200 Subject: [PATCH] Trying github actions --- .github/workflows/build.yml | 55 +++++++++++++++++++++++++++++++ scripts/0_start_db.sh | 1 + scripts/1_install_utplsql.sh | 4 +++ scripts/2_install_demo_project.sh | 16 +++++++++ scripts/3_install_tests.sh | 14 ++++++++ scripts/4_run_tests.sh | 11 +++++++ source/create_users.sql | 6 ++++ 7 files changed, 107 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 scripts/0_start_db.sh create mode 100644 scripts/1_install_utplsql.sh create mode 100644 scripts/2_install_demo_project.sh create mode 100644 scripts/3_install_tests.sh create mode 100644 scripts/4_run_tests.sh create mode 100644 source/create_users.sql diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f819911 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 + diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh new file mode 100644 index 0000000..c5a8d7f --- /dev/null +++ b/scripts/0_start_db.sh @@ -0,0 +1 @@ +docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim diff --git a/scripts/1_install_utplsql.sh b/scripts/1_install_utplsql.sh new file mode 100644 index 0000000..07a5881 --- /dev/null +++ b/scripts/1_install_utplsql.sh @@ -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 diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh new file mode 100644 index 0000000..a2c481c --- /dev/null +++ b/scripts/2_install_demo_project.sh @@ -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 + diff --git a/scripts/3_install_tests.sh b/scripts/3_install_tests.sh new file mode 100644 index 0000000..36fe6e5 --- /dev/null +++ b/scripts/3_install_tests.sh @@ -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 diff --git a/scripts/4_run_tests.sh b/scripts/4_run_tests.sh new file mode 100644 index 0000000..8187c16 --- /dev/null +++ b/scripts/4_run_tests.sh @@ -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 + diff --git a/source/create_users.sql b/source/create_users.sql new file mode 100644 index 0000000..d9ee6fd --- /dev/null +++ b/source/create_users.sql @@ -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