From 0354c1a009f78df774b5c264c297eee4aa4f2d71 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 24 Nov 2021 23:15:02 +0200 Subject: [PATCH 01/25] First attempt at running as github actions --- .github/workflows/build.yml | 122 ++++++++++++++++++++++++++++++++++ .travis/download.js | 56 ---------------- .travis/download.sh | 72 -------------------- .travis.yml => old.travis.yml | 0 4 files changed, 122 insertions(+), 128 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis/download.js delete mode 100755 .travis/download.sh rename .travis.yml => old.travis.yml (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..d3f4f0f4f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,122 @@ +name: Deploy and test +env: + UT3_DEVELOP_SCHEMA: UT3_DEVELOP + UT3_DEVELOP_SCHEMA_PASSWORD: ut3 + UT3_RELEASE_VERSION_SCHEMA: UT3 + UT3_RELEASE_VERSION_SCHEMA_PASSWORD: ut3 + UT3_USER: 'UT3\$USER#' + UT3_USER_PASSWORD: ut3 + UT3_TESTER: UT3_TESTER + UT3_TESTER_PASSWORD: ut3 + UT3_TESTER_HELPER: UT3_TESTER_HELPER + UT3_TESTER_HELPER_PASSWORD: ut3 + UT3_TABLESPACE: users + BUILD_DIR: ${{env.GITHUB_WORKSPACE}} + JOB_ID: ${{env.GITHUB_RUN_ID}} + JOB_NUMBER: ${{env.GITHUB_RUN_NUMBER}} + PULL_REQUEST_NAME: ${env.GITHUB_HEAD_REF} + PULL_REQUEST_BRANCH: ${{env.GITHUB_HEAD_REF}} + TAG_NAME: ${TRAVIS_TAG} + REPO_SLUG: ${TRAVIS_REPO_SLUG} + PR_SLUG: ${{env.GITHUB_REPOSITORY}} + BRANCH_NAME: ${TRAVIS_BRANCH} + # Environment for building a release + CURRENT_BRANCH: ${TRAVIS_BRANCH} + UTPLSQL_REPO: "utPLSQL/utPLSQL" + UTPLSQL_BUILD_NO: ${{env.GITHUB_RUN_ID}} + UTPLSQL_VERSION: $(. .travis/get_project_version.sh) + UTPLSQL_BUILD_VERSION: $(. .travis/get_project_build_version.sh) + UTPLSQL_SOURCES_DIR: 'source' + UTPLSQL_BUILD_USER_NAME: "Travis CI" + CACHE_DIR: $HOME/.cache + # Database Env + SQLCLI: "${BUILD_DIR}/sqlcl/bin/sql" + OJDBC_HOME: "${BUILD_DIR}/ojdbc" + ORACLE_PWD: "oracle" + DOCKHER_HUB_REPO: "utplsqlv3/oracledb" + DOCKER_VOLUME: "/home/oracle/host" + DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" + #utPLSQL released version directory + UTPLSQL_DIR: "utPLSQL_latest_release" + SELFTESTING_BRANCH: ${TRAVIS_BRANCH} + UTPLSQL_CLI_VERSION: "3.1.8" + # Maven + MAVEN_HOME: /usr/local/maven + MAVEN_CFG: $HOME/.m2 + +on: + push: + branches: [ develop, feature/github_actions ] + pull_request: + branches: [ develop ] + + workflow_dispatch: + +jobs: + build: + + env: + UTPLSQL_VERSION: ${{matrix.utplsql-version}} + + runs-on: ubuntu-latest + strategy: + matrix: + include: + - oracle-version: "gvenzl/oracle-xe:11-slim" + connection-str: '127.0.0.1:1521/XE' +# docker-options: '--shm-size=1g' +# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' + - oracle-version: "gvenzl/oracle-xe:18-slim" + connection-str: '127.0.0.1:1521/XE' + docker-options: '-e ORACLE_PASSWORD=oracle' +# - oracle-version: "utplsqlv3/oracledb:18c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "utplsqlv3/oracledb:19c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' + - oracle-version: "gvenzl/oracle-xe:21-full" + connection-str: '127.0.0.1:1521/XE' + docker-options: '-e ORACLE_PASSWORD=oracle' + + services: + oracle: + image: ${matrix.oracle-version} + env: + CONNECTION_STR: ${matrix.connection-str} + ORACLE_PASSWORD: oracle + ports: + - 1521:1521 + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + ${matrix.docker-options} + + 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: Run unit tests + run: sh ${{ github.workspace }}/scripts/4_run_tests.sh + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.travis/download.js b/.travis/download.js deleted file mode 100644 index 67c45fac6..000000000 --- a/.travis/download.js +++ /dev/null @@ -1,56 +0,0 @@ - -var casper = require("casper").create({ - // verbose: true, - // logLevel: "debug", - pageSettings: { - loadImages: false, - loadPlugins: false - } -}); - -if (casper.cli.args.length < 4) { - casper.echo("Missing parameters: username password agreementUrl downloadUrl").exit(1); -} - -// Script parameters. -var paramUsername = casper.cli.get(0); -var paramPassword = casper.cli.get(1); -var agreementUrl = casper.cli.get(2); -var downloadUrl = casper.cli.get(3); -var downloaded = false; - -phantom.addCookie({ - 'name': 'oraclelicense', - 'value': '152021', - 'domain': 'oracle.com' - }); - -casper.start(); -// TODO: Error handling. - - -// Try to access the download page, wait for redirection and submit the login form. -casper.thenOpen(downloadUrl).waitForUrl(/signon\.jsp$/, function (re) { - //this.echo("Injecting Login Info"); - this.evaluate(function (username, password) { - document.getElementById("sso_username").value = username; - document.getElementById("ssopassword").value = password; - doLogin(document.LoginForm); - }, paramUsername, paramPassword); - // this.capture("Screenshot.png"); -}); - -casper.on("resource.received", function (resource) { - //this.echo("Received something: " + resource.url); - if (resource.url.indexOf("AuthParam") !== -1 && !downloaded) { - //this.echo("DownloadUrl:"); - // Print the download url. - this.echo(resource.url); - downloaded = true; - // TODO: Try to download file from here. this.download is not working because of cross site request. - } -}); - -casper.run(function () { - this.exit(); -}); diff --git a/.travis/download.sh b/.travis/download.sh deleted file mode 100755 index 8dfa1942d..000000000 --- a/.travis/download.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -set -e - -if [ "$ORACLE_OTN_USER" == "" ] || [ "$ORACLE_OTN_PASSWORD" == "" ]; then - echo "Error: Oracle OTN username/password not specified." - exit 1 -fi - -PRODUCT="" - -# Call the casperjs script to return the download url. -# Then download the file using curl. -downloadFile() { - downloadUrl=$(exec casperjs download.js $ORACLE_OTN_USER $ORACLE_OTN_PASSWORD $1 $2) - downloadUrl=${downloadUrl%$'\r'} - echo "DownloadURL: $downloadUrl" - curl -o $3 -L "$downloadUrl" -} - -############################# -########### START ########### -############################# - -while getopts "p:" OPTNAME; do - case "${OPTNAME}" in - "p") PRODUCT="${OPTARG}" ;; - esac -done - -if [ "$PRODUCT" == "se12c" ]; then - agreementUrl="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html" - downloadUrl="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_se2_1of2.zip" - outputFile=linuxamd64_12102_database_se2_1of2.zip - downloadFile $agreementUrl $downloadUrl $outputFile - agreementUrl="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html" - downloadUrl="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_se2_2of2.zip" - outputFile=linuxamd64_12102_database_se2_2of2.zip - downloadFile $agreementUrl $downloadUrl $outputFile - exit 0 -fi - -if [ "$PRODUCT" == "ee12c" ]; then - agreementUrl="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html" - downloadUrl="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip" - outputFile=linuxamd64_12102_database_1of2.zip - downloadFile $agreementUrl $downloadUrl $outputFile - agreementUrl="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html" - DOWNLOAD_URL="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_2of2.zip" - outputFile=linuxamd64_12102_database_2of2.zip - downloadFile $agreementUrl $downloadUrl $outputFile - exit 0 -fi - -if [ "$PRODUCT" == "xe11g" ]; then - agreementUrl="http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html" - downloadUrl="https://edelivery.oracle.com/akam/otn/linux/oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip" - outputFile=oracle-xe-11.2.0-1.0.x86_64.rpm.zip - downloadFile $agreementUrl $downloadUrl $outputFile - exit 0 -fi - -if [ "$PRODUCT" == "sqlcl" ]; then - agreementUrl="http://www.oracle.com/technetwork/developer-tools/sqlcl/downloads/index.html" - downloadUrl="https://download.oracle.com/otn/java/sqldeveloper/sqlcl-18.3.0.259.2029.zip" - #downloadUrl="https://download.oracle.com/otn/java/sqldeveloper/sqlcl-19.2.1.206.1649.zip" - outputFile=sqlcl-18.3.0.259.2029.zip - downloadFile $agreementUrl $downloadUrl $outputFile - exit 0 -fi - -echo "Error: invalid product: $PRODUCT" -exit 1 diff --git a/.travis.yml b/old.travis.yml similarity index 100% rename from .travis.yml rename to old.travis.yml From de73451b9a4ad7531ab481284d1f941e20886504 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 24 Nov 2021 23:35:29 +0200 Subject: [PATCH 02/25] Building github actions --- .github/workflows/build.yml | 84 ++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3f4f0f4f..20a011d34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,38 +4,36 @@ env: UT3_DEVELOP_SCHEMA_PASSWORD: ut3 UT3_RELEASE_VERSION_SCHEMA: UT3 UT3_RELEASE_VERSION_SCHEMA_PASSWORD: ut3 - UT3_USER: 'UT3\$USER#' + UT3_USER: 'UT3$USER#' UT3_USER_PASSWORD: ut3 UT3_TESTER: UT3_TESTER UT3_TESTER_PASSWORD: ut3 UT3_TESTER_HELPER: UT3_TESTER_HELPER UT3_TESTER_HELPER_PASSWORD: ut3 UT3_TABLESPACE: users - BUILD_DIR: ${{env.GITHUB_WORKSPACE}} - JOB_ID: ${{env.GITHUB_RUN_ID}} - JOB_NUMBER: ${{env.GITHUB_RUN_NUMBER}} - PULL_REQUEST_NAME: ${env.GITHUB_HEAD_REF} - PULL_REQUEST_BRANCH: ${{env.GITHUB_HEAD_REF}} + BUILD_DIR: ${{github.workspace}} + JOB_ID: ${{github.run_id}} + JOB_NUMBER: ${{github.run_number}} + PULL_REQUEST_NAME: ${github.head_ref} + PULL_REQUEST_BRANCH: ${{github.head_ref}} TAG_NAME: ${TRAVIS_TAG} REPO_SLUG: ${TRAVIS_REPO_SLUG} - PR_SLUG: ${{env.GITHUB_REPOSITORY}} + PR_SLUG: ${{github.repository}} BRANCH_NAME: ${TRAVIS_BRANCH} # Environment for building a release CURRENT_BRANCH: ${TRAVIS_BRANCH} UTPLSQL_REPO: "utPLSQL/utPLSQL" - UTPLSQL_BUILD_NO: ${{env.GITHUB_RUN_ID}} + UTPLSQL_BUILD_NO: ${{github.run_id}} UTPLSQL_VERSION: $(. .travis/get_project_version.sh) UTPLSQL_BUILD_VERSION: $(. .travis/get_project_build_version.sh) UTPLSQL_SOURCES_DIR: 'source' UTPLSQL_BUILD_USER_NAME: "Travis CI" CACHE_DIR: $HOME/.cache # Database Env - SQLCLI: "${BUILD_DIR}/sqlcl/bin/sql" + SQLCLI: "sqlplus" OJDBC_HOME: "${BUILD_DIR}/ojdbc" ORACLE_PWD: "oracle" DOCKHER_HUB_REPO: "utplsqlv3/oracledb" - DOCKER_VOLUME: "/home/oracle/host" - DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" #utPLSQL released version directory UTPLSQL_DIR: "utPLSQL_latest_release" SELFTESTING_BRANCH: ${TRAVIS_BRANCH} @@ -56,36 +54,40 @@ jobs: build: env: - UTPLSQL_VERSION: ${{matrix.utplsql-version}} + ORACLE_VERSION: ${{matrix.oracle-version}} + CONNECTION_STR: ${{matrix.connection-str}} + ORACLE_PASSWORD: oracle + DOCKER_VOLUME: ${{matrix.docker-volume}} + DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - - oracle-version: "gvenzl/oracle-xe:11-slim" + - oracle-version: "gvenzl/oracle-xe:11-full" connection-str: '127.0.0.1:1521/XE' -# docker-options: '--shm-size=1g' # - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' # - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' - oracle-version: "gvenzl/oracle-xe:18-slim" connection-str: '127.0.0.1:1521/XE' - docker-options: '-e ORACLE_PASSWORD=oracle' # - oracle-version: "utplsqlv3/oracledb:18c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' # - oracle-version: "utplsqlv3/oracledb:19c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' - - oracle-version: "gvenzl/oracle-xe:21-full" - connection-str: '127.0.0.1:1521/XE' - docker-options: '-e ORACLE_PASSWORD=oracle' +# - oracle-version: "gvenzl/oracle-xe:21-full" +# connection-str: '127.0.0.1:1521/XE' services: oracle: - image: ${matrix.oracle-version} + image: ${{matrix.oracle-version}} env: - CONNECTION_STR: ${matrix.connection-str} ORACLE_PASSWORD: oracle +# credentials: +# username: ${{ secrets.DOCKER_USER }} +# password: ${{ secrets.DOCKER_PASSWORD }} ports: - 1521:1521 options: >- @@ -93,30 +95,44 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 10 - ${matrix.docker-options} + -e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR 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: Update project version & build number +# run: sh ${{ github.workspace }}/.travis/update_project_version.sh + + - name: Download latest utPLSQL release + run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR - 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: Update privileges on sources + run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} - - name: Install unit tests - run: sh ${{ github.workspace }}/scripts/3_install_tests.sh + - name: Install utPLSQL + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh - - name: Run unit tests - run: sh ${{ github.workspace }}/scripts/4_run_tests.sh + - name: Install utPLSQL release + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Run Examples + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh + + - name: Install tests + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh + + - name: Run Tests + run: bash $(pwd)/test/run_tests.sh + + +# +# - name: SonarCloud Scan +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 1c3004a5b28b44c3a1ea65308e97fbf59b215c3c Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 25 Nov 2021 09:43:25 +0200 Subject: [PATCH 03/25] Adding OJDBC Download --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20a011d34..88d84c3bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,8 @@ env: CACHE_DIR: $HOME/.cache # Database Env SQLCLI: "sqlplus" - OJDBC_HOME: "${BUILD_DIR}/ojdbc" + OJDBC_HOME: ${{github.workspace}}/ojdbc + OJDBC_URL: "https://download.oracle.com/otn-pub/otn_software/jdbc/213" ORACLE_PWD: "oracle" DOCKHER_HUB_REPO: "utplsqlv3/oracledb" #utPLSQL released version directory @@ -108,6 +109,9 @@ jobs: - name: Download latest utPLSQL release run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR + - name: Add OJDBC home + run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar + - 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 From 0b9f937822f233c5b241cb873b25c5bd600a4111 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 25 Nov 2021 09:47:54 +0200 Subject: [PATCH 04/25] Adding TimeZone --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88d84c3bd..0153beeb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,7 @@ env: UTPLSQL_DIR: "utPLSQL_latest_release" SELFTESTING_BRANCH: ${TRAVIS_BRANCH} UTPLSQL_CLI_VERSION: "3.1.8" + TZ: "Europe/London" # Maven MAVEN_HOME: /usr/local/maven MAVEN_CFG: $HOME/.m2 From 0ce0368c41e26b5fd8819ae534c636c3cf41322d Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 25 Nov 2021 10:25:52 +0200 Subject: [PATCH 05/25] Adding 21xe-full --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0153beeb1..3c49f9d6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,8 +79,8 @@ jobs: # connection-str: '127.0.0.1:1521/ORCLCDB' # - oracle-version: "utplsqlv3/oracledb:19c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' -# - oracle-version: "gvenzl/oracle-xe:21-full" -# connection-str: '127.0.0.1:1521/XE' + - oracle-version: "gvenzl/oracle-xe:21-full" + connection-str: '127.0.0.1:1521/XE' services: oracle: From 49216103029909e92e86fdc8d32f5fcc109dd352 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Tue, 30 Nov 2021 23:03:08 +0200 Subject: [PATCH 06/25] Switching to 21c-xe-slim --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c49f9d6a..5afb5aeee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: # connection-str: '127.0.0.1:1521/ORCLCDB' # - oracle-version: "utplsqlv3/oracledb:19c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' - - oracle-version: "gvenzl/oracle-xe:21-full" + - oracle-version: "gvenzl/oracle-xe:21-slim" connection-str: '127.0.0.1:1521/XE' services: From 09d32618b5887449d601ba4d6ccef25576bd2e1a Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 2 Dec 2021 22:38:30 +0200 Subject: [PATCH 07/25] Fixing build numbers and sonar analysis configuration. --- .github/workflows/build.yml | 27 ++++++++++++++++++++------- .travis/coveralls_uploader.js | 2 +- readme.md | 4 ++-- sonar-project.properties | 1 + 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5afb5aeee..e88fca2b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,8 @@ env: # Environment for building a release CURRENT_BRANCH: ${TRAVIS_BRANCH} UTPLSQL_REPO: "utPLSQL/utPLSQL" - UTPLSQL_BUILD_NO: ${{github.run_id}} + UTPLSQL_BUILD_NO_OFFSET: 3563 + UTPLSQL_BUILD_NO: $( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} ) UTPLSQL_VERSION: $(. .travis/get_project_version.sh) UTPLSQL_BUILD_VERSION: $(. .travis/get_project_build_version.sh) UTPLSQL_SOURCES_DIR: 'source' @@ -104,6 +105,17 @@ jobs: with: fetch-depth: 0 + - name: Set build no + run: echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV + + - name: Set version + run: echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV + + - name: Set version build no + + run: echo "UTPLSQL_BUILD_VERSION=$(. .travis/get_project_build_version.sh)" >> $GITHUB_ENV + - name: Output Run numbers + run: echo github.run_id is ${{ github.run_id }} github.run_number is ${{ github.run_number }} UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO UTPLSQL_VERSION is $UTPLSQL_VERSION UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION # - name: Update project version & build number # run: sh ${{ github.workspace }}/.travis/update_project_version.sh @@ -134,10 +146,11 @@ jobs: - name: Run Tests run: bash $(pwd)/test/run_tests.sh + - name: Validate utPLSQL reports format + run: bash .travis/validate_report_files.sh -# -# - name: SonarCloud Scan -# uses: SonarSource/sonarcloud-github-action@master -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.travis/coveralls_uploader.js b/.travis/coveralls_uploader.js index 182f84066..b76c8f496 100644 --- a/.travis/coveralls_uploader.js +++ b/.travis/coveralls_uploader.js @@ -15,7 +15,7 @@ fs.readFile('../coverage.json',function (err,data) { } req = JSON.parse(data); req.service_job_id = process.env.JOB_ID; - req.service_name = 'travis-ci'; + req.service_name = 'github-actions'; if (process.env.COVERALLS_REPO_TOKEN) { req.repo_token = process.env.COVERALLS_REPO_TOKEN; } diff --git a/readme.md b/readme.md index e56aba1d4..0928f2b95 100644 --- a/readme.md +++ b/readme.md @@ -9,8 +9,8 @@ [![twitter](https://img.shields.io/twitter/follow/utPLSQL.svg?style=social&label=Follow)](https://twitter.com/utPLSQL) [![build](https://travis-ci.com/utPLSQL/utPLSQL.svg?branch=develop)](https://travis-ci.com/utPLSQL/utPLSQL) -[![sonar](https://sonarcloud.io/api/project_badges/measure?project=utPLSQL&metric=sqale_rating)](https://sonarcloud.io/dashboard/index?id=utPLSQL) -[![Coveralls coverage](https://coveralls.io/repos/github/utPLSQL/utPLSQL/badge.svg?branch=develop)](https://coveralls.io/github/utPLSQL/utPLSQL?branch=develop) +[![QualityGate](https://sonarcloud.io/api/project_badges/measure?project=utPLSQL&metric=sqale_rating)](https://sonarcloud.io/dashboard/index?id=utPLSQL) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=utPLSQL&metric=coverage)](https://sonarcloud.io/summary/new_code?id=utPLSQL) ---------- utPLSQL version 3 is a complete rewrite of utPLSQL v2 from scratch. diff --git a/sonar-project.properties b/sonar-project.properties index d81d0a2b2..b68d13879 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,5 @@ # must be unique in a given SonarQube instance +sonar.organization=utplsql sonar.projectKey=utPLSQL # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. sonar.projectName=utPLSQL From e3e8c79375d7855598ae2acb56267418a2405608 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 5 Jan 2022 01:28:13 +0200 Subject: [PATCH 08/25] Added update of project version and build number. --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e88fca2b6..295e3ca63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,13 +111,14 @@ jobs: - name: Set version run: echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV - - name: Set version build no + - name: Set version with build no + run: echo UTPLSQL_BUILD_VERSION=$(sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}") >> $GITHUB_ENV - run: echo "UTPLSQL_BUILD_VERSION=$(. .travis/get_project_build_version.sh)" >> $GITHUB_ENV - name: Output Run numbers run: echo github.run_id is ${{ github.run_id }} github.run_number is ${{ github.run_number }} UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO UTPLSQL_VERSION is $UTPLSQL_VERSION UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION -# - name: Update project version & build number -# run: sh ${{ github.workspace }}/.travis/update_project_version.sh + + - name: Update project version & build number + run: sh ${{ github.workspace }}/.travis/update_project_version.sh - name: Download latest utPLSQL release run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR From e841b9b9a0acc690e27faeb1b2353b4c050ba42d Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 5 Jan 2022 02:15:48 +0200 Subject: [PATCH 09/25] Fixing docs update --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 295e3ca63..358e0b01e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,9 +19,9 @@ env: TAG_NAME: ${TRAVIS_TAG} REPO_SLUG: ${TRAVIS_REPO_SLUG} PR_SLUG: ${{github.repository}} - BRANCH_NAME: ${TRAVIS_BRANCH} + BRANCH_NAME: ${github.ref} # Environment for building a release - CURRENT_BRANCH: ${TRAVIS_BRANCH} + CURRENT_BRANCH: ${{github.ref}} UTPLSQL_REPO: "utPLSQL/utPLSQL" UTPLSQL_BUILD_NO_OFFSET: 3563 UTPLSQL_BUILD_NO: $( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} ) @@ -118,7 +118,7 @@ jobs: run: echo github.run_id is ${{ github.run_id }} github.run_number is ${{ github.run_number }} UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO UTPLSQL_VERSION is $UTPLSQL_VERSION UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION - name: Update project version & build number - run: sh ${{ github.workspace }}/.travis/update_project_version.sh + run: .travis/update_project_version.sh - name: Download latest utPLSQL release run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR @@ -145,7 +145,7 @@ jobs: run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh - name: Run Tests - run: bash $(pwd)/test/run_tests.sh + run: bash test/run_tests.sh - name: Validate utPLSQL reports format run: bash .travis/validate_report_files.sh From cae6a3589840f73be5896dc0f6bcb010404faf7a Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 5 Jan 2022 02:25:48 +0200 Subject: [PATCH 10/25] Update env variables --- .github/workflows/build.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 358e0b01e..193872b4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,11 +17,8 @@ env: PULL_REQUEST_NAME: ${github.head_ref} PULL_REQUEST_BRANCH: ${{github.head_ref}} TAG_NAME: ${TRAVIS_TAG} - REPO_SLUG: ${TRAVIS_REPO_SLUG} + REPO_SLUG: ${{github.repository}} PR_SLUG: ${{github.repository}} - BRANCH_NAME: ${github.ref} - # Environment for building a release - CURRENT_BRANCH: ${{github.ref}} UTPLSQL_REPO: "utPLSQL/utPLSQL" UTPLSQL_BUILD_NO_OFFSET: 3563 UTPLSQL_BUILD_NO: $( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} ) @@ -70,6 +67,7 @@ jobs: include: - oracle-version: "gvenzl/oracle-xe:11-full" connection-str: '127.0.0.1:1521/XE' +# TODO - need to add healthcheck.sh into our containers # - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' # - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" @@ -105,6 +103,11 @@ jobs: with: fetch-depth: 0 + - uses: nelonoel/branch-name@v1.0.1 + + - name: Set current branch name + run: echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV + - name: Set build no run: echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV From 7e875588f1a096654883ab3db6adf660b44f7788 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 5 Jan 2022 03:19:35 +0200 Subject: [PATCH 11/25] Formatting and cleanup --- .github/workflows/build.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 193872b4d..03bbb03af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,20 +105,19 @@ jobs: - uses: nelonoel/branch-name@v1.0.1 - - name: Set current branch name - run: echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV - - - name: Set build no - run: echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV - - - name: Set version - run: echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV - - - name: Set version with build no - run: echo UTPLSQL_BUILD_VERSION=$(sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}") >> $GITHUB_ENV - - - name: Output Run numbers - run: echo github.run_id is ${{ github.run_id }} github.run_number is ${{ github.run_number }} UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO UTPLSQL_VERSION is $UTPLSQL_VERSION UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION + - name: Set dynamic environment variables + run: | + echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV + echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV + echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV + echo UTPLSQL_BUILD_VERSION=$(sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}") >> $GITHUB_ENV + +# - name: print variables +# run: | +# echo github.run_number is ${{ github.run_number }} +# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO +# echo UTPLSQL_VERSION is $UTPLSQL_VERSION +# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION - name: Update project version & build number run: .travis/update_project_version.sh From 9307524cd9a8ac309e694ddf2191ea47c0a1dcf1 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 5 Jan 2022 23:02:51 +0200 Subject: [PATCH 12/25] Adding publishing of project version updates --- .github/workflows/build.yml | 247 ++++++++++++++++++------------ .travis/push_project_version.sh | 12 ++ .travis/push_release_version.sh | 18 --- .travis/update_project_version.sh | 2 +- 4 files changed, 165 insertions(+), 114 deletions(-) create mode 100755 .travis/push_project_version.sh delete mode 100755 .travis/push_release_version.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03bbb03af..f6de8da00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,6 @@ name: Deploy and test env: + #utPLSQL install env UT3_DEVELOP_SCHEMA: UT3_DEVELOP UT3_DEVELOP_SCHEMA_PASSWORD: ut3 UT3_RELEASE_VERSION_SCHEMA: UT3 @@ -11,22 +12,17 @@ env: UT3_TESTER_HELPER: UT3_TESTER_HELPER UT3_TESTER_HELPER_PASSWORD: ut3 UT3_TABLESPACE: users + #Build env BUILD_DIR: ${{github.workspace}} JOB_ID: ${{github.run_id}} JOB_NUMBER: ${{github.run_number}} - PULL_REQUEST_NAME: ${github.head_ref} + PULL_REQUEST_NAME: ${{github.head_ref}} PULL_REQUEST_BRANCH: ${{github.head_ref}} TAG_NAME: ${TRAVIS_TAG} REPO_SLUG: ${{github.repository}} PR_SLUG: ${{github.repository}} UTPLSQL_REPO: "utPLSQL/utPLSQL" UTPLSQL_BUILD_NO_OFFSET: 3563 - UTPLSQL_BUILD_NO: $( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} ) - UTPLSQL_VERSION: $(. .travis/get_project_version.sh) - UTPLSQL_BUILD_VERSION: $(. .travis/get_project_build_version.sh) - UTPLSQL_SOURCES_DIR: 'source' - UTPLSQL_BUILD_USER_NAME: "Travis CI" - CACHE_DIR: $HOME/.cache # Database Env SQLCLI: "sqlplus" OJDBC_HOME: ${{github.workspace}}/ojdbc @@ -51,52 +47,120 @@ on: workflow_dispatch: jobs: - build: - - env: - ORACLE_VERSION: ${{matrix.oracle-version}} - CONNECTION_STR: ${{matrix.connection-str}} - ORACLE_PASSWORD: oracle - DOCKER_VOLUME: ${{matrix.docker-volume}} - DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" +# build: +# env: +# ORACLE_VERSION: ${{matrix.oracle-version}} +# CONNECTION_STR: ${{matrix.connection-str}} +# ORACLE_PASSWORD: oracle +# DOCKER_VOLUME: ${{matrix.docker-volume}} +# DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" +# +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# include: +# - oracle-version: "gvenzl/oracle-xe:11-full" +# connection-str: '127.0.0.1:1521/XE' +## TODO - need to add healthcheck.sh into our containers +## - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "gvenzl/oracle-xe:18-slim" +# connection-str: '127.0.0.1:1521/XE' +## - oracle-version: "utplsqlv3/oracledb:18c-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## - oracle-version: "utplsqlv3/oracledb:19c-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "gvenzl/oracle-xe:21-slim" +# connection-str: '127.0.0.1:1521/XE' +# +# services: +# oracle: +# image: ${{matrix.oracle-version}} +# env: +# ORACLE_PASSWORD: oracle +## credentials: +## username: ${{ secrets.DOCKER_USER }} +## password: ${{ secrets.DOCKER_PASSWORD }} +# ports: +# - 1521:1521 +# options: >- +# --health-cmd healthcheck.sh +# --health-interval 10s +# --health-timeout 5s +# --health-retries 10 +# -e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR +# +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# +# - uses: nelonoel/branch-name@v1.0.1 +# +# - name: Set dynamic environment variables +# run: | +# echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV +# echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV +# echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV +# shell: bash +# +# - name: Set buid version number +# run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV +# shell: bash +# +# - name: print variables +# run: | +# echo github.run_number is ${{ github.run_number }} +# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO +# echo UTPLSQL_VERSION is $UTPLSQL_VERSION +# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION +# +# - name: Update project version & build number to verify that code is deployable after the update +# run: .travis/update_project_version.sh +# +# - name: Download latest utPLSQL release +# run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR +# +# - name: Add OJDBC home +# run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar +# +# - 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: Update privileges on sources +# run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} +# +# - name: Install utPLSQL +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh +# +# - name: Install utPLSQL release +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh +# +# - name: Run Examples +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh +# +# - name: Install tests +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh +# +# - name: Run Tests +# run: bash test/run_tests.sh +# +# - name: Validate utPLSQL reports format +# run: bash .travis/validate_report_files.sh +# +# - name: SonarCloud Scan +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + publish: +# needs: build runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - oracle-version: "gvenzl/oracle-xe:11-full" - connection-str: '127.0.0.1:1521/XE' -# TODO - need to add healthcheck.sh into our containers -# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' - - oracle-version: "gvenzl/oracle-xe:18-slim" - connection-str: '127.0.0.1:1521/XE' -# - oracle-version: "utplsqlv3/oracledb:18c-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# - oracle-version: "utplsqlv3/oracledb:19c-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' - - oracle-version: "gvenzl/oracle-xe:21-slim" - connection-str: '127.0.0.1:1521/XE' - - services: - oracle: - image: ${{matrix.oracle-version}} - env: - ORACLE_PASSWORD: oracle -# credentials: -# username: ${{ secrets.DOCKER_USER }} -# password: ${{ secrets.DOCKER_PASSWORD }} - ports: - - 1521:1521 - options: >- - --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 10 - -e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR steps: - uses: actions/checkout@v2 @@ -109,51 +173,44 @@ jobs: run: | echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV - echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV - echo UTPLSQL_BUILD_VERSION=$(sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}") >> $GITHUB_ENV + echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV + shell: bash -# - name: print variables -# run: | -# echo github.run_number is ${{ github.run_number }} -# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO -# echo UTPLSQL_VERSION is $UTPLSQL_VERSION -# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION - - - name: Update project version & build number - run: .travis/update_project_version.sh - - - name: Download latest utPLSQL release - run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR - - - name: Add OJDBC home - run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar - - - 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: Update privileges on sources - run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} + - name: Set buid version number + run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV + shell: bash - - name: Install utPLSQL - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh - - name: Install utPLSQL release - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh + - name: Install MkDocs + run: pip install mkdocs - - name: Run Examples - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh - - - name: Install tests - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh - - - name: Run Tests - run: bash test/run_tests.sh - - - name: Validate utPLSQL reports format - run: bash .travis/validate_report_files.sh - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Update project version & build number in source code and documentation + run: .travis/update_project_version.sh + shell: bash + + - name: Push version update to repository + uses: test-room-7/action-update-file@v1 + with: + file-path: | + sonar-project.properties + VERSION + source/** + docs/** + commit-msg: Updated project version after build [skip ci] + github-token: ${{ secrets.PUSH_TOKEN }} + branch: ${{ env.CURRENT_BRANCH }} + if: | + ${{ + github.ref_type == 'branch' + && github.repository == 'utPLSQL/utPLSQL' + && ( startsWith(env.CURRENT_BRANCH,'release/') + || env.CURRENT_BRANCH == 'develop' + || env.CURRENT_BRANCH == 'feature/github_actions' + ) + }} + + +# TODO - add slack notifications +# TODO - add push of documentation +# TODO - add building of release archive +# TODO - add publishing of release diff --git a/.travis/push_project_version.sh b/.travis/push_project_version.sh new file mode 100755 index 000000000..1b38e6c24 --- /dev/null +++ b/.travis/push_project_version.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -v +echo Current branch is "${CURRENT_BRANCH}" +echo "Committing version & buildNo into branch (${CURRENT_BRANCH})" +git add sonar-project.properties +git add VERSION +git add source/* +git add docs/* +git commit -m 'Updated project version after build [skip ci]' +echo "Pushing to origin" +git push --quiet origin HEAD:${CURRENT_BRANCH} diff --git a/.travis/push_release_version.sh b/.travis/push_release_version.sh deleted file mode 100755 index f4ca8f819..000000000 --- a/.travis/push_release_version.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# We are updating version number only when: -# - not a pull request -# - branch name is = develop or branch name is like release/vX.X.X... -if [ "${REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "${PULL_REQUEST_NAME}" == "false" ] && [[ "${CURRENT_BRANCH}" =~ ^(release/v[0-9]+\.[0-9]+\.[0-9]+.*|develop)$ ]]; then - echo Current branch is "${CURRENT_BRANCH}" - echo "Committing version & buildNo into branch (${CURRENT_BRANCH})" - git add sonar-project.properties - git add VERSION - git add source/* - git add docs/* - git commit -m 'Updated project version after build [skip ci]' - echo "Pushing to origin" - git push --quiet origin HEAD:${CURRENT_BRANCH} -else - echo "Publishing of version skipped for branch ${CURRENT_BRANCH}, pull request ${PULL_REQUEST_NAME}" -fi diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh index c4540eef8..bb6f72f00 100755 --- a/.travis/update_project_version.sh +++ b/.travis/update_project_version.sh @@ -5,7 +5,7 @@ UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*" echo Current branch is "${CURRENT_BRANCH}" echo Update version in project source files -find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PATTERN}/${UTPLSQL_BUILD_VERSION}/" {} \; +find source -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PATTERN}/${UTPLSQL_BUILD_VERSION}/" {} \; echo Source files updated with version tag: ${UTPLSQL_BUILD_VERSION} echo Update version in documentation files From 169f61c80d646e5fd308942790637ea1507c8446 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 6 Jan 2022 15:34:26 +0200 Subject: [PATCH 13/25] Update of token --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6de8da00..a998a7c91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,7 +197,7 @@ jobs: source/** docs/** commit-msg: Updated project version after build [skip ci] - github-token: ${{ secrets.PUSH_TOKEN }} + github-token: ${{ secrets.API_TOKEN_GITHUB }} branch: ${{ env.CURRENT_BRANCH }} if: | ${{ From 82c4d21a97c29d6fa85df65d9688ad1b70e4677f Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 6 Jan 2022 15:52:02 +0200 Subject: [PATCH 14/25] Testing publishing of documentation to gh-pages --- .github/workflows/build.yml | 18 ++++ .travis/push_docs_to_github_io.sh | 134 +++++++++++++++--------------- 2 files changed, 84 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a998a7c91..45956f696 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -209,6 +209,24 @@ jobs: ) }} + - name: Copy and push documentation to utPLSQL-github-io repo + env: + API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} + run: .travis/push_docs_to_github_io.sh + shell: bash + if: | + ${{ + github.repository == 'utPLSQL/utPLSQL' + && (github.ref_type == 'branch' + && ( startsWith(env.CURRENT_BRANCH,'release/') + || env.CURRENT_BRANCH == 'develop' + || env.CURRENT_BRANCH == 'feature/github_actions' + ) + || github.ref_type == 'tag' + ) + }} + + # TODO - add slack notifications # TODO - add push of documentation diff --git a/.travis/push_docs_to_github_io.sh b/.travis/push_docs_to_github_io.sh index 5c3fcd672..ae36dc5db 100755 --- a/.travis/push_docs_to_github_io.sh +++ b/.travis/push_docs_to_github_io.sh @@ -17,81 +17,79 @@ LATEST_DOCS_BRANCH="develop" GITHUB_IO_REPO='utPLSQL/utPLSQL.github.io' GITHUB_IO_BRANCH='main' -# TRAVIS_* variables are set by travis directly and only need to be if testing externally -# We deploy only when building on develop branch or on TAG (release) -if [ "${PULL_REQUEST_NAME}" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TAG_NAME}" ]; }; then +# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message. +# Anyone one of them not set can be used to turn off this functionality. - # ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message. - # Anyone one of them not set can be used to turn off this functionality. +# If a version of the project is not defined +[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 1; } +# Fail if the markdown documentation is not present. +[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; } - # If a version of the project is not defined - [[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 1; } - # Fail if the markdown documentation is not present. - [[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; } +# Store latest commit SHA to be used when committing and pushing to github.io repo +SHA=`git rev-parse --verify HEAD` - # Store latest commit SHA to be used when committing and pushing to github.io repo - SHA=`git rev-parse --verify HEAD` +# clone the repository and switch to GITHUB_IO_BRANCH branch +mkdir pages +cd ./pages +git clone --depth 1 https://${API_TOKEN_GITHUB}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} . - # clone the repository and switch to GITHUB_IO_BRANCH branch - mkdir pages - cd ./pages - git clone --depth 1 https://${github_api_token}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} . +git config user.email "github-actions[bot]@users.noreply.github.com" +git config user.name "github-actions[bot]" - mkdir -p utPLSQL - cd ./utPLSQL - #clear out develop documentation directory and copy docs contents to it. - echo "updating 'develop' documentation directory" - mkdir -p ./develop - rm -rf ./develop/**./* || exit 0 - cp -a ../../docs/. ./develop +mkdir -p utPLSQL +cd ./utPLSQL +#clear out develop documentation directory and copy docs contents to it. +echo "updating 'develop' documentation directory" +mkdir -p ./develop +rm -rf ./develop/**./* || exit 0 +cp -a ../../docs/. ./develop - # If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory - if [ -n "${TAG_NAME}" ]; then - echo "Creating directory ./${UTPLSQL_VERSION}" - mkdir -p ./${UTPLSQL_VERSION} - rm -rf ./${UTPLSQL_VERSION}/**./* || exit 0 - cp -a ../../docs/. ./${UTPLSQL_VERSION} - echo "Populating 'latest' directory" - mkdir -p ./latest - rm -rf ./latest/**./* || exit 0 - cp -a ../../docs/. ./latest - fi - # Stage changes for commit - git add . +# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory +if [ "${GITHUB_REF_TYPE}" == "tag" ]; then + echo "Creating directory ./${UTPLSQL_VERSION}" + mkdir -p ./${UTPLSQL_VERSION} + rm -rf ./${UTPLSQL_VERSION}/**./* || exit 0 + cp -a ../../docs/. ./${UTPLSQL_VERSION} + echo "Populating 'latest' directory" + mkdir -p ./latest + rm -rf ./latest/**./* || exit 0 + cp -a ../../docs/. ./latest +fi +# Stage changes for commit +git add . - #Check if there are doc changes, if none exit the script - if [[ -z `git diff HEAD --exit-code` ]]; then - echo "No changes to docs detected." - exit 0 - fi - #Changes where detected, so we need to update the version log. - now=$(date +"%d %b %Y - %r") - if [ ! -f index.md ]; then - echo "---" >>index.md - echo "layout: default" >>index.md - echo "---" >>index.md - echo "" >>index.md - echo "# Documentation versions" >>index.md - echo "" >>index.md - echo "" >>index.md #- 7th line - placeholder for latest release doc - echo "" >>index.md #- 8th line - placeholder for develop branch doc - echo "" >>index.md - echo "## Released Version Doc History" >>index.md - echo "" >>index.md - fi - #If build running on a TAG - it's a new release - need to add it to documentation - if [ -n "${TAG_NAME}" ]; then - sed -i '7s@.*@'" - [Latest ${TAG_NAME} documentation](latest/) - Created $now"'@' index.md - #add entry to the top of version history (line end of file - ## Released Version Doc History - sed -i '12i'" - [${TAG_NAME} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md - fi - #replace 4th line in log - sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md - #Add and Commit the changes back to pages repo. - git add . - git commit -m "Deploy to gh-pages branch: base commit ${SHA}" - # Now that we're all set up, we can push. - git push --quiet origin HEAD:${GITHUB_IO_BRANCH} +#Check if there are doc changes, if none exit the script +if [[ -z `git diff HEAD --exit-code` ]]; then + echo "No changes to docs detected." + exit 0 +fi +#Changes where detected, so we need to update the version log. +now=$(date +"%d %b %Y - %r") +if [ ! -f index.md ]; then + echo "---" >>index.md + echo "layout: default" >>index.md + echo "---" >>index.md + echo "" >>index.md + echo "# Documentation versions" >>index.md + echo "" >>index.md + echo "" >>index.md #- 7th line - placeholder for latest release doc + echo "" >>index.md #- 8th line - placeholder for develop branch doc + echo "" >>index.md + echo "## Released Version Doc History" >>index.md + echo "" >>index.md +fi +#If build running on a TAG - it's a new release - need to add it to documentation +if [ "${GITHUB_REF_TYPE}" == "tag" ]; then + sed -i '7s@.*@'" - [Latest ${CURRENT_BRANCH} documentation](latest/) - Created $now"'@' index.md + #add entry to the top of version history (line end of file - ## Released Version Doc History + sed -i '12i'" - [${CURRENT_BRANCH} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md fi +#replace 4th line in log +sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md +#Add and Commit the changes back to pages repo. +git add . +git commit -m "Deploy to gh-pages branch: base commit ${SHA}" +# Now that we're all set up, we can push. +git push --quiet origin HEAD:${GITHUB_IO_BRANCH} From 532be8d07a63a423eb105fe43a6e411f4853cbfc Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Fri, 7 Jan 2022 01:43:57 +0200 Subject: [PATCH 15/25] Externalizing env variables. Cleanup and refactoring. --- .github/scripts/set_version_numbers_env.sh | 10 + .github/variables/.env | 33 +++ .github/workflows/build.yml | 306 +++++++------------- .github/workflows/release_documentation.yml | 56 ++++ .travis/coveralls_uploader.js | 31 -- .travis/coveralls_uploader.sh | 6 - .travis/push_docs_to_github_io.sh | 3 - .travis/run_sonar_scanner.sh | 68 ----- .travis/start_db.sh | 15 - 9 files changed, 209 insertions(+), 319 deletions(-) create mode 100755 .github/scripts/set_version_numbers_env.sh create mode 100644 .github/variables/.env create mode 100644 .github/workflows/release_documentation.yml delete mode 100644 .travis/coveralls_uploader.js delete mode 100755 .travis/coveralls_uploader.sh delete mode 100755 .travis/run_sonar_scanner.sh delete mode 100755 .travis/start_db.sh diff --git a/.github/scripts/set_version_numbers_env.sh b/.github/scripts/set_version_numbers_env.sh new file mode 100755 index 000000000..8f463c49b --- /dev/null +++ b/.github/scripts/set_version_numbers_env.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +UTPLSQL_BUILD_NO=$( expr ${JOB_NUMBER} + ${UTPLSQL_BUILD_NO_OFFSET} ) +UTPLSQL_VERSION=$(.travis/get_project_version.sh) + +echo "UTPLSQL_BUILD_NO=${UTPLSQL_BUILD_NO}" >> $GITHUB_ENV +echo "UTPLSQL_VERSION=${UTPLSQL_VERSION}" >> $GITHUB_ENV +echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV + +echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV diff --git a/.github/variables/.env b/.github/variables/.env new file mode 100644 index 000000000..9f35a080c --- /dev/null +++ b/.github/variables/.env @@ -0,0 +1,33 @@ +#utPLSQL install env +UT3_DEVELOP_SCHEMA=UT3_DEVELOP +UT3_DEVELOP_SCHEMA_PASSWORD=ut3 +UT3_RELEASE_VERSION_SCHEMA=UT3 +UT3_RELEASE_VERSION_SCHEMA_PASSWORD=ut3 +UT3_USER='UT3$USER#' +UT3_USER_PASSWORD=ut3 +UT3_TESTER=UT3_TESTER +UT3_TESTER_PASSWORD=ut3 +UT3_TESTER_HELPER=UT3_TESTER_HELPER +UT3_TESTER_HELPER_PASSWORD=ut3 +UT3_TABLESPACE=users + +# Database Env +SQLCLI="sqlplus" +OJDBC_HOME=ojdbc +OJDBC_URL="https://download.oracle.com/otn-pub/otn_software/jdbc/213" +ORACLE_PWD="oracle" +TZ="Europe/London" + +#Build env +UTPLSQL_CLI_VERSION="3.1.8" +UTPLSQL_DIR="utPLSQL_latest_release" +UTPLSQL_BUILD_NO_OFFSET=3563 + +#Git configuration +GIT_AUTHOR_NAME="github-actions[bot]" +GIT_AUTHOR_EMAIL="github-actions[bot]@users.noreply.github.com" +GIT_COMMITTER_NAME="github-actions[bot]" +GIT_COMMITTER_EMAIL="github-actions[bot]@users.noreply.github.com" + +#Docker environment for running utPLSQL install commands +DOCKER_ENV="-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45956f696..e509ffe98 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,42 +1,7 @@ -name: Deploy and test +name: Build and test env: - #utPLSQL install env - UT3_DEVELOP_SCHEMA: UT3_DEVELOP - UT3_DEVELOP_SCHEMA_PASSWORD: ut3 - UT3_RELEASE_VERSION_SCHEMA: UT3 - UT3_RELEASE_VERSION_SCHEMA_PASSWORD: ut3 - UT3_USER: 'UT3$USER#' - UT3_USER_PASSWORD: ut3 - UT3_TESTER: UT3_TESTER - UT3_TESTER_PASSWORD: ut3 - UT3_TESTER_HELPER: UT3_TESTER_HELPER - UT3_TESTER_HELPER_PASSWORD: ut3 - UT3_TABLESPACE: users - #Build env BUILD_DIR: ${{github.workspace}} - JOB_ID: ${{github.run_id}} JOB_NUMBER: ${{github.run_number}} - PULL_REQUEST_NAME: ${{github.head_ref}} - PULL_REQUEST_BRANCH: ${{github.head_ref}} - TAG_NAME: ${TRAVIS_TAG} - REPO_SLUG: ${{github.repository}} - PR_SLUG: ${{github.repository}} - UTPLSQL_REPO: "utPLSQL/utPLSQL" - UTPLSQL_BUILD_NO_OFFSET: 3563 - # Database Env - SQLCLI: "sqlplus" - OJDBC_HOME: ${{github.workspace}}/ojdbc - OJDBC_URL: "https://download.oracle.com/otn-pub/otn_software/jdbc/213" - ORACLE_PWD: "oracle" - DOCKHER_HUB_REPO: "utplsqlv3/oracledb" - #utPLSQL released version directory - UTPLSQL_DIR: "utPLSQL_latest_release" - SELFTESTING_BRANCH: ${TRAVIS_BRANCH} - UTPLSQL_CLI_VERSION: "3.1.8" - TZ: "Europe/London" - # Maven - MAVEN_HOME: /usr/local/maven - MAVEN_CFG: $HOME/.m2 on: push: @@ -46,189 +11,138 @@ on: workflow_dispatch: +defaults: + run: + shell: bash + jobs: -# build: -# env: -# ORACLE_VERSION: ${{matrix.oracle-version}} -# CONNECTION_STR: ${{matrix.connection-str}} -# ORACLE_PASSWORD: oracle -# DOCKER_VOLUME: ${{matrix.docker-volume}} -# DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" -# -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# include: -# - oracle-version: "gvenzl/oracle-xe:11-full" -# connection-str: '127.0.0.1:1521/XE' -## TODO - need to add healthcheck.sh into our containers -## - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -# - oracle-version: "gvenzl/oracle-xe:18-slim" -# connection-str: '127.0.0.1:1521/XE' -## - oracle-version: "utplsqlv3/oracledb:18c-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## - oracle-version: "utplsqlv3/oracledb:19c-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -# - oracle-version: "gvenzl/oracle-xe:21-slim" -# connection-str: '127.0.0.1:1521/XE' -# -# services: -# oracle: -# image: ${{matrix.oracle-version}} -# env: -# ORACLE_PASSWORD: oracle -## credentials: -## username: ${{ secrets.DOCKER_USER }} -## password: ${{ secrets.DOCKER_PASSWORD }} -# ports: -# - 1521:1521 -# options: >- -# --health-cmd healthcheck.sh -# --health-interval 10s -# --health-timeout 5s -# --health-retries 10 -# -e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR -# -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 -# -# - uses: nelonoel/branch-name@v1.0.1 -# -# - name: Set dynamic environment variables -# run: | -# echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV -# echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV -# echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV -# shell: bash -# -# - name: Set buid version number -# run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV -# shell: bash -# -# - name: print variables -# run: | -# echo github.run_number is ${{ github.run_number }} -# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO -# echo UTPLSQL_VERSION is $UTPLSQL_VERSION -# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION -# -# - name: Update project version & build number to verify that code is deployable after the update -# run: .travis/update_project_version.sh -# -# - name: Download latest utPLSQL release -# run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR -# -# - name: Add OJDBC home -# run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar -# -# - 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: Update privileges on sources -# run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} -# -# - name: Install utPLSQL -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh -# -# - name: Install utPLSQL release -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh -# -# - name: Run Examples -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh -# -# - name: Install tests -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh -# -# - name: Run Tests -# run: bash test/run_tests.sh -# -# - name: Validate utPLSQL reports format -# run: bash .travis/validate_report_files.sh -# -# - name: SonarCloud Scan -# uses: SonarSource/sonarcloud-github-action@master -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + build: + env: + ORACLE_VERSION: ${{matrix.oracle-version}} + CONNECTION_STR: ${{matrix.connection-str}} + ORACLE_PASSWORD: oracle + DOCKER_VOLUME: ${{matrix.docker-volume}} - publish: -# needs: build runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - oracle-version: "gvenzl/oracle-xe:11-full" + connection-str: '127.0.0.1:1521/XE' +# TODO - need to add healthcheck.sh into our containers +# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' + - oracle-version: "gvenzl/oracle-xe:18-slim" + connection-str: '127.0.0.1:1521/XE' +# - oracle-version: "utplsqlv3/oracledb:18c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# - oracle-version: "utplsqlv3/oracledb:19c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' + - oracle-version: "gvenzl/oracle-xe:21-slim" + connection-str: '127.0.0.1:1521/XE' + + services: + oracle: + image: ${{matrix.oracle-version}} + env: + ORACLE_PASSWORD: oracle +# credentials: +# username: ${{ secrets.DOCKER_USER }} +# password: ${{ secrets.DOCKER_PASSWORD }} + 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 - - uses: nelonoel/branch-name@v1.0.1 + - uses: c-py/action-dotenv-to-setenv@v2 + with: + env-file: .github/variables/.env + + + - name: Set buid version number env variables + run: .github/scripts/set_version_numbers_env.sh + + - name: Update project version & build number to verify that code is deployable after the update + run: .travis/update_project_version.sh + + - name: Download latest utPLSQL release + run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR + + - name: Add OJDBC home + run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar + + - 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: Update privileges on sources + run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} + + - name: Install utPLSQL + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh + + - name: Install utPLSQL release + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh - - name: Set dynamic environment variables - run: | - echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV - echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV - echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV - shell: bash + - name: Run Examples + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh - - name: Set buid version number - run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV - shell: bash + - name: Install tests + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh + - name: Run Tests + run: bash test/run_tests.sh - - name: Install MkDocs - run: pip install mkdocs + - name: Validate utPLSQL reports format + run: bash .travis/validate_report_files.sh + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + publish: + needs: build + runs-on: ubuntu-latest + if: | + ${{ github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null + && ( startsWith( github.ref, 'refs/heads/release/v' ) || github.ref == 'refs/heads/develop' ) + }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + #Populates the value of BRANCH_NAME env variable + - uses: nelonoel/branch-name@v1.0.1 + - uses: c-py/action-dotenv-to-setenv@v2 + with: + env-file: .github/variables/.env + + - name: Set buid version number env variables + run: .github/scripts/set_version_numbers_env.sh - name: Update project version & build number in source code and documentation run: .travis/update_project_version.sh - shell: bash - name: Push version update to repository - uses: test-room-7/action-update-file@v1 - with: - file-path: | - sonar-project.properties - VERSION - source/** - docs/** - commit-msg: Updated project version after build [skip ci] - github-token: ${{ secrets.API_TOKEN_GITHUB }} - branch: ${{ env.CURRENT_BRANCH }} - if: | - ${{ - github.ref_type == 'branch' - && github.repository == 'utPLSQL/utPLSQL' - && ( startsWith(env.CURRENT_BRANCH,'release/') - || env.CURRENT_BRANCH == 'develop' - || env.CURRENT_BRANCH == 'feature/github_actions' - ) - }} + run: .travis/push_project_version.sh - name: Copy and push documentation to utPLSQL-github-io repo env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} run: .travis/push_docs_to_github_io.sh - shell: bash - if: | - ${{ - github.repository == 'utPLSQL/utPLSQL' - && (github.ref_type == 'branch' - && ( startsWith(env.CURRENT_BRANCH,'release/') - || env.CURRENT_BRANCH == 'develop' - || env.CURRENT_BRANCH == 'feature/github_actions' - ) - || github.ref_type == 'tag' - ) - }} - - # TODO - add slack notifications -# TODO - add push of documentation -# TODO - add building of release archive -# TODO - add publishing of release diff --git a/.github/workflows/release_documentation.yml b/.github/workflows/release_documentation.yml new file mode 100644 index 000000000..8d07e53d8 --- /dev/null +++ b/.github/workflows/release_documentation.yml @@ -0,0 +1,56 @@ +name: Create and publish release artifacts +env: + BUILD_DIR: ${{github.workspace}} + JOB_NUMBER: ${{github.run_number}} + PULL_REQUEST_NAME: ${{github.head_ref}} + PULL_REQUEST_BRANCH: ${{github.head_ref}} + REPO_SLUG: ${{github.repository}} + PR_SLUG: ${{github.repository}} + +on: + release: + types: [ created ] +#See: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-multiple-events-with-activity-types-or-configuration + +defaults: + run: + shell: bash + +jobs: + + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: nelonoel/branch-name@v1.0.1 + + - name: Set buid version number env variables + run: .github/scripts/set_version_numbers_env.sh + + - name: Setup git config + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + - name: Install MkDocs + run: pip install mkdocs + + - name: Update project version & build number in source code and documentation + run: .travis/update_project_version.sh + + - name: Push version update to repository + run: .travis/push_project_version.sh + + - name: Copy and push documentation to utPLSQL-github-io repo + env: + API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} + run: .travis/push_docs_to_github_io.sh + + +# TODO - add slack notifications +# TODO - add building of release archive +# TODO - add publishing of release diff --git a/.travis/coveralls_uploader.js b/.travis/coveralls_uploader.js deleted file mode 100644 index b76c8f496..000000000 --- a/.travis/coveralls_uploader.js +++ /dev/null @@ -1,31 +0,0 @@ -var fs = require('fs'); -var request = require('request'); -const md5File = require('md5-file'); - -var url -if (process.env.COVERALLS_URL_BASE) { - url = process.env.COVERALLS_URL_BASE+'/api/v1/jobs'; -} else { - url = 'https://coveralls.io/api/v1/jobs'; -} - -fs.readFile('../coverage.json',function (err,data) { - if (err) { - return console.log(err); - } - req = JSON.parse(data); - req.service_job_id = process.env.JOB_ID; - req.service_name = 'github-actions'; - if (process.env.COVERALLS_REPO_TOKEN) { - req.repo_token = process.env.COVERALLS_REPO_TOKEN; - } - - for (var i in req.source_files) { - req.source_files[i].source_digest = md5File.sync("../" + req.source_files[i].name); - } - - var requestStr = JSON.stringify(req); - - request.post({url : url, form : { json:requestStr}}, function(err, response, body){process.stdout.write(body);}); - -}); diff --git a/.travis/coveralls_uploader.sh b/.travis/coveralls_uploader.sh deleted file mode 100755 index 8fcbad58d..000000000 --- a/.travis/coveralls_uploader.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e -echo "coveralls_uploader" -npm install request --save -npm install --save md5-file -cd "$(dirname "$(readlink -f "$0")")" -exec node coveralls_uploader.js diff --git a/.travis/push_docs_to_github_io.sh b/.travis/push_docs_to_github_io.sh index ae36dc5db..689cb99c9 100755 --- a/.travis/push_docs_to_github_io.sh +++ b/.travis/push_docs_to_github_io.sh @@ -34,9 +34,6 @@ mkdir pages cd ./pages git clone --depth 1 https://${API_TOKEN_GITHUB}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} . -git config user.email "github-actions[bot]@users.noreply.github.com" -git config user.name "github-actions[bot]" - mkdir -p utPLSQL cd ./utPLSQL #clear out develop documentation directory and copy docs contents to it. diff --git a/.travis/run_sonar_scanner.sh b/.travis/run_sonar_scanner.sh deleted file mode 100755 index f0a2805c1..000000000 --- a/.travis/run_sonar_scanner.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash - -#Run Sonar based on conditions - -MAIN_DEV_BRANCH="develop" - -BRANCH_SONAR_PROPERTY="sonar.branch.name" -BRANCH_SONAR_TARGET_PROPERTY="sonar.branch.target" - -PR_SONAR_BRANCH_PROPERTY="sonar.pullrequest.branch" -PR_KEY_PROPERTY="sonar.pullrequest.key" -PR_SONAR_BASE_PROPERTY="sonar.pullrequest.base" -PR_SONAR_TOKEN_PROPERTY="sonar.pullrequest.github.token.secured" - -DB_URL_SONAR_PROPERTY="sonar.plsql.jdbc.url" -DB_DRIVER_PATH="sonar.plsql.jdbc.driver.path" - -#Add property to file -function add_sonar_property { - echo "$1=$2" >> sonar-project.properties -} - - -if [ "${PULL_REQUEST_NAME}" == "false" ]; then - BRANCH=${BRANCH_NAME}; - PR_BRANCH="" - echo "BRANCH=$BRANCH" -else - BRANCH=${PULL_REQUEST_BRANCH} - PR_BRANCH=${BRANCH_NAME} - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=${PULL_REQUEST_NAME}, BRANCH=$BRANCH" - -fi - - -#Are we running on utPLSQL repo and not an external PR? -echo "Check if we running from develop or on branch" -if [ "${REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [[ ! "${BRANCH}" =~ ^(release/v[0-9]+\.[0-9]+\.[0-9]+.*|"${MAIN_DEV_BRANCH}")$ ]]; then - - echo "" >> sonar-project.properties - if [ "${PULL_REQUEST_NAME}" == "false" ]; then - echo "Updating sonar properties to include branch ${BRANCH}" - add_sonar_property "${BRANCH_SONAR_PROPERTY}" "${BRANCH}" - add_sonar_property "${BRANCH_SONAR_TARGET_PROPERTY}" "${MAIN_DEV_BRANCH}" - elif [ "${PR_SLUG}" = "${REPO_SLUG}" ]; then - echo "Updating sonar properties to include pull request ${BRANCH}" - add_sonar_property "${PR_SONAR_TOKEN_PROPERTY}" "${GITHUB_TRAVISCI_TOKEN}" - add_sonar_property "${PR_SONAR_BRANCH_PROPERTY}" "${BRANCH}" - add_sonar_property "${PR_KEY_PROPERTY}" "${PR}" - add_sonar_property "${PR_SONAR_BASE_PROPERTY}" "${PR_BRANCH}" - else - echo "PR from external source no changes to properties." - fi -else - echo "No need to update sonar we building on release or develop" -fi - -#Address issue : Could not find ref 'develop' in refs/heads or refs/remotes/origin -git fetch --no-tags https://github.com/utPLSQL/utPLSQL.git +refs/heads/develop:refs/remotes/origin/develop - -echo "Adding OJDBC Driver Path ${OJDBC_HOME}/ojdbc8.jar" -add_sonar_property "${DB_URL_SONAR_PROPERTY}" "jdbc:oracle:thin:@${CONNECTION_STR}" -add_sonar_property "${DB_DRIVER_PATH}" "${OJDBC_HOME}/ojdbc8.jar" - - -#Execute Sonar scanner -echo "Executing sonar scanner" -sonar-scanner diff --git a/.travis/start_db.sh b/.travis/start_db.sh deleted file mode 100755 index 285f8172f..000000000 --- a/.travis/start_db.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -# Private Repo Login -if [ ! -f $CACHE_DIR/.docker/config.json ]; then - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - mkdir -p $CACHE_DIR/.docker && cp $HOME/.docker/config.json $CACHE_DIR/.docker/ -else - echo "Using docker login from cache..." - mkdir -p $HOME/.docker && cp $CACHE_DIR/.docker/config.json $HOME/.docker/ -fi - -time docker pull $DOCKHER_HUB_REPO:$ORACLE_VERSION -docker run -d --name $ORACLE_VERSION --mount type=bind,source=${BUILD_DIR},target=${DOCKER_VOLUME} $DOCKER_OPTIONS $DOCKER_ENV -p 1521:1521 $DOCKHER_HUB_REPO:$ORACLE_VERSION -time docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered From 12757eaa7eeeb728950f742226956b253c50a716 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Fri, 7 Jan 2022 03:19:24 +0200 Subject: [PATCH 16/25] Added job names. Added id for matrix jobs. Adding slack notification. Adding semaphore to prevent concurrency when publishing documentation. --- .github/workflows/build.yml | 64 ++++++++++++++++++--- .github/workflows/release_documentation.yml | 1 + 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e509ffe98..16a5d7094 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build and test +name: Build, test, deploy documentation env: BUILD_DIR: ${{github.workspace}} JOB_NUMBER: ${{github.run_number}} @@ -11,13 +11,16 @@ on: workflow_dispatch: +concurrency: ${{github.ref}} + defaults: run: shell: bash jobs: - build: + build-and-test: + name: Build and test on ${{matrix.db_version_name}} DB env: ORACLE_VERSION: ${{matrix.oracle-version}} CONNECTION_STR: ${{matrix.connection-str}} @@ -31,19 +34,33 @@ jobs: include: - oracle-version: "gvenzl/oracle-xe:11-full" connection-str: '127.0.0.1:1521/XE' + id: 1 + db_version_name: '11xe' # TODO - need to add healthcheck.sh into our containers # - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 2 +# db_version_name: '12.1se' # - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 3 +# db_version_name: '12.2se' - oracle-version: "gvenzl/oracle-xe:18-slim" connection-str: '127.0.0.1:1521/XE' + id: 4 + db_version_name: '18xe' # - oracle-version: "utplsqlv3/oracledb:18c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 5 +# db_version_name: '18se' # - oracle-version: "utplsqlv3/oracledb:19c-se2-small" # connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 6 +# db_version_name: '19se' - oracle-version: "gvenzl/oracle-xe:21-slim" connection-str: '127.0.0.1:1521/XE' + id: 7 + db_version_name: '21xe' services: oracle: @@ -71,50 +88,63 @@ jobs: env-file: .github/variables/.env - - name: Set buid version number env variables + - name: Set build version number env variables + id: set-build-version-number-vars run: .github/scripts/set_version_numbers_env.sh - name: Update project version & build number to verify that code is deployable after the update + id: update-project-version run: .travis/update_project_version.sh - name: Download latest utPLSQL release run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR + - name: Update privileges on sources + run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} + - name: Add OJDBC home + id: get-ojdbc run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar - name: Install utPLSQL-cli + id: 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: Update privileges on sources - run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} - - name: Install utPLSQL + id: install-utplsql run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh - name: Install utPLSQL release + id: install-utplsql-release run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh - name: Run Examples + id: run-examples run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh - name: Install tests + id: install-tests run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh - name: Run Tests + id: run-tests run: bash test/run_tests.sh - name: Validate utPLSQL reports format + id: validate-reports-format run: bash .travis/validate_report_files.sh - name: SonarCloud Scan + id: sonar uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} publish: - needs: build + name: Deploy documentation + needs: [build-and-test] + concurrency: publish runs-on: ubuntu-latest if: | ${{ github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null @@ -132,17 +162,35 @@ jobs: env-file: .github/variables/.env - name: Set buid version number env variables + id: set-build-version-number-vars run: .github/scripts/set_version_numbers_env.sh - name: Update project version & build number in source code and documentation + id: update-project-version run: .travis/update_project_version.sh - name: Push version update to repository + id: push-version-number-update run: .travis/push_project_version.sh - name: Copy and push documentation to utPLSQL-github-io repo + id: push-documentation env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} run: .travis/push_docs_to_github_io.sh -# TODO - add slack notifications + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: [build-and-test, publish] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + # Optional Input + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' diff --git a/.github/workflows/release_documentation.yml b/.github/workflows/release_documentation.yml index 8d07e53d8..fbf31a718 100644 --- a/.github/workflows/release_documentation.yml +++ b/.github/workflows/release_documentation.yml @@ -19,6 +19,7 @@ defaults: jobs: publish: + concurrency: publish runs-on: ubuntu-latest steps: From ddd3862927f54b5e2d6e5d802eda7618a692cb12 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Fri, 7 Jan 2022 10:56:23 +0200 Subject: [PATCH 17/25] Fixing multi-line if statement. Refactoring. --- .github/scripts/set_version_numbers_env.sh | 4 +- .github/workflows/build.yml | 59 +++++++++++++++------ .github/workflows/release_documentation.yml | 28 +++++++--- .travis/get_project_version.sh | 6 +-- .travis/install.sh | 3 +- .travis/push_docs_to_github_io.sh | 4 +- .travis/update_project_version.sh | 2 +- .travis/validate_report_files.sh | 4 +- 8 files changed, 73 insertions(+), 37 deletions(-) diff --git a/.github/scripts/set_version_numbers_env.sh b/.github/scripts/set_version_numbers_env.sh index 8f463c49b..ea019ea07 100755 --- a/.github/scripts/set_version_numbers_env.sh +++ b/.github/scripts/set_version_numbers_env.sh @@ -1,10 +1,10 @@ #!/bin/bash -UTPLSQL_BUILD_NO=$( expr ${JOB_NUMBER} + ${UTPLSQL_BUILD_NO_OFFSET} ) +UTPLSQL_BUILD_NO=$( expr ${GITHUB_RUN_NUMBER} + ${UTPLSQL_BUILD_NO_OFFSET} ) UTPLSQL_VERSION=$(.travis/get_project_version.sh) echo "UTPLSQL_BUILD_NO=${UTPLSQL_BUILD_NO}" >> $GITHUB_ENV echo "UTPLSQL_VERSION=${UTPLSQL_VERSION}" >> $GITHUB_ENV echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV -echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV +echo "CURRENT_BRANCH=${CI_ACTION_REF_NAME}" >> $GITHUB_ENV diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16a5d7094..d09dbb8d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,4 @@ name: Build, test, deploy documentation -env: - BUILD_DIR: ${{github.workspace}} - JOB_NUMBER: ${{github.run_number}} on: push: @@ -12,7 +9,6 @@ on: workflow_dispatch: concurrency: ${{github.ref}} - defaults: run: shell: bash @@ -21,13 +17,12 @@ jobs: build-and-test: name: Build and test on ${{matrix.db_version_name}} DB + runs-on: ubuntu-latest env: ORACLE_VERSION: ${{matrix.oracle-version}} CONNECTION_STR: ${{matrix.connection-str}} ORACLE_PASSWORD: oracle DOCKER_VOLUME: ${{matrix.docker-volume}} - - runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -67,9 +62,10 @@ jobs: image: ${{matrix.oracle-version}} env: ORACLE_PASSWORD: oracle -# credentials: -# username: ${{ secrets.DOCKER_USER }} -# password: ${{ secrets.DOCKER_PASSWORD }} + MATRIX_JOB_ID: ${{matrix.id}} + credentials: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASSWORD }} ports: - 1521:1521 options: >- @@ -82,11 +78,37 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: nelonoel/branch-name@v1.0.1 - uses: c-py/action-dotenv-to-setenv@v2 with: env-file: .github/variables/.env - + - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action + + - name: Print environment variables + run: | + echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$CI_REPOSITORY" + echo "CI_REF_SLUG=$CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" + echo "CI_REF=$CI_REF" + echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$CI_BASE_REF" + echo "CI_SHA_SHORT=$CI_SHA_SHORT" + echo "CI_SHA=$CI_SHA" + echo "CI_ACTOR=$CI_ACTOR" + echo "CI_EVENT_NAME=$CI_EVENT_NAME" + echo "CI_RUN_ID=$CI_RUN_ID" + echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" + echo "CI_WORKFLOW=$CI_WORKFLOW" + echo "CI_ACTION=$CI_ACTION" - name: Set build version number env variables id: set-build-version-number-vars @@ -147,19 +169,19 @@ jobs: concurrency: publish runs-on: ubuntu-latest if: | - ${{ github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null - && ( startsWith( github.ref, 'refs/heads/release/v' ) || github.ref == 'refs/heads/develop' ) - }} + github.repository == 'utPLSQL/utPLSQL' && + github.base_ref == null && + ( startsWith( github.ref, 'refs/heads/release/v' ) || + github.ref == 'refs/heads/develop' ) steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - #Populates the value of BRANCH_NAME env variable - - uses: nelonoel/branch-name@v1.0.1 - uses: c-py/action-dotenv-to-setenv@v2 with: env-file: .github/variables/.env + - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - name: Set buid version number env variables id: set-build-version-number-vars @@ -171,7 +193,10 @@ jobs: - name: Push version update to repository id: push-version-number-update - run: .travis/push_project_version.sh + run: | + git add sonar-project.properties VERSION source/* docs/* + git commit -m 'Updated project version after build [skip ci]' + git push --quiet origin HEAD:${CI_ACTION_REF_NAME} - name: Copy and push documentation to utPLSQL-github-io repo id: push-documentation diff --git a/.github/workflows/release_documentation.yml b/.github/workflows/release_documentation.yml index fbf31a718..16412aa8f 100644 --- a/.github/workflows/release_documentation.yml +++ b/.github/workflows/release_documentation.yml @@ -1,7 +1,5 @@ name: Create and publish release artifacts env: - BUILD_DIR: ${{github.workspace}} - JOB_NUMBER: ${{github.run_number}} PULL_REQUEST_NAME: ${{github.head_ref}} PULL_REQUEST_BRANCH: ${{github.head_ref}} REPO_SLUG: ${{github.repository}} @@ -26,8 +24,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - - uses: nelonoel/branch-name@v1.0.1 + - uses: c-py/action-dotenv-to-setenv@v2 + with: + env-file: .github/variables/.env + - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - name: Set buid version number env variables run: .github/scripts/set_version_numbers_env.sh @@ -43,15 +43,27 @@ jobs: - name: Update project version & build number in source code and documentation run: .travis/update_project_version.sh - - name: Push version update to repository - run: .travis/push_project_version.sh - - name: Copy and push documentation to utPLSQL-github-io repo env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} run: .travis/push_docs_to_github_io.sh -# TODO - add slack notifications + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: [publish] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + # Optional Input + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' + # TODO - add building of release archive # TODO - add publishing of release diff --git a/.travis/get_project_version.sh b/.travis/get_project_version.sh index 20a658ed9..60fc0a796 100755 --- a/.travis/get_project_version.sh +++ b/.travis/get_project_version.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash #When building a new version from a release branch, the version is taken from release branch name -if [[ "${CURRENT_BRANCH}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then - version=${CURRENT_BRANCH#release\/} +if [[ "${CI_ACTION_REF_NAME}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then + version=${CI_ACTION_REF_NAME#release\/} else #Otherwise, version is taken from the VERSION file version=`cat VERSION` #When on develop branch, add "-develop" to the version text - if [[ "${CURRENT_BRANCH}" == "develop" ]]; then + if [[ "${CI_ACTION_REF_NAME}" == "develop" ]]; then version=`sed -E "s/(v?[0-9]+\.[0-9]+\.[0-9]+).*/\1-develop/" <<< "${version}"` fi fi diff --git a/.travis/install.sh b/.travis/install.sh index 603cb7d1e..4db64ccdb 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -20,8 +20,7 @@ alter session set plsql_optimize_level=0; @${INSTALL_FILE} $UT3_DEVELOP_SCHEMA $UT3_DEVELOP_SCHEMA_PASSWORD SQL -#Run this step only on second child job (12.1 - at it's fastest) -if [[ "${JOB_NUMBER}" =~ \.2$ ]]; then +if [[ "${MATRIX_JOB_ID}" == 1 ]]; then #check code-style for errors time "$SQLCLI" $UT3_DEVELOP_SCHEMA/$UT3_DEVELOP_SCHEMA_PASSWORD@//$CONNECTION_STR @../development/utplsql_style_check.sql diff --git a/.travis/push_docs_to_github_io.sh b/.travis/push_docs_to_github_io.sh index 689cb99c9..83babbae7 100755 --- a/.travis/push_docs_to_github_io.sh +++ b/.travis/push_docs_to_github_io.sh @@ -78,9 +78,9 @@ if [ ! -f index.md ]; then fi #If build running on a TAG - it's a new release - need to add it to documentation if [ "${GITHUB_REF_TYPE}" == "tag" ]; then - sed -i '7s@.*@'" - [Latest ${CURRENT_BRANCH} documentation](latest/) - Created $now"'@' index.md + sed -i '7s@.*@'" - [Latest ${CI_ACTION_REF_NAME} documentation](latest/) - Created $now"'@' index.md #add entry to the top of version history (line end of file - ## Released Version Doc History - sed -i '12i'" - [${CURRENT_BRANCH} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md + sed -i '12i'" - [${CI_ACTION_REF_NAME} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md fi #replace 4th line in log sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md diff --git a/.travis/update_project_version.sh b/.travis/update_project_version.sh index bb6f72f00..586cb5b64 100755 --- a/.travis/update_project_version.sh +++ b/.travis/update_project_version.sh @@ -2,7 +2,7 @@ UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*" -echo Current branch is "${CURRENT_BRANCH}" +echo Current branch is "${CI_ACTION_REF_NAME}" echo Update version in project source files find source -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PATTERN}/${UTPLSQL_BUILD_VERSION}/" {} \; diff --git a/.travis/validate_report_files.sh b/.travis/validate_report_files.sh index 7c7d1354d..e9479a42e 100755 --- a/.travis/validate_report_files.sh +++ b/.travis/validate_report_files.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash GL_VALID=1 -XSD_DIR="$BUILD_DIR/.travis/xsd" -XML_JAR_DIR="$BUILD_DIR/.travis/lib" +XSD_DIR=".travis/xsd" +XML_JAR_DIR=".travis/lib" #XML Validator XML_VALIDATOR="$XML_JAR_DIR/xml_validator.jar" HTML_VALIDATOR_URL="https://validator.w3.org/nu/" From 5b64836a255df7f69846ee7224db7ad1ded6e6e8 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Sat, 8 Jan 2022 01:17:09 +0200 Subject: [PATCH 18/25] Implementing Release Action --- .github/workflows/build.yml | 5 +- ...{release_documentation.yml => release.yml} | 57 ++++++++++++++----- .travis/build_docs.sh | 6 -- .travis/build_release_archive.sh | 18 ------ 4 files changed, 47 insertions(+), 39 deletions(-) rename .github/workflows/{release_documentation.yml => release.yml} (55%) delete mode 100755 .travis/build_docs.sh delete mode 100755 .travis/build_release_archive.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d09dbb8d4..55df103ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,7 +165,7 @@ jobs: publish: name: Deploy documentation - needs: [build-and-test] + needs: [ build-and-test ] concurrency: publish runs-on: ubuntu-latest if: | @@ -207,7 +207,7 @@ jobs: slack-workflow-status: if: always() name: Post Workflow Status To Slack - needs: [build-and-test, publish] + needs: [ build-and-test, publish ] runs-on: ubuntu-latest steps: - name: Slack Workflow Notification @@ -219,3 +219,4 @@ jobs: # Optional Input name: 'Github Actions[bot]' icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' +#TODO - add triggering of builds on other repositories \ No newline at end of file diff --git a/.github/workflows/release_documentation.yml b/.github/workflows/release.yml similarity index 55% rename from .github/workflows/release_documentation.yml rename to .github/workflows/release.yml index 16412aa8f..eb8bf34b5 100644 --- a/.github/workflows/release_documentation.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,7 @@ name: Create and publish release artifacts -env: - PULL_REQUEST_NAME: ${{github.head_ref}} - PULL_REQUEST_BRANCH: ${{github.head_ref}} - REPO_SLUG: ${{github.repository}} - PR_SLUG: ${{github.repository}} - on: release: - types: [ created ] + types: [ released ] #See: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-multiple-events-with-activity-types-or-configuration defaults: @@ -17,6 +11,7 @@ defaults: jobs: publish: + name: Deploy documentation concurrency: publish runs-on: ubuntu-latest @@ -37,9 +32,6 @@ jobs: git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - - name: Install MkDocs - run: pip install mkdocs - - name: Update project version & build number in source code and documentation run: .travis/update_project_version.sh @@ -48,11 +40,52 @@ jobs: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} run: .travis/push_docs_to_github_io.sh + upload_artifacts: + name: Upload archives + concurrency: upload + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Update project version & build number in source code and documentation + run: .travis/update_project_version.sh + + - name: Setup git config + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + - name: Build html documentation + run: | + pip install mkdocs + mkdocs build --clean --strict + rm -rf docs/* + cp -r -v site/* docs + git add . + git commit -m "tmp commit of HTML documentation for building a release archive" + + - name: Build release archives + run: | + git archive --prefix=utPLSQL/ -o utPLSQL.zip --format=zip HEAD + git archive --prefix=utPLSQL/ -o utPLSQL.tar.gz --format=tar.gz HEAD + md5sum utPLSQL.zip --tag > utPLSQL.zip.md5 + md5sum utPLSQL.tar.gz --tag > utPLSQL.tar.gz.md5 + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + utPLSQL.zip + utPLSQL.zip.md5 + utPLSQL.tar.gz + utPLSQL.tar.gz.md5 slack-workflow-status: if: always() name: Post Workflow Status To Slack - needs: [publish] + needs: [ publish, upload_artifacts ] runs-on: ubuntu-latest steps: - name: Slack Workflow Notification @@ -65,5 +98,3 @@ jobs: name: 'Github Actions[bot]' icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' -# TODO - add building of release archive -# TODO - add publishing of release diff --git a/.travis/build_docs.sh b/.travis/build_docs.sh deleted file mode 100755 index db43d7ca9..000000000 --- a/.travis/build_docs.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Change working directory to script directory -cd "${0%/*}" -# Change back to root -cd .. -mkdocs build --clean --strict diff --git a/.travis/build_release_archive.sh b/.travis/build_release_archive.sh deleted file mode 100755 index 9667cba7e..000000000 --- a/.travis/build_release_archive.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# remove markdown documentation -rm -rf docs/* -# and replace it with generated html documentation from the ignored site folder -cp -r -v site/* docs - -git add . -git commit -m "tmp commit for building a release archive" - -# git archive --prefix="utPLSQL${UTPLSQL_BUILD_VERSION}"/ -o "utPLSQL${UTPLSQL_BUILD_VERSION}".zip --format=zip HEAD -# git archive --prefix="utPLSQL${UTPLSQL_BUILD_VERSION}"/ -o "utPLSQL${UTPLSQL_BUILD_VERSION}".tar.gz --format=tar.gz HEAD - -git archive --prefix=utPLSQL/ -o utPLSQL.zip --format=zip HEAD -git archive --prefix=utPLSQL/ -o utPLSQL.tar.gz --format=tar.gz HEAD -md5sum utPLSQL.zip --tag > utPLSQL.zip.md5 -md5sum utPLSQL.tar.gz --tag > utPLSQL.tar.gz.md5 - From 28cdee35174e069113e3e22048fe53a52501a496 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Sun, 9 Jan 2022 01:20:28 +0200 Subject: [PATCH 19/25] Refactoring and adding dispatch of other repositories --- .gitattributes | 1 + .../scripts}/get_project_build_version.sh | 0 .../scripts}/get_project_version.sh | 0 {.travis => .github/scripts}/install.sh | 2 +- .../scripts}/install_utplsql_release.sh | 2 +- .../scripts}/lib/xml_validator.jar | Bin .../scripts}/push_docs_to_github_io.sh | 12 +-- .../scripts}/push_project_version.sh | 0 {.travis => .github/scripts}/run_examples.sh | 2 +- .github/scripts/set_version_numbers_env.sh | 2 +- .../scripts}/update_project_version.sh | 0 .../scripts}/validate_report_files.sh | 6 +- {.travis => .github/scripts}/xsd/junit4.xsd | 0 .../scripts}/xsd/junit_windy.xsd | 0 .github/workflows/build.yml | 93 ++++++++---------- .github/workflows/release.yml | 6 +- development/install.sh | 4 +- readme.md | 1 + 18 files changed, 64 insertions(+), 67 deletions(-) rename {.travis => .github/scripts}/get_project_build_version.sh (100%) rename {.travis => .github/scripts}/get_project_version.sh (100%) rename {.travis => .github/scripts}/install.sh (99%) rename {.travis => .github/scripts}/install_utplsql_release.sh (97%) rename {.travis => .github/scripts}/lib/xml_validator.jar (100%) rename {.travis => .github/scripts}/push_docs_to_github_io.sh (92%) rename {.travis => .github/scripts}/push_project_version.sh (100%) rename {.travis => .github/scripts}/run_examples.sh (87%) rename {.travis => .github/scripts}/update_project_version.sh (100%) rename {.travis => .github/scripts}/validate_report_files.sh (93%) rename {.travis => .github/scripts}/xsd/junit4.xsd (100%) rename {.travis => .github/scripts}/xsd/junit_windy.xsd (100%) diff --git a/.gitattributes b/.gitattributes index 9cf0f2457..abd1d5471 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ .travis.yml export-ignore mkdocs.yml export-ignore .travis export-ignore +.github export-ignore sonar-project.properties export-ignore tests export-ignore development export-ignore diff --git a/.travis/get_project_build_version.sh b/.github/scripts/get_project_build_version.sh similarity index 100% rename from .travis/get_project_build_version.sh rename to .github/scripts/get_project_build_version.sh diff --git a/.travis/get_project_version.sh b/.github/scripts/get_project_version.sh similarity index 100% rename from .travis/get_project_version.sh rename to .github/scripts/get_project_version.sh diff --git a/.travis/install.sh b/.github/scripts/install.sh similarity index 99% rename from .travis/install.sh rename to .github/scripts/install.sh index 4db64ccdb..095d33810 100755 --- a/.travis/install.sh +++ b/.github/scripts/install.sh @@ -2,7 +2,7 @@ set -ev SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd ${SCRIPT_DIR}/../source +cd ${SCRIPT_DIR}/../../source INSTALL_FILE="install_headless_with_trigger.sql" if [[ ! -f "${INSTALL_FILE}" ]]; then diff --git a/.travis/install_utplsql_release.sh b/.github/scripts/install_utplsql_release.sh similarity index 97% rename from .travis/install_utplsql_release.sh rename to .github/scripts/install_utplsql_release.sh index fea162f8f..e50718c7b 100755 --- a/.travis/install_utplsql_release.sh +++ b/.github/scripts/install_utplsql_release.sh @@ -2,7 +2,7 @@ set -ev SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd ${SCRIPT_DIR}/../${UTPLSQL_DIR}/source +cd ${SCRIPT_DIR}/../../${UTPLSQL_DIR}/source "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <>index.md echo "layout: default" >>index.md echo "---" >>index.md - echo "" >>index.md + echo "" >>index.md echo "# Documentation versions" >>index.md echo "" >>index.md echo "" >>index.md #- 7th line - placeholder for latest release doc diff --git a/.travis/push_project_version.sh b/.github/scripts/push_project_version.sh similarity index 100% rename from .travis/push_project_version.sh rename to .github/scripts/push_project_version.sh diff --git a/.travis/run_examples.sh b/.github/scripts/run_examples.sh similarity index 87% rename from .travis/run_examples.sh rename to .github/scripts/run_examples.sh index 8eb3d097f..bfa4f7e1a 100755 --- a/.travis/run_examples.sh +++ b/.github/scripts/run_examples.sh @@ -2,7 +2,7 @@ set -ev SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd ${SCRIPT_DIR}/../examples +cd ${SCRIPT_DIR}/../../examples "$SQLCLI" $UT3_DEVELOP_SCHEMA/$UT3_DEVELOP_SCHEMA_PASSWORD@//$CONNECTION_STR <> $GITHUB_ENV echo "UTPLSQL_VERSION=${UTPLSQL_VERSION}" >> $GITHUB_ENV diff --git a/.travis/update_project_version.sh b/.github/scripts/update_project_version.sh similarity index 100% rename from .travis/update_project_version.sh rename to .github/scripts/update_project_version.sh diff --git a/.travis/validate_report_files.sh b/.github/scripts/validate_report_files.sh similarity index 93% rename from .travis/validate_report_files.sh rename to .github/scripts/validate_report_files.sh index e9479a42e..59376a174 100755 --- a/.travis/validate_report_files.sh +++ b/.github/scripts/validate_report_files.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + GL_VALID=1 -XSD_DIR=".travis/xsd" -XML_JAR_DIR=".travis/lib" +XSD_DIR="${SCRIPT_DIR}/xsd" +XML_JAR_DIR="${SCRIPT_DIR}/lib" #XML Validator XML_VALIDATOR="$XML_JAR_DIR/xml_validator.jar" HTML_VALIDATOR_URL="https://validator.w3.org/nu/" diff --git a/.travis/xsd/junit4.xsd b/.github/scripts/xsd/junit4.xsd similarity index 100% rename from .travis/xsd/junit4.xsd rename to .github/scripts/xsd/junit4.xsd diff --git a/.travis/xsd/junit_windy.xsd b/.github/scripts/xsd/junit_windy.xsd similarity index 100% rename from .travis/xsd/junit_windy.xsd rename to .github/scripts/xsd/junit_windy.xsd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55df103ce..c05b81977 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,7 @@ name: Build, test, deploy documentation - on: push: - branches: [ develop, feature/github_actions ] + branches-ignore: [ main ] pull_request: branches: [ develop ] @@ -15,7 +14,7 @@ defaults: jobs: - build-and-test: + build: name: Build and test on ${{matrix.db_version_name}} DB runs-on: ubuntu-latest env: @@ -83,43 +82,17 @@ jobs: env-file: .github/variables/.env - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - - name: Print environment variables - run: | - echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" - echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" - echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" - echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" - echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" - echo "CI_REPOSITORY=$CI_REPOSITORY" - echo "CI_REF_SLUG=$CI_REF_SLUG" - echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" - echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" - echo "CI_REF_NAME=$CI_REF_NAME" - echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" - echo "CI_REF=$CI_REF" - echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" - echo "CI_HEAD_REF=$CI_HEAD_REF" - echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" - echo "CI_BASE_REF=$CI_BASE_REF" - echo "CI_SHA_SHORT=$CI_SHA_SHORT" - echo "CI_SHA=$CI_SHA" - echo "CI_ACTOR=$CI_ACTOR" - echo "CI_EVENT_NAME=$CI_EVENT_NAME" - echo "CI_RUN_ID=$CI_RUN_ID" - echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" - echo "CI_WORKFLOW=$CI_WORKFLOW" - echo "CI_ACTION=$CI_ACTION" - - name: Set build version number env variables id: set-build-version-number-vars run: .github/scripts/set_version_numbers_env.sh - name: Update project version & build number to verify that code is deployable after the update id: update-project-version - run: .travis/update_project_version.sh + run: .github/scripts/update_project_version.sh - - name: Download latest utPLSQL release - run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR + - name: Download utPLSQL release for testing +# For PR build - test using target branch as framework, for branch build use self as testing framework + run: git clone --depth=1 --branch=${CI_HEAD_REF:-$CI_REF_NAME} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR - name: Update privileges on sources run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} @@ -134,19 +107,19 @@ jobs: - name: Install utPLSQL id: install-utplsql - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install.sh - name: Install utPLSQL release id: install-utplsql-release - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install_utplsql_release.sh - name: Run Examples id: run-examples - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/run_examples.sh - name: Install tests id: install-tests - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} test/install_tests.sh - name: Run Tests id: run-tests @@ -154,7 +127,7 @@ jobs: - name: Validate utPLSQL reports format id: validate-reports-format - run: bash .travis/validate_report_files.sh + run: bash .github/scripts/validate_report_files.sh - name: SonarCloud Scan id: sonar @@ -165,15 +138,16 @@ jobs: publish: name: Deploy documentation - needs: [ build-and-test ] + needs: [ build ] concurrency: publish runs-on: ubuntu-latest if: | github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null && - ( startsWith( github.ref, 'refs/heads/release/v' ) || - github.ref == 'refs/heads/develop' ) - + ( startsWith( github.ref, 'refs/heads/release/v' ) + || github.ref == 'refs/heads/develop' + || github.ref == 'refs/heads/feature/github_actions' + ) steps: - uses: actions/checkout@v2 with: @@ -182,32 +156,52 @@ jobs: with: env-file: .github/variables/.env - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - - name: Set buid version number env variables id: set-build-version-number-vars run: .github/scripts/set_version_numbers_env.sh - - name: Update project version & build number in source code and documentation id: update-project-version - run: .travis/update_project_version.sh - + run: .github/scripts/update_project_version.sh - name: Push version update to repository id: push-version-number-update run: | git add sonar-project.properties VERSION source/* docs/* git commit -m 'Updated project version after build [skip ci]' git push --quiet origin HEAD:${CI_ACTION_REF_NAME} - - name: Copy and push documentation to utPLSQL-github-io repo id: push-documentation env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} - run: .travis/push_docs_to_github_io.sh + run: .github/scripts/push_docs_to_github_io.sh + + dispatch: + name: Dispatch downstream builds + concurrency: trigger + needs: [ build, publish ] + runs-on: ubuntu-latest + if: | + github.repository == 'utPLSQL/utPLSQL' && + github.base_ref == null && + ( startsWith( github.ref, 'refs/heads/release/v' ) + || github.ref == 'refs/heads/develop' + || github.ref == 'refs/heads/feature/github_actions' + ) + strategy: + matrix: + repo: ['utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project'] +# repo: ['utPLSQL/utPLSQL-java-api', 'utPLSQL/utPLSQL-v2-v3-migration', 'utPLSQL/utPLSQL-cli', 'utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project'] + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.API_TOKEN_GITHUB }} + repository: ${{ matrix.repo }} + event-type: utPLSQL-build slack-workflow-status: if: always() name: Post Workflow Status To Slack - needs: [ build-and-test, publish ] + needs: [ build, publish, dispatch ] runs-on: ubuntu-latest steps: - name: Slack Workflow Notification @@ -219,4 +213,3 @@ jobs: # Optional Input name: 'Github Actions[bot]' icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' -#TODO - add triggering of builds on other repositories \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb8bf34b5..3d1ecb6b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,12 +33,12 @@ jobs: git config --global user.name "github-actions[bot]" - name: Update project version & build number in source code and documentation - run: .travis/update_project_version.sh + run: .github/scripts/update_project_version.sh - name: Copy and push documentation to utPLSQL-github-io repo env: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} - run: .travis/push_docs_to_github_io.sh + run: .github/scripts/push_docs_to_github_io.sh upload_artifacts: name: Upload archives @@ -50,7 +50,7 @@ jobs: with: fetch-depth: 0 - name: Update project version & build number in source code and documentation - run: .travis/update_project_version.sh + run: .github/scripts/update_project_version.sh - name: Setup git config run: | diff --git a/development/install.sh b/development/install.sh index ff112392f..627bd113d 100755 --- a/development/install.sh +++ b/development/install.sh @@ -10,11 +10,11 @@ if ! development/cleanup.sh; then echo -e ${header}"\nFailed to cleanup utPLSQL environment\n"${header} exit 1 fi -if ! .travis/install.sh; then +if ! .github/scripts/install.sh; then echo -e ${header}"\nFailed to install utPLSQL from current branch into ${UT3_DEVELOP_SCHEMA} schema\n"${header} exit 1 fi -if ! .travis/install_utplsql_release.sh; then +if ! .github/scripts/install_utplsql_release.sh; then echo -e ${header}"\nFailed to install utPLSQL from branch ${SELFTESTING_BRANCH} into ${UT3_RELEASE_VERSION_SCHEMA}\n"${header} exit 1 fi diff --git a/readme.md b/readme.md index 0928f2b95..b3a12d5d6 100644 --- a/readme.md +++ b/readme.md @@ -172,6 +172,7 @@ To sign up to the chat use [this link](https://join.slack.com/t/utplsql/shared_i ---------- __Project Directories__ +* .github - contains files needed for github Actions integration * .travis - contains files needed for travis-ci integration * client_source - Sources to be used on the client-side. Developer workstation or CI platform to run the tests. * development - Set of useful scripts and utilities for development and debugging of utPLSQL From 0e6eb7077727b977081fcb90dac1151e5f4f90aa Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Sun, 9 Jan 2022 02:55:40 +0200 Subject: [PATCH 20/25] Testing triggering of build process on other repositories --- .github/workflows/build.yml | 352 ++++++++++++++++++------------------ 1 file changed, 176 insertions(+), 176 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c05b81977..231137bcb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,170 +14,170 @@ defaults: jobs: - build: - name: Build and test on ${{matrix.db_version_name}} DB - runs-on: ubuntu-latest - env: - ORACLE_VERSION: ${{matrix.oracle-version}} - CONNECTION_STR: ${{matrix.connection-str}} - ORACLE_PASSWORD: oracle - DOCKER_VOLUME: ${{matrix.docker-volume}} - strategy: - fail-fast: false - matrix: - include: - - oracle-version: "gvenzl/oracle-xe:11-full" - connection-str: '127.0.0.1:1521/XE' - id: 1 - db_version_name: '11xe' -# TODO - need to add healthcheck.sh into our containers -# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# id: 2 -# db_version_name: '12.1se' -# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# id: 3 -# db_version_name: '12.2se' - - oracle-version: "gvenzl/oracle-xe:18-slim" - connection-str: '127.0.0.1:1521/XE' - id: 4 - db_version_name: '18xe' -# - oracle-version: "utplsqlv3/oracledb:18c-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# id: 5 -# db_version_name: '18se' -# - oracle-version: "utplsqlv3/oracledb:19c-se2-small" -# connection-str: '127.0.0.1:1521/ORCLCDB' -# id: 6 -# db_version_name: '19se' - - oracle-version: "gvenzl/oracle-xe:21-slim" - connection-str: '127.0.0.1:1521/XE' - id: 7 - db_version_name: '21xe' - - services: - oracle: - image: ${{matrix.oracle-version}} - env: - ORACLE_PASSWORD: oracle - MATRIX_JOB_ID: ${{matrix.id}} - credentials: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - 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 - - uses: c-py/action-dotenv-to-setenv@v2 - with: - env-file: .github/variables/.env - - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - - - name: Set build version number env variables - id: set-build-version-number-vars - run: .github/scripts/set_version_numbers_env.sh - - - name: Update project version & build number to verify that code is deployable after the update - id: update-project-version - run: .github/scripts/update_project_version.sh - - - name: Download utPLSQL release for testing -# For PR build - test using target branch as framework, for branch build use self as testing framework - run: git clone --depth=1 --branch=${CI_HEAD_REF:-$CI_REF_NAME} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR - - - name: Update privileges on sources - run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} - - - name: Add OJDBC home - id: get-ojdbc - run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar - - - name: Install utPLSQL-cli - id: 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 utPLSQL - id: install-utplsql - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install.sh - - - name: Install utPLSQL release - id: install-utplsql-release - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install_utplsql_release.sh - - - name: Run Examples - id: run-examples - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/run_examples.sh - - - name: Install tests - id: install-tests - run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} test/install_tests.sh - - - name: Run Tests - id: run-tests - run: bash test/run_tests.sh - - - name: Validate utPLSQL reports format - id: validate-reports-format - run: bash .github/scripts/validate_report_files.sh - - - name: SonarCloud Scan - id: sonar - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - publish: - name: Deploy documentation - needs: [ build ] - concurrency: publish - runs-on: ubuntu-latest - if: | - github.repository == 'utPLSQL/utPLSQL' && - github.base_ref == null && - ( startsWith( github.ref, 'refs/heads/release/v' ) - || github.ref == 'refs/heads/develop' - || github.ref == 'refs/heads/feature/github_actions' - ) - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: c-py/action-dotenv-to-setenv@v2 - with: - env-file: .github/variables/.env - - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action - - name: Set buid version number env variables - id: set-build-version-number-vars - run: .github/scripts/set_version_numbers_env.sh - - name: Update project version & build number in source code and documentation - id: update-project-version - run: .github/scripts/update_project_version.sh - - name: Push version update to repository - id: push-version-number-update - run: | - git add sonar-project.properties VERSION source/* docs/* - git commit -m 'Updated project version after build [skip ci]' - git push --quiet origin HEAD:${CI_ACTION_REF_NAME} - - name: Copy and push documentation to utPLSQL-github-io repo - id: push-documentation - env: - API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} - run: .github/scripts/push_docs_to_github_io.sh +# build: +# name: Build and test on ${{matrix.db_version_name}} DB +# runs-on: ubuntu-latest +# env: +# ORACLE_VERSION: ${{matrix.oracle-version}} +# CONNECTION_STR: ${{matrix.connection-str}} +# ORACLE_PASSWORD: oracle +# DOCKER_VOLUME: ${{matrix.docker-volume}} +# strategy: +# fail-fast: false +# matrix: +# include: +# - oracle-version: "gvenzl/oracle-xe:11-full" +# connection-str: '127.0.0.1:1521/XE' +# id: 1 +# db_version_name: '11xe' +## TODO - need to add healthcheck.sh into our containers +## - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## id: 2 +## db_version_name: '12.1se' +## - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## id: 3 +## db_version_name: '12.2se' +# - oracle-version: "gvenzl/oracle-xe:18-slim" +# connection-str: '127.0.0.1:1521/XE' +# id: 4 +# db_version_name: '18xe' +## - oracle-version: "utplsqlv3/oracledb:18c-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## id: 5 +## db_version_name: '18se' +## - oracle-version: "utplsqlv3/oracledb:19c-se2-small" +## connection-str: '127.0.0.1:1521/ORCLCDB' +## id: 6 +## db_version_name: '19se' +# - oracle-version: "gvenzl/oracle-xe:21-slim" +# connection-str: '127.0.0.1:1521/XE' +# id: 7 +# db_version_name: '21xe' +# +# services: +# oracle: +# image: ${{matrix.oracle-version}} +# env: +# ORACLE_PASSWORD: oracle +# MATRIX_JOB_ID: ${{matrix.id}} +# credentials: +# username: ${{ secrets.DOCKER_USER }} +# password: ${{ secrets.DOCKER_PASSWORD }} +# 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 +# - uses: c-py/action-dotenv-to-setenv@v2 +# with: +# env-file: .github/variables/.env +# - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action +# +# - name: Set build version number env variables +# id: set-build-version-number-vars +# run: .github/scripts/set_version_numbers_env.sh +# +# - name: Update project version & build number to verify that code is deployable after the update +# id: update-project-version +# run: .github/scripts/update_project_version.sh +# +# - name: Download utPLSQL release for testing +## For PR build - test using target branch as framework, for branch build use self as testing framework +# run: git clone --depth=1 --branch=${CI_HEAD_REF:-$CI_REF_NAME} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR +# +# - name: Update privileges on sources +# run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} +# +# - name: Add OJDBC home +# id: get-ojdbc +# run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar +# +# - name: Install utPLSQL-cli +# id: 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 utPLSQL +# id: install-utplsql +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install.sh +# +# - name: Install utPLSQL release +# id: install-utplsql-release +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install_utplsql_release.sh +# +# - name: Run Examples +# id: run-examples +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/run_examples.sh +# +# - name: Install tests +# id: install-tests +# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} test/install_tests.sh +# +# - name: Run Tests +# id: run-tests +# run: bash test/run_tests.sh +# +# - name: Validate utPLSQL reports format +# id: validate-reports-format +# run: bash .github/scripts/validate_report_files.sh +# +# - name: SonarCloud Scan +# id: sonar +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# +# publish: +# name: Deploy documentation +# needs: [ build ] +# concurrency: publish +# runs-on: ubuntu-latest +# if: | +# github.repository == 'utPLSQL/utPLSQL' && +# github.base_ref == null && +# ( startsWith( github.ref, 'refs/heads/release/v' ) +# || github.ref == 'refs/heads/develop' +# || github.ref == 'refs/heads/feature/github_actions' +# ) +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# - uses: c-py/action-dotenv-to-setenv@v2 +# with: +# env-file: .github/variables/.env +# - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action +# - name: Set buid version number env variables +# id: set-build-version-number-vars +# run: .github/scripts/set_version_numbers_env.sh +# - name: Update project version & build number in source code and documentation +# id: update-project-version +# run: .github/scripts/update_project_version.sh +# - name: Push version update to repository +# id: push-version-number-update +# run: | +# git add sonar-project.properties VERSION source/* docs/* +# git commit -m 'Updated project version after build [skip ci]' +# git push --quiet origin HEAD:${CI_ACTION_REF_NAME} +# - name: Copy and push documentation to utPLSQL-github-io repo +# id: push-documentation +# env: +# API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} +# run: .github/scripts/push_docs_to_github_io.sh dispatch: name: Dispatch downstream builds concurrency: trigger - needs: [ build, publish ] +# needs: [ build, publish ] runs-on: ubuntu-latest if: | github.repository == 'utPLSQL/utPLSQL' && @@ -195,21 +195,21 @@ jobs: uses: peter-evans/repository-dispatch@v1 with: token: ${{ secrets.API_TOKEN_GITHUB }} - repository: ${{ matrix.repo }} + repository: ${{ matrix.repo }} event-type: utPLSQL-build - slack-workflow-status: - if: always() - name: Post Workflow Status To Slack - needs: [ build, publish, dispatch ] - runs-on: ubuntu-latest - steps: - - name: Slack Workflow Notification - uses: Gamesight/slack-workflow-status@master - with: - # Required Input - repo_token: ${{secrets.GITHUB_TOKEN}} - slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} - # Optional Input - name: 'Github Actions[bot]' - icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' +# slack-workflow-status: +# if: always() +# name: Post Workflow Status To Slack +# needs: [ build, publish, dispatch ] +# runs-on: ubuntu-latest +# steps: +# - name: Slack Workflow Notification +# uses: Gamesight/slack-workflow-status@master +# with: +# # Required Input +# repo_token: ${{secrets.GITHUB_TOKEN}} +# slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} +# # Optional Input +# name: 'Github Actions[bot]' +# icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' From 06f35569d226984d6d929082d9f00a4ee4efc09e Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Mon, 10 Jan 2022 10:43:16 +0200 Subject: [PATCH 21/25] Enabling build and slack notification --- .github/workflows/build.yml | 348 ++++++++++++++++++------------------ 1 file changed, 174 insertions(+), 174 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 231137bcb..b09f4de53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,165 +14,165 @@ defaults: jobs: -# build: -# name: Build and test on ${{matrix.db_version_name}} DB -# runs-on: ubuntu-latest -# env: -# ORACLE_VERSION: ${{matrix.oracle-version}} -# CONNECTION_STR: ${{matrix.connection-str}} -# ORACLE_PASSWORD: oracle -# DOCKER_VOLUME: ${{matrix.docker-volume}} -# strategy: -# fail-fast: false -# matrix: -# include: -# - oracle-version: "gvenzl/oracle-xe:11-full" -# connection-str: '127.0.0.1:1521/XE' -# id: 1 -# db_version_name: '11xe' -## TODO - need to add healthcheck.sh into our containers -## - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## id: 2 -## db_version_name: '12.1se' -## - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## id: 3 -## db_version_name: '12.2se' -# - oracle-version: "gvenzl/oracle-xe:18-slim" -# connection-str: '127.0.0.1:1521/XE' -# id: 4 -# db_version_name: '18xe' -## - oracle-version: "utplsqlv3/oracledb:18c-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## id: 5 -## db_version_name: '18se' -## - oracle-version: "utplsqlv3/oracledb:19c-se2-small" -## connection-str: '127.0.0.1:1521/ORCLCDB' -## id: 6 -## db_version_name: '19se' -# - oracle-version: "gvenzl/oracle-xe:21-slim" -# connection-str: '127.0.0.1:1521/XE' -# id: 7 -# db_version_name: '21xe' -# -# services: -# oracle: -# image: ${{matrix.oracle-version}} -# env: -# ORACLE_PASSWORD: oracle -# MATRIX_JOB_ID: ${{matrix.id}} -# credentials: -# username: ${{ secrets.DOCKER_USER }} -# password: ${{ secrets.DOCKER_PASSWORD }} -# 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 -# - uses: c-py/action-dotenv-to-setenv@v2 -# with: -# env-file: .github/variables/.env -# - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action -# -# - name: Set build version number env variables -# id: set-build-version-number-vars -# run: .github/scripts/set_version_numbers_env.sh -# -# - name: Update project version & build number to verify that code is deployable after the update -# id: update-project-version -# run: .github/scripts/update_project_version.sh -# -# - name: Download utPLSQL release for testing -## For PR build - test using target branch as framework, for branch build use self as testing framework -# run: git clone --depth=1 --branch=${CI_HEAD_REF:-$CI_REF_NAME} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR -# -# - name: Update privileges on sources -# run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} -# -# - name: Add OJDBC home -# id: get-ojdbc -# run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar -# -# - name: Install utPLSQL-cli -# id: 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 utPLSQL -# id: install-utplsql -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install.sh -# -# - name: Install utPLSQL release -# id: install-utplsql-release -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install_utplsql_release.sh -# -# - name: Run Examples -# id: run-examples -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/run_examples.sh -# -# - name: Install tests -# id: install-tests -# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} test/install_tests.sh -# -# - name: Run Tests -# id: run-tests -# run: bash test/run_tests.sh -# -# - name: Validate utPLSQL reports format -# id: validate-reports-format -# run: bash .github/scripts/validate_report_files.sh -# -# - name: SonarCloud Scan -# id: sonar -# uses: SonarSource/sonarcloud-github-action@master -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# -# publish: -# name: Deploy documentation -# needs: [ build ] -# concurrency: publish -# runs-on: ubuntu-latest -# if: | -# github.repository == 'utPLSQL/utPLSQL' && -# github.base_ref == null && -# ( startsWith( github.ref, 'refs/heads/release/v' ) -# || github.ref == 'refs/heads/develop' -# || github.ref == 'refs/heads/feature/github_actions' -# ) -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 -# - uses: c-py/action-dotenv-to-setenv@v2 -# with: -# env-file: .github/variables/.env -# - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action -# - name: Set buid version number env variables -# id: set-build-version-number-vars -# run: .github/scripts/set_version_numbers_env.sh -# - name: Update project version & build number in source code and documentation -# id: update-project-version -# run: .github/scripts/update_project_version.sh -# - name: Push version update to repository -# id: push-version-number-update -# run: | -# git add sonar-project.properties VERSION source/* docs/* -# git commit -m 'Updated project version after build [skip ci]' -# git push --quiet origin HEAD:${CI_ACTION_REF_NAME} -# - name: Copy and push documentation to utPLSQL-github-io repo -# id: push-documentation -# env: -# API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} -# run: .github/scripts/push_docs_to_github_io.sh + build: + name: Build and test on ${{matrix.db_version_name}} DB + runs-on: ubuntu-latest + env: + ORACLE_VERSION: ${{matrix.oracle-version}} + CONNECTION_STR: ${{matrix.connection-str}} + ORACLE_PASSWORD: oracle + DOCKER_VOLUME: ${{matrix.docker-volume}} + strategy: + fail-fast: false + matrix: + include: + - oracle-version: "gvenzl/oracle-xe:11-full" + connection-str: '127.0.0.1:1521/XE' + id: 1 + db_version_name: '11xe' +# TODO - need to add healthcheck.sh into our containers +# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 2 +# db_version_name: '12.1se' +# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 3 +# db_version_name: '12.2se' + - oracle-version: "gvenzl/oracle-xe:18-slim" + connection-str: '127.0.0.1:1521/XE' + id: 4 + db_version_name: '18xe' +# - oracle-version: "utplsqlv3/oracledb:18c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 5 +# db_version_name: '18se' +# - oracle-version: "utplsqlv3/oracledb:19c-se2-small" +# connection-str: '127.0.0.1:1521/ORCLCDB' +# id: 6 +# db_version_name: '19se' + - oracle-version: "gvenzl/oracle-xe:21-slim" + connection-str: '127.0.0.1:1521/XE' + id: 7 + db_version_name: '21xe' + + services: + oracle: + image: ${{matrix.oracle-version}} + env: + ORACLE_PASSWORD: oracle + MATRIX_JOB_ID: ${{matrix.id}} + credentials: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASSWORD }} + 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 + - uses: c-py/action-dotenv-to-setenv@v2 + with: + env-file: .github/variables/.env + - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action + + - name: Set build version number env variables + id: set-build-version-number-vars + run: .github/scripts/set_version_numbers_env.sh + + - name: Update project version & build number to verify that code is deployable after the update + id: update-project-version + run: .github/scripts/update_project_version.sh + + - name: Download utPLSQL release for testing +# For PR build - test using target branch as framework, for branch build use self as testing framework + run: git clone --depth=1 --branch=${CI_HEAD_REF:-$CI_REF_NAME} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR + + - name: Update privileges on sources + run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} + + - name: Add OJDBC home + id: get-ojdbc + run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar + + - name: Install utPLSQL-cli + id: 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 utPLSQL + id: install-utplsql + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install.sh + + - name: Install utPLSQL release + id: install-utplsql-release + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/install_utplsql_release.sh + + - name: Run Examples + id: run-examples + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .github/scripts/run_examples.sh + + - name: Install tests + id: install-tests + run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} test/install_tests.sh + + - name: Run Tests + id: run-tests + run: bash test/run_tests.sh + + - name: Validate utPLSQL reports format + id: validate-reports-format + run: bash .github/scripts/validate_report_files.sh + + - name: SonarCloud Scan + id: sonar + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + publish: + name: Deploy documentation + needs: [ build ] + concurrency: publish + runs-on: ubuntu-latest + if: | + github.repository == 'utPLSQL/utPLSQL' && + github.base_ref == null && + ( startsWith( github.ref, 'refs/heads/release/v' ) + || github.ref == 'refs/heads/develop' + || github.ref == 'refs/heads/feature/github_actions' + ) + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: c-py/action-dotenv-to-setenv@v2 + with: + env-file: .github/variables/.env + - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action + - name: Set buid version number env variables + id: set-build-version-number-vars + run: .github/scripts/set_version_numbers_env.sh + - name: Update project version & build number in source code and documentation + id: update-project-version + run: .github/scripts/update_project_version.sh + - name: Push version update to repository + id: push-version-number-update + run: | + git add sonar-project.properties VERSION source/* docs/* + git commit -m 'Updated project version after build [skip ci]' + git push --quiet origin HEAD:${CI_ACTION_REF_NAME} + - name: Copy and push documentation to utPLSQL-github-io repo + id: push-documentation + env: + API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} + run: .github/scripts/push_docs_to_github_io.sh dispatch: name: Dispatch downstream builds @@ -198,18 +198,18 @@ jobs: repository: ${{ matrix.repo }} event-type: utPLSQL-build -# slack-workflow-status: -# if: always() -# name: Post Workflow Status To Slack -# needs: [ build, publish, dispatch ] -# runs-on: ubuntu-latest -# steps: -# - name: Slack Workflow Notification -# uses: Gamesight/slack-workflow-status@master -# with: -# # Required Input -# repo_token: ${{secrets.GITHUB_TOKEN}} -# slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} -# # Optional Input -# name: 'Github Actions[bot]' -# icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: [ build, publish, dispatch ] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + # Optional Input + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' From 6cd8b16c19dd1ef6664c63805e289191d710e1fd Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Mon, 10 Jan 2022 10:44:21 +0200 Subject: [PATCH 22/25] Update documentation publish condition --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b09f4de53..25e24259d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -144,10 +144,7 @@ jobs: if: | github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null && - ( startsWith( github.ref, 'refs/heads/release/v' ) - || github.ref == 'refs/heads/develop' - || github.ref == 'refs/heads/feature/github_actions' - ) + ( startsWith( github.ref, 'refs/heads/release/v' ) || github.ref == 'refs/heads/develop' ) steps: - uses: actions/checkout@v2 with: From 1fc87de3500301c4f81fcb0fac2c3bcc26db5335 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Mon, 10 Jan 2022 10:45:58 +0200 Subject: [PATCH 23/25] Enable dependency on downstream job dispatch --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25e24259d..a19e638b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,7 +174,7 @@ jobs: dispatch: name: Dispatch downstream builds concurrency: trigger -# needs: [ build, publish ] + needs: [ build, publish ] runs-on: ubuntu-latest if: | github.repository == 'utPLSQL/utPLSQL' && From 31cc42dda3497a7a57a5c3f14d36cb6442b14fd8 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 13 Jan 2022 23:35:56 +0200 Subject: [PATCH 24/25] Final cleanup of travis build leftovers. --- .github/workflows/build.yml | 10 +-- .github/workflows/release.yml | 2 - .travis/trigger_travis.sh | 69 --------------- old.travis.yml | 153 ---------------------------------- 4 files changed, 2 insertions(+), 232 deletions(-) delete mode 100755 .travis/trigger_travis.sh delete mode 100644 old.travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a19e638b3..8c72e5043 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -177,12 +177,8 @@ jobs: needs: [ build, publish ] runs-on: ubuntu-latest if: | - github.repository == 'utPLSQL/utPLSQL' && - github.base_ref == null && - ( startsWith( github.ref, 'refs/heads/release/v' ) - || github.ref == 'refs/heads/develop' - || github.ref == 'refs/heads/feature/github_actions' - ) + github.repository == 'utPLSQL/utPLSQL' && github.base_ref == null && + ( startsWith( github.ref, 'refs/heads/release/v' ) || github.ref == 'refs/heads/develop' ) strategy: matrix: repo: ['utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project'] @@ -204,9 +200,7 @@ jobs: - name: Slack Workflow Notification uses: Gamesight/slack-workflow-status@master with: - # Required Input repo_token: ${{secrets.GITHUB_TOKEN}} slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} - # Optional Input name: 'Github Actions[bot]' icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d1ecb6b8..ad1e782c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,10 +91,8 @@ jobs: - name: Slack Workflow Notification uses: Gamesight/slack-workflow-status@master with: - # Required Input repo_token: ${{secrets.GITHUB_TOKEN}} slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} - # Optional Input name: 'Github Actions[bot]' icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' diff --git a/.travis/trigger_travis.sh b/.travis/trigger_travis.sh deleted file mode 100755 index 10083dd89..000000000 --- a/.travis/trigger_travis.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Trigger a new Travis-CI job. -# Ordinarily, a new Travis job is triggered when a commit is pushed to a -# GitHub repository. The trigger-travis.sh script provides a programmatic -# way to trigger a new Travis job. - -# To use this script to trigger a dependent build in Travis, do two things: -# -# 1. Set an environment variable TRAVIS_ACCESS_TOKEN by navigating to -# https://travis-ci.org/MYGITHUBID/MYGITHUBPROJECT/settings -# The TRAVIS_ACCESS_TOKEN environment variable will be set when Travis runs -# the job, but won't be visible to anyone browsing https://travis-ci.org/. -# - -echoerr() { echo "$@" 1>&2; } - -TRAVIS_URL=travis-ci.com -BRANCH=develop -USER="utPLSQL" -RESULT=1 -declare -a REPO_MATRIX=("utPLSQL-java-api" "utPLSQL-v2-v3-migration" "utPLSQL-cli" "utPLSQL-maven-plugin" "utPLSQL-demo-project") - -TOKEN=$1 - -if [ -n "$TRAVIS_REPO_SLUG" ] ; then - MESSAGE=",\"message\": \"Triggered by upstream build of $TRAVIS_REPO_SLUG commit "`git rev-parse --short HEAD`"\"" -else - MESSAGE=",\"message\": \"Triggered manually from shell\"" -fi - -# For debugging: -#echo "MESSAGE=$MESSAGE" - -body="{ -\"request\": { - \"branch\":\"$BRANCH\" - $MESSAGE -}}" - -for DOWNSTREAM_BUILD in "${REPO_MATRIX[@]}"; do - - curl -s -X POST \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - -H "Travis-API-Version: 3" \ - -H "Authorization: token ${TOKEN}" \ - -d "$body" \ - https://api.${TRAVIS_URL}/repo/${USER}%2F${DOWNSTREAM_BUILD}/requests \ - | tee ${DOWNSTREAM_BUILD}-output.txt - - if grep -q '"@type": "error"' ${DOWNSTREAM_BUILD}-output.txt; then - RESULT=0 - echoerr "" - echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD}" - echoerr "" - fi - if grep -q 'access denied' ${DOWNSTREAM_BUILD}-output.txt; then - RESULT=0 - echoerr "" - echoerr "ERROR: Failed to start ${DOWNSTREAM_BUILD} - access denied" - echoerr "" - fi - -done - -if [[ RESULT -eq 0 ]]; then - exit 1 -fi diff --git a/old.travis.yml b/old.travis.yml deleted file mode 100644 index cd1e8efe0..000000000 --- a/old.travis.yml +++ /dev/null @@ -1,153 +0,0 @@ -sudo: required -language: python -os: linux - -jdk: openjdk10 - -addons: - sonarcloud: - organization: utplsql - token: ${SONAR_TOKEN} - -services: - - docker - -env: - global: - - UT3_DEVELOP_SCHEMA=UT3_DEVELOP - - UT3_DEVELOP_SCHEMA_PASSWORD=ut3 - - UT3_RELEASE_VERSION_SCHEMA=UT3 - - UT3_RELEASE_VERSION_SCHEMA_PASSWORD=ut3 - - UT3_USER="UT3\$USER#" - - UT3_USER_PASSWORD=ut3 - - UT3_TESTER=UT3_TESTER - - UT3_TESTER_PASSWORD=ut3 - - UT3_TESTER_HELPER=UT3_TESTER_HELPER - - UT3_TESTER_HELPER_PASSWORD=ut3 - - UT3_TABLESPACE=users - - BUILD_DIR=${TRAVIS_BUILD_DIR} - - JOB_ID=${TRAVIS_JOB_ID} - - JOB_NUMBER=${TRAVIS_JOB_NUMBER} - - PULL_REQUEST_NAME=${TRAVIS_PULL_REQUEST} - - PULL_REQUEST_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH} - - TAG_NAME=${TRAVIS_TAG} - - REPO_SLUG=${TRAVIS_REPO_SLUG} - - PR_SLUG=${TRAVIS_PULL_REQUEST_SLUG} - - BRANCH_NAME=${TRAVIS_BRANCH} - # Environment for building a release - - CURRENT_BRANCH=${TRAVIS_BRANCH} - - UTPLSQL_REPO="utPLSQL/utPLSQL" - - UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}" - - UTPLSQL_VERSION=$(. .travis/get_project_version.sh) - - UTPLSQL_BUILD_VERSION=$(. .travis/get_project_build_version.sh) - - UTPLSQL_SOURCES_DIR='source' - - UTPLSQL_BUILD_USER_NAME="Travis CI" - - CACHE_DIR=$HOME/.cache - # Database Env - - SQLCLI="${BUILD_DIR}/sqlcl/bin/sql" - - OJDBC_HOME="${BUILD_DIR}/ojdbc" - - ORACLE_PWD="oracle" - - DOCKHER_HUB_REPO="utplsqlv3/oracledb" - - DOCKER_VOLUME="/home/oracle/host" - - DOCKER_ENV="-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR" - #utPLSQL released version directory - - UTPLSQL_DIR="utPLSQL_latest_release" - - SELFTESTING_BRANCH=${TRAVIS_BRANCH} - - UTPLSQL_CLI_VERSION="3.1.8" - # Maven - - MAVEN_HOME=/usr/local/maven - - MAVEN_CFG=$HOME/.m2 - jobs: - - ORACLE_VERSION="11g-r2-xe" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_VOLUME="/mnt/host" DOCKER_OPTIONS='--shm-size=1g' -# - ORACLE_VERSION="11-full" CONNECTION_STR='127.0.0.1:1521/XE' DOCKHER_HUB_REPO="gvenzl/oracle-xe" DOCKER_OPTIONS='-e ORACLE_PASSWORD=oracle --shm-size=1g' DOCKER_VOLUME="/mnt/host" - - ORACLE_VERSION="12c-r1-se2-small" CONNECTION_STR='127.0.0.1:1521/ORCLCDB' - - ORACLE_VERSION="12c-r2-se2-small" CONNECTION_STR='127.0.0.1:1521/ORCLCDB' - - ORACLE_VERSION="18-slim" CONNECTION_STR='127.0.0.1:1521/XEPDB1' DOCKHER_HUB_REPO="gvenzl/oracle-xe" DOCKER_OPTIONS='-e ORACLE_PASSWORD=oracle' - - ORACLE_VERSION="18c-se2-small" CONNECTION_STR='127.0.0.1:1521/ORCLCDB' - - ORACLE_VERSION="19c-se2-small" CONNECTION_STR='127.0.0.1:1521/ORCLCDB' - - ORACLE_VERSION="21-full" CONNECTION_STR='127.0.0.1:1521/XEPDB1' DOCKHER_HUB_REPO="gvenzl/oracle-xe" DOCKER_OPTIONS='-e ORACLE_PASSWORD=oracle' - -cache: - pip: true - directories: - - $CACHE_DIR - - /home/travis/.sonar/cache - - node_modules - - $MAVEN_CFG - -before_install: - - #cache to be used between stages. Based on https://github.com/travis-ci/docs-travis-ci-com/issues/1329 - #delete all files in cache that are older than 5 days - - mkdir -p $CACHE_DIR/stages_cache; find $CACHE_DIR/stages_cache/ -mtime +5 -exec rm {} \; - #The update_project_version.sh is done before deployment to validate that the change of project files does not break installation - - bash .travis/update_project_version.sh - #Allow for sonar to blame issues - - git fetch --unshallow - # download latest utPLSQL release - - git clone --depth=1 --branch=${SELFTESTING_BRANCH:-main} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR - # download latest utPLSQL-cli release - - curl -Lk -o utPLSQL-cli.zip https://github.com/utPLSQL/utPLSQL-cli/releases/download/v${UTPLSQL_CLI_VERSION}/utPLSQL-cli.zip - -install: - - unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli -# - curl -Lk -o sqlcl-latest.zip https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-latest.zip -# - unzip -q sqlcl-latest.zip -d $HOME - - mkdir -p ${OJDBC_HOME} #get JDBC driver and orai18n - - curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar https://download.oracle.com/otn-pub/otn_software/jdbc/213/ojdbc8.jar - - curl -Lk -o ${OJDBC_HOME}/orai18n.jar https://download.oracle.com/otn-pub/otn_software/jdbc/213/orai18n.jar - # Chmod is needed to allow for write access within from docker container volume - - chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source} - - if [[ ! $TRAVIS_TAG ]]; then bash .travis/start_db.sh; fi - - if [[ ! $TRAVIS_TAG ]]; then docker exec ${ORACLE_VERSION} ${DOCKER_VOLUME}/.travis/install.sh; fi - - if [[ ! $TRAVIS_TAG ]]; then docker exec ${ORACLE_VERSION} ${DOCKER_VOLUME}/.travis/install_utplsql_release.sh; fi - -before_script: - - if [[ ! $TRAVIS_TAG ]]; then docker exec ${ORACLE_VERSION} ${DOCKER_VOLUME}/.travis/run_examples.sh; fi - - if [[ ! $TRAVIS_TAG ]]; then docker exec ${ORACLE_VERSION} ${DOCKER_VOLUME}/test/install_tests.sh; fi - -script: - - if [[ ! $TRAVIS_TAG ]]; then bash test/run_tests.sh; fi - - if [[ ! $TRAVIS_TAG ]]; then bash .travis/validate_report_files.sh; fi - - if [[ ! $TRAVIS_TAG ]] && [[ ("${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" && "${TRAVIS_PULL_REQUEST}" == false) || ("${TRAVIS_PULL_REQUEST_SLUG}" = "${UTPLSQL_REPO}") ]]; then bash .travis/run_sonar_scanner.sh; fi - - if [[ ! $TRAVIS_TAG ]]; then bash .travis/coveralls_uploader.sh; fi - -notifications: - slack: - rooms: - - secure: "nemt9n2y5sVCAKqa/s7JDQ8AcM59Xu/XbH/RkMOXvPgc+KtR8lBtVD1LkvJ5BaQhqgjuDT7DNt/uisQJ7k6a2OsrVFbnkypZ1hCvntOBpJyoSpD/YL1X8a9GbGojuJcph0BX76KN21LaOVdyOfY0TSlw53XiYWS8iL5HtjpWCbIwHL1SJ8JT8mhdT4hDoUWZjcZ4s4bLH6BQm4un/bMQOmB4sDoCeg4CllJwxgkswVF7OHpOFjgPetvUp7ps8b/Rj8en6zCj9drb0SVbXFgumo2Wd1bC3HHZB8MAZU0kuEV5VgUdum6EelUL5yfB72hssNQA0+CaT3HjBFkTlqWYJmjC4/xyGN3sseiW82T9FDY0g0GAGayNRW+QSiTQ1hbJEcAnNe0GrBUdRsgXdI6COd76YP5VxzRSF6H7niLfgCZdKbIivKUd1o+wBhuyJmqCFIkRWmT38tMGJqJAzbY1jq5gQXbb6E7gt+KdTjlSjcnJYf7XI7zqm+BRr+fbA0ixfXHvfqOBgZN6g08y9nPlDnIjtSF2NSdrj2zqYQAtKuWSOD1bnTyfDJyrtK7OLffZcMYD5Bcss4c8op8tP7MGTjt1S046SJocboh6H4c/nTokpoMRsWs6MKRdebl8C2RObGf5FebSOJg+oh2ZYS5Z/G9GshiY2BD/81+Hc4Miacc=" - on_success: change - on_failure: always - -jobs: - include: - - stage: deploy - env: ORACLE_VERSION="none" - before_install: skip - install: - - pip install mkdocs - before_script: skip - script: - - bash .travis/update_project_version.sh - - git config --global user.email "builds@travis-ci.com" - - git config --global user.name "${UTPLSQL_BUILD_USER_NAME}" - - git remote rm origin - - git remote add origin https://${github_api_token}@github.com/${UTPLSQL_REPO} - - if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi - - bash .travis/push_docs_to_github_io.sh - - bash .travis/build_docs.sh - - if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi - before_deploy: - - bash .travis/build_release_archive.sh - deploy: - provider: releases - api_key: $github_api_token - file: - - utPLSQL.zip - - utPLSQL.tar.gz - - utPLSQL.zip.md5 - - utPLSQL.tar.gz.md5 - skip_cleanup: true - on: - repo: ${UTPLSQL_REPO} - tags: true From b94a3f72dd398ba1c869d44f9cbfdc9980cc7265 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Sat, 15 Jan 2022 01:13:40 +0200 Subject: [PATCH 25/25] Addding `utPLSQL-java-api` repo to dispatch post-build. --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c72e5043..da5a51cda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,18 +153,22 @@ jobs: with: env-file: .github/variables/.env - uses: FranzDiebold/github-env-vars-action@v2 #https://github.com/marketplace/actions/github-environment-variables-action + - name: Set buid version number env variables id: set-build-version-number-vars run: .github/scripts/set_version_numbers_env.sh + - name: Update project version & build number in source code and documentation id: update-project-version run: .github/scripts/update_project_version.sh + - name: Push version update to repository id: push-version-number-update run: | git add sonar-project.properties VERSION source/* docs/* git commit -m 'Updated project version after build [skip ci]' git push --quiet origin HEAD:${CI_ACTION_REF_NAME} + - name: Copy and push documentation to utPLSQL-github-io repo id: push-documentation env: @@ -181,7 +185,7 @@ jobs: ( startsWith( github.ref, 'refs/heads/release/v' ) || github.ref == 'refs/heads/develop' ) strategy: matrix: - repo: ['utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project'] + repo: ['utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project','utPLSQL/utPLSQL-java-api'] # repo: ['utPLSQL/utPLSQL-java-api', 'utPLSQL/utPLSQL-v2-v3-migration', 'utPLSQL/utPLSQL-cli', 'utPLSQL/utPLSQL-maven-plugin', 'utPLSQL/utPLSQL-demo-project'] steps: - name: Repository Dispatch pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy