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 68% rename from .travis/get_project_version.sh rename to .github/scripts/get_project_version.sh index 20a658ed9..60fc0a796 100755 --- a/.travis/get_project_version.sh +++ b/.github/scripts/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/.github/scripts/install.sh similarity index 98% rename from .travis/install.sh rename to .github/scripts/install.sh index 603cb7d1e..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 @@ -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/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 "# 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 ${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'" - [${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 +#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} + diff --git a/.github/scripts/push_project_version.sh b/.github/scripts/push_project_version.sh new file mode 100755 index 000000000..1b38e6c24 --- /dev/null +++ b/.github/scripts/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/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 +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=${CI_ACTION_REF_NAME}" >> $GITHUB_ENV diff --git a/.travis/update_project_version.sh b/.github/scripts/update_project_version.sh similarity index 77% rename from .travis/update_project_version.sh rename to .github/scripts/update_project_version.sh index c4540eef8..586cb5b64 100755 --- a/.travis/update_project_version.sh +++ b/.github/scripts/update_project_version.sh @@ -2,10 +2,10 @@ 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 ${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 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 7c7d1354d..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="$BUILD_DIR/.travis/xsd" -XML_JAR_DIR="$BUILD_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/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 new file mode 100644 index 000000000..da5a51cda --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,210 @@ +name: Build, test, deploy documentation +on: + push: + branches-ignore: [ main ] + pull_request: + branches: [ develop ] + + workflow_dispatch: + +concurrency: ${{github.ref}} +defaults: + run: + shell: bash + +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' ) + 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 ] + 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' ) + strategy: + matrix: + 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 + 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, publish, dispatch ] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + 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 new file mode 100644 index 000000000..ad1e782c5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,98 @@ +name: Create and publish release artifacts +on: + release: + 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: + run: + shell: bash + +jobs: + + publish: + name: Deploy documentation + concurrency: publish + runs-on: ubuntu-latest + + 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 + 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: Update project version & build number in source code and documentation + 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: .github/scripts/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: .github/scripts/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, upload_artifacts ] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cd1e8efe0..000000000 --- a/.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 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 - diff --git a/.travis/coveralls_uploader.js b/.travis/coveralls_uploader.js deleted file mode 100644 index 182f84066..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 = 'travis-ci'; - 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/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/push_docs_to_github_io.sh b/.travis/push_docs_to_github_io.sh deleted file mode 100755 index 5c3fcd672..000000000 --- a/.travis/push_docs_to_github_io.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -# Based on `push_docs_to_gh_pages.sh` -# Significant alterations -# - Support for multiple copies of documentation, -# - only clearing out develop -# - index.md logging doc history - -# How to run: -# - From repository root .travis/push_docs_to_gh_pages.sh - -# Required files / directories (relative from repo root) -# - File: "docs/index.md" with that contains develop docs - -# Required ENV Variables -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. - - # 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` - - # 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} . - - 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 . - - #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} -fi - 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/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 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/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 e56aba1d4..b3a12d5d6 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. @@ -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 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