<commit_before>language: java

env:
  global:
    - MAVEN_OPTS="-Xmx512M -XX:+ExitOnOutOfMemoryError"
    - MAVEN_SKIP_CHECKS_AND_DOCS="-Dair.check.skip-all=true -Dmaven.javadoc.skip=true"
    - MAVEN_FAST_INSTALL="-DskipTests $MAVEN_SKIP_CHECKS_AND_DOCS -B -q -T C1"
    - ARTIFACTS_UPLOAD_PATH_BRANCH=travis_build_artifacts/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}
    - ARTIFACTS_UPLOAD_PATH_PR=travis_build_artifacts_pr/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}
    - TEST_FLAGS=""
    - PRODUCT_TESTS_CONFIG=config-empty

matrix:
  include:
    - env: MAVEN_CHECKS=true BUILD_PRESTO_DOCKER=true
    - env: WEBUI_CHECKS=true
    - env: TEST_SPECIFIC_MODULES=presto-main
    - env: TEST_SPECIFIC_MODULES=presto-tests
    # Product tests are long. Start them early to reduce overall build latency.
    - env: PRODUCT_TESTS_SUITE=suite-1
    - env: PRODUCT_TESTS_SUITE=suite-2
    - env: PRODUCT_TESTS_SUITE=suite-3
    # suite-4 does not exist
    - env: PRODUCT_TESTS_SUITE=suite-5
    - env: PRODUCT_TESTS_SUITE=suite-6-non-generic
    - env: PRODUCT_TESTS_SUITE=suite-7-non-generic
    - env: TEST_SPECIFIC_MODULES=presto-tests TEST_FLAGS="-P ci-only"
    - env: TEST_SPECIFIC_MODULES=presto-raptor-legacy
    - env: TEST_SPECIFIC_MODULES=presto-accumulo
    - env: TEST_SPECIFIC_MODULES=presto-cassandra
    - env: TEST_SPECIFIC_MODULES=presto-hive,presto-orc,presto-parquet
    - env: TEST_SPECIFIC_MODULES=presto-mongodb,presto-kafka,presto-elasticsearch
    - env: TEST_SPECIFIC_MODULES=presto-redis
    - env: TEST_SPECIFIC_MODULES=presto-sqlserver,presto-postgresql,presto-mysql
    - env: TEST_SPECIFIC_MODULES=presto-phoenix,presto-iceberg
    - env: TEST_OTHER_MODULES=!presto-main,!presto-tests,!presto-raptor-legacy,!presto-accumulo,!presto-cassandra,!presto-hive,!presto-orc,!presto-parquet,!presto-mongodb,!presto-kafka,!presto-elasticsearch,!presto-redis,!presto-sqlserver,!presto-postgresql,!presto-mysql,!presto-phoenix,!presto-iceberg,!presto-kudu,!presto-docs,!presto-server,!presto-server-rpm
    - env: HIVE_TESTS=true
    - env: KUDU_TESTS=true

    # HDP 3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-1 PRODUCT_TESTS_CONFIG=config-hdp3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-2 PRODUCT_TESTS_CONFIG=config-hdp3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-3 PRODUCT_TESTS_CONFIG=config-hdp3
    # suite-4 does not exist
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-5 PRODUCT_TESTS_CONFIG=config-hdp3
# TODO
#    - if: type != pull_request
#      env: HIVE_TESTS=true PRODUCT_TESTS_CONFIG=config-hdp3

dist: xenial
jdk: openjdk8

cache:
  yarn: true
  directories:
    - $HOME/.m2/repository

git:
  quiet: true

install:
  - rm -f ~/.m2/settings.xml
  - travis_retry ./mvnw -v
  - |
    if [[ -v TEST_SPECIFIC_MODULES ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl "${TEST_SPECIFIC_MODULES}" -am
    fi
  - |
    if [[ -v TEST_OTHER_MODULES ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl '!presto-docs,!presto-server,!presto-server-rpm'
    fi
  - |
    if [[ -v PRODUCT_TESTS_SUITE ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl '!presto-docs,!presto-server-rpm'
    fi
  - |
    if [[ -v HIVE_TESTS ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl presto-hive-hadoop2 -am
    fi
  - |
    if [[ -v KUDU_TESTS ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl presto-kudu -am
    fi

before_script:
  - |
    export ARTIFACTS_UPLOAD_PATH=${ARTIFACTS_UPLOAD_PATH_BRANCH}
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
      export ARTIFACTS_UPLOAD_PATH="${ARTIFACTS_UPLOAD_PATH_PR}"
    fi

# *** WARNING ***
#
# A single script block must include exactly ONE command.
# Travis runs a script block without the `-e` flag. Any failures in the middle are simply ignored.
#
# Specifying the `-e` flag manually is not recommended.
# It will stop the execution after the very first failure.
# Travis runs the remaining blocks even if one of the scripts returns a non zero status.
# Non zero status is propagated at the end of the build.
script:
  - |
    if [[ -v MAVEN_CHECKS ]]; then
      ./mvnw install -DskipTests -B -T C1 -P ci -pl '!presto-server-rpm'
      ./mvnw install -B -P ci -pl presto-server-rpm
    fi
  - |
    if [[ -v BUILD_PRESTO_DOCKER ]]; then
      docker/build-local.sh
    fi
  - |
    if [[ -v WEBUI_CHECKS ]]; then
      presto-main/bin/check_webui.sh
    fi
  - |
    if [[ -v TEST_SPECIFIC_MODULES ]]; then
      ./mvnw test $MAVEN_SKIP_CHECKS_AND_DOCS -B -pl "${TEST_SPECIFIC_MODULES}" $TEST_FLAGS
    fi
  - |
    if [[ -v TEST_OTHER_MODULES ]]; then<commit_msg>Respect exit code from Maven checks<commit_after>language: java

env:
  global:
    - MAVEN_OPTS="-Xmx512M -XX:+ExitOnOutOfMemoryError"
    - MAVEN_SKIP_CHECKS_AND_DOCS="-Dair.check.skip-all=true -Dmaven.javadoc.skip=true"
    - MAVEN_FAST_INSTALL="-DskipTests $MAVEN_SKIP_CHECKS_AND_DOCS -B -q -T C1"
    - ARTIFACTS_UPLOAD_PATH_BRANCH=travis_build_artifacts/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}
    - ARTIFACTS_UPLOAD_PATH_PR=travis_build_artifacts_pr/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}
    - TEST_FLAGS=""
    - PRODUCT_TESTS_CONFIG=config-empty

matrix:
  include:
    - env: MAVEN_CHECKS=true BUILD_PRESTO_DOCKER=true
    - env: WEBUI_CHECKS=true
    - env: TEST_SPECIFIC_MODULES=presto-main
    - env: TEST_SPECIFIC_MODULES=presto-tests
    # Product tests are long. Start them early to reduce overall build latency.
    - env: PRODUCT_TESTS_SUITE=suite-1
    - env: PRODUCT_TESTS_SUITE=suite-2
    - env: PRODUCT_TESTS_SUITE=suite-3
    # suite-4 does not exist
    - env: PRODUCT_TESTS_SUITE=suite-5
    - env: PRODUCT_TESTS_SUITE=suite-6-non-generic
    - env: PRODUCT_TESTS_SUITE=suite-7-non-generic
    - env: TEST_SPECIFIC_MODULES=presto-tests TEST_FLAGS="-P ci-only"
    - env: TEST_SPECIFIC_MODULES=presto-raptor-legacy
    - env: TEST_SPECIFIC_MODULES=presto-accumulo
    - env: TEST_SPECIFIC_MODULES=presto-cassandra
    - env: TEST_SPECIFIC_MODULES=presto-hive,presto-orc,presto-parquet
    - env: TEST_SPECIFIC_MODULES=presto-mongodb,presto-kafka,presto-elasticsearch
    - env: TEST_SPECIFIC_MODULES=presto-redis
    - env: TEST_SPECIFIC_MODULES=presto-sqlserver,presto-postgresql,presto-mysql
    - env: TEST_SPECIFIC_MODULES=presto-phoenix,presto-iceberg
    - env: TEST_OTHER_MODULES=!presto-main,!presto-tests,!presto-raptor-legacy,!presto-accumulo,!presto-cassandra,!presto-hive,!presto-orc,!presto-parquet,!presto-mongodb,!presto-kafka,!presto-elasticsearch,!presto-redis,!presto-sqlserver,!presto-postgresql,!presto-mysql,!presto-phoenix,!presto-iceberg,!presto-kudu,!presto-docs,!presto-server,!presto-server-rpm
    - env: HIVE_TESTS=true
    - env: KUDU_TESTS=true

    # HDP 3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-1 PRODUCT_TESTS_CONFIG=config-hdp3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-2 PRODUCT_TESTS_CONFIG=config-hdp3
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-3 PRODUCT_TESTS_CONFIG=config-hdp3
    # suite-4 does not exist
    - if: type != pull_request
      env: PRODUCT_TESTS_SUITE=suite-5 PRODUCT_TESTS_CONFIG=config-hdp3
# TODO
#    - if: type != pull_request
#      env: HIVE_TESTS=true PRODUCT_TESTS_CONFIG=config-hdp3

dist: xenial
jdk: openjdk8

cache:
  yarn: true
  directories:
    - $HOME/.m2/repository

git:
  quiet: true

install:
  - rm -f ~/.m2/settings.xml
  - travis_retry ./mvnw -v
  - |
    if [[ -v TEST_SPECIFIC_MODULES ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl "${TEST_SPECIFIC_MODULES}" -am
    fi
  - |
    if [[ -v TEST_OTHER_MODULES ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl '!presto-docs,!presto-server,!presto-server-rpm'
    fi
  - |
    if [[ -v PRODUCT_TESTS_SUITE ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl '!presto-docs,!presto-server-rpm'
    fi
  - |
    if [[ -v HIVE_TESTS ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl presto-hive-hadoop2 -am
    fi
  - |
    if [[ -v KUDU_TESTS ]]; then
      ./mvnw install $MAVEN_FAST_INSTALL -pl presto-kudu -am
    fi

before_script:
  - |
    export ARTIFACTS_UPLOAD_PATH=${ARTIFACTS_UPLOAD_PATH_BRANCH}
    if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
      export ARTIFACTS_UPLOAD_PATH="${ARTIFACTS_UPLOAD_PATH_PR}"
    fi

# *** WARNING ***
#
# A single script block must include exactly ONE command.
# Travis runs a script block without the `-e` flag. Any failures in the middle are simply ignored.
#
# Specifying the `-e` flag manually is not recommended.
# It will stop the execution after the very first failure.
# Travis runs the remaining blocks even if one of the scripts returns a non zero status.
# Non zero status is propagated at the end of the build.
script:
  - |
    if [[ -v MAVEN_CHECKS ]]; then
      ./mvnw install -DskipTests -B -T C1 -P ci -pl '!presto-server-rpm' &&
      ./mvnw install -B -P ci -pl presto-server-rpm &&
      true
    fi
  - |
    if [[ -v BUILD_PRESTO_DOCKER ]]; then
      docker/build-local.sh
    fi
  - |
    if [[ -v WEBUI_CHECKS ]]; then
      presto-main/bin/check_webui.sh
    fi
  - |
    if [[ -v TEST_SPECIFIC_MODULES ]]; then
      ./mvnw test $MAVEN_SKIP_CHECKS_AND_DOCS -B -pl "${TEST_SPECIFIC_MODULES}" $TEST_FLAGS
    fi
  - |
    if [[ -v TEST_OTHER_MODULES ]]; then
{'fraction_non_alphanumeric': 0.11589580010632643, 'fraction_numerical': 0.005741626794258373, 'mean_word_length': 3.5242905242905245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3768012', 'n_tokens_mistral': 3825, 'n_tokens_neox': 3852, 'n_words': 655}