<commit_before>sudo: required
language: python

addons:
  apt:
    packages:
      - unzip
      # Java8 Required for Sonar and SQLCL
      - oracle-java8-installer
      - oracle-java8-set-default
  sonarcloud:
    organization: utplsql
    token:
      secure: ${SONAR_TOKEN}
    branches:
      - develop
      - master

services:
  - docker

env:
  global:
    - UT3_OWNER=ut3
    - UT3_OWNER_PASSWORD=<PASSWORD>
    - UT3_RELEASE_VERSION_SCHEMA=UT3_LATEST_RELEASE
    - UT3_USER="UT3\$USER#"
    - UT3_USER_PASSWORD=<PASSWORD>
    - UT3_TESTER=ut3_tester
    - UT3_TESTER_PASSWORD=<PASSWORD>
    - UT3_TABLESPACE=users
    # Environment for building a release
    - CURRENT_BRANCH=${TRAVIS_BRANCH}
    - UTPLSQL_REPO="utPLSQL/utPLSQL"
    - UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}"
    - UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*"
    - 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="$HOME/sqlcl/bin/sql"
    - ORACLE_PWD="<PASSWORD>"
    - UT3_DOCKER_REPO="utplsqlv3/oracledb"
    - DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}"
    #utPLSQL released version directory
    - UTPLSQL_DIR="utPLSQL_latest_release"
    - SELFTESTING_BRANCH=${TRAVIS_BRANCH}
    - UTPLSQL_CLI_VERSION="3.1.0"
    # Maven
    - MAVEN_HOME=/usr/local/maven
    - MAVEN_CFG=$HOME/.m2
  matrix:
    - ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}"   CONNECTION_STR='127.0.0.1:1521/XE'       DOCKER_OPTIONS='--shm-size=1g'
    - ORACLE_VERSION="${DOCKER_TAG_12C:-12c-r1-se2}"  CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
    - ORACLE_VERSION="${DOCKER_TAG_12C2:-12c-r2-se2}" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"

cache:
  pip: true
  directories:
    - $CACHE_DIR
    - node_modules
    - $MAVEN_CFG

before_install:
  #The update_project_version is done before deployment to validate that the change of project files does not break installation
  - bash .travis/update_project_version.sh
  - git config --global user.email "<EMAIL>"
  - 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}
  # download latest utPLSQL release
  #- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')
  - git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} 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.zip
  - unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli
  # Get ojdbc via maven
  - bash .travis/maven_cfg.sh
  - bash .travis/install_sqlcl.sh
  - sudo mkdir -p /dev/pdbs
  - sudo chmod -R 777 /dev/pdbs
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/start_db.sh; fi
  - df -h

before_script:
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/install.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/install_utplsql_release.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/create_additional_grants_for_old_tests.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/run_examples.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/run_old_tests.sh; fi

script:
  - if [[ ! $TRAVIS_TAG ]]; then bash test/install_and_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" ]; then sonar-scanner; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/coveralls_uploader.sh; fi

notifications:
  slack:
    rooms:
      - secure: "<KEY>
    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: 
#        - if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash trigger-travis.sh $TRAVIS_ACCESS_TOKEN; fi
        - bash .travis/trigger-travis.sh $TRAVIS_ACCESS_TOKEN #testing triggering
        - if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi
        - bash .travis/build_docs.sh
        - bash .travis/push_docs_to_gh_pages.sh
      before_deploy:
        - bash .travis/build_release_archive.sh<commit_msg>Fixing `travis.yml` config<commit_after>sudo: required
language: python

addons:
  apt:
    packages:
      - unzip
      # Java8 Required for Sonar and SQLCL
      - oracle-java8-installer
      - oracle-java8-set-default
  sonarcloud:
    organization: utplsql
    token:
      secure: ${SONAR_TOKEN}
    branches:
      - develop
      - master

services:
  - docker

env:
  global:
    - UT3_OWNER=ut3
    - UT3_OWNER_PASSWORD=<PASSWORD>
    - UT3_RELEASE_VERSION_SCHEMA=UT3_LATEST_RELEASE
    - UT3_USER="UT3\$USER#"
    - UT3_USER_PASSWORD=<PASSWORD>
    - UT3_TESTER=ut3_tester
    - UT3_TESTER_PASSWORD=<PASSWORD>
    - UT3_TABLESPACE=users
    # Environment for building a release
    - CURRENT_BRANCH=${TRAVIS_BRANCH}
    - UTPLSQL_REPO="utPLSQL/utPLSQL"
    - UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}"
    - UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*"
    - 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="$HOME/sqlcl/bin/sql"
    - ORACLE_PWD="<PASSWORD>"
    - UT3_DOCKER_REPO="utplsqlv3/oracledb"
    - DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}"
    #utPLSQL released version directory
    - UTPLSQL_DIR="utPLSQL_latest_release"
    - SELFTESTING_BRANCH=${TRAVIS_BRANCH}
    - UTPLSQL_CLI_VERSION="3.1.0"
    # Maven
    - MAVEN_HOME=/usr/local/maven
    - MAVEN_CFG=$HOME/.m2
  matrix:
    - ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}"   CONNECTION_STR='127.0.0.1:1521/XE'       DOCKER_OPTIONS='--shm-size=1g'
    - ORACLE_VERSION="${DOCKER_TAG_12C:-12c-r1-se2}"  CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
    - ORACLE_VERSION="${DOCKER_TAG_12C2:-12c-r2-se2}" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"

cache:
  pip: true
  directories:
    - $CACHE_DIR
    - node_modules
    - $MAVEN_CFG

before_install:
  #The update_project_version is done before deployment to validate that the change of project files does not break installation
  - bash .travis/update_project_version.sh
  - git config --global user.email "<EMAIL>"
  - 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}
  # download latest utPLSQL release
  #- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')
  - git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} 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.zip
  - unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli
  # Get ojdbc via maven
  - bash .travis/maven_cfg.sh
  - bash .travis/install_sqlcl.sh
  - sudo mkdir -p /dev/pdbs
  - sudo chmod -R 777 /dev/pdbs
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/start_db.sh; fi
  - df -h

before_script:
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/install.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/install_utplsql_release.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/create_additional_grants_for_old_tests.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/run_examples.sh; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/run_old_tests.sh; fi

script:
  - if [[ ! $TRAVIS_TAG ]]; then bash test/install_and_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" ]; then sonar-scanner; fi
  - if [[ ! $TRAVIS_TAG ]]; then bash .travis/coveralls_uploader.sh; fi

notifications:
  slack:
    rooms:
      - secure: "nem<PASSWORD>y5sVCAKqa/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: 
#        - if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi
        - bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN #testing triggering
        - if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi
        - bash .travis/build_docs.sh
        - bash .travis/push_docs_to_gh_pages.sh
      before_deploy:
        - bash .travis/build_release_archive.sh
{'fraction_non_alphanumeric': 0.13185622845888725, 'fraction_numerical': 0.027375677006400787, 'mean_word_length': 3.5278644672313866, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5764160', 'n_tokens_mistral': 4469, 'n_tokens_neox': 4284, 'n_words': 613}