<commit_before># We deliberately don't use travis's language=python option because
# we install miniconda and use conda to get python. Additionally,
# Travis's auto-install of python doesn't work on osx images (see
# https://github.com/travis-ci/travis-ci/issues/4729).
language: generic
sudo: false
os:
  - linux

cache:
  timeout: 300
  directories:
    - $HOME/miniconda

before_cache:
  - rm -rf $HOME/miniconda/pkgs
  - rm -rf $HOME/miniconda/conda-bld
  - rm -rf $HOME/miniconda/envs/*/conda-bld

notifications:
  email:
    on_failure: change # [always|never|change] default: always

env:
  global:
    - PYENV_VERSION=3.6
    - PKG_TEST_PYTHON="--test-python=py36 --test-python=py27"
    - CHANS_DEV="-c pyviz/label/dev -c conda-forge"
    - CHANS="-c pyviz"
    - MPLBACKEND="Agg"

stages:
  - test
  - name: extra_tests
    if: type = cron
  - name: conda_dev_package
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: pip_dev_package
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: conda_package
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: pip_package
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: docs_dev
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: docs_daily
    if: type = cron

jobs:
  include:
    ########## Test Stage ##########

    - &default
      stage: test
      env: DESC="Python 3.6 tests" HV_REQUIREMENTS="unit_tests"
      before_install:
        - pip install pyctdev && doit miniconda_install && pip uninstall -y doit pyctdev
        - export PATH="$HOME/miniconda/bin:$PATH" && hash -r
        - conda config --set always_yes True
        - conda install -c pyviz "pyctdev>=0.5" && doit ecosystem_setup
      install:
        - doit env_create $CHANS_DEV --python=$PYENV_VERSION
        - source activate test-environment
        - doit develop_install $CHANS_DEV -o $HV_REQUIREMENTS
        - doit env_capture
      script:
        - doit test_all_recommended
      after_success: coveralls
      after_failure: sleep 10

    - <<: *default
      env: DESC="Python 2.7 tests" PYENV_VERSION=2.7 HV_REQUIREMENTS="unit_tests"

    - &regression_test
      <<: *default
      env: DESC="Python 3.6 regression tests" HV_REQUIREMENTS="nbtests"
      before_script:
        - if [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then
            echo "Attempting to find any associated pull request";
            CURRENT_BUILD=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds?number=$TRAVIS_BUILD_NUMBER");
            NEXT_BUILD=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds?number=$((TRAVIS_BUILD_NUMBER + 1))");
            MSG1=$(echo $CURRENT_BUILD | jq '.[].message' );
            MSG2=$(echo $NEXT_BUILD | jq '.[].message' );
            if [ "$MSG1" == "$MSG2" ] ; then
              BUILD_ID=$(echo $NEXT_BUILD | jq .[].id);
              TRAVIS_PULL_REQUEST=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds/$BUILD_ID" | jq .compare_url | cut -d '/' -f7 | cut -d \" -f1);
              echo "Associated pull request found - PR $TRAVIS_PULL_REQUEST";
            fi
          fi
        - REF_DATA_BRANCH=${TRAVIS_PULL_REQUEST//false/reference_data}
        - git clone https://github.com/ioam/holoviews-data.git -b reference_data ./doc/reference_data
        - pushd ./doc/reference_data
        - echo "Attempting to checkout $REF_DATA_BRANCH branch"
        - if [ $(git branch -a --list *origin/$REF_DATA_BRANCH | wc -l) -eq 1 ] ; then
            git checkout origin/$REF_DATA_BRANCH;
          else
            echo "Using the master branch reference data";
          fi
        - popd
        - export HOLOVIEWSRC=`pwd`'/holoviews.rc'
        - echo 'import holoviews as hv;hv.config(style_17=True);hv.config.warn_options_call=True' > holoviews.rc
        - pushd ./doc/nbpublisher
      script:
        - QT_QPA_PLATFORM='offscreen' BOKEH_DEV=True python ./test_notebooks.py
      after_script:
        - python ./doc/nbpublisher/concat_html.py ./doc/test_data ./doc/test_html
        - if [ "$TRAVIS_BRANCH" == 'master' ]; then
            cd doc/test_data;
            zip -r test_data.zip *;
            aws s3 cp --region eu-west-1 ./test_data.zip "s3://preview.holoviews.org/$TRAVIS_BUILD_NUMBER/test_data_py${PYENV_VERSION:0:1}.zip";
            cd -;
          fi
        - aws s3 cp --recursive --region eu-west-1 ./doc/test_html "s3://travis.holoviews.org/build_$TRAVIS_BUILD_NUMBER"
        - curl -s -X GET "https://kq5y73i0xe.execute-api.eu-west-1.amazonaws.com/dev/travis-holoviews-index"
        - echo insecure >> ~/.curlrc
        - if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then
            curl -X POST -d "$TRAVIS_BUILD_NUMBER" "https://kq5y73i0xe.execute-api.eu-west-1.amazonaws.com/dev/pr-status";
          fi
      after_success:
        - popd
        - mv doc/Tutorials/.coverage ./.coverage
        - coveralls
      after_failure:
        - popd
        - sleep 10

    - <<: *regression_test
      env: DESC="Python 2.7 regression tests" PYENV_VERSION=2.7 HV_REQUIREMENTS="nbtests"

    - &basic_deps
      <<: *default
      stage: extra_tests
      env: DESC="Basic dependencies" HV_REQUIREMENTS="basic_tests"
      after_success: echo "Success"

    ########## DOCS ##########

    - &doc_build
      <<: *default
      stage: docs_dev
      env: DESC="docs" CHANS_DEV="-c pyviz/label/dev" HV_DOC_HTML='true' HV_DOC_GALLERY='false' HV_REQUIREMENTS="doc"
      script:
        - bokeh sampledata
        - nbsite generate-rst --org pyviz --project-name holoviews --offset 0 --skip ^reference
        - nbsite build --what=html --output=builtdocs
      deploy:
        provider: s3
        local_dir: ./builtdocs
        skip_cleanup: true
        access_key_id: $AWS_ACCESS_KEY_ID
        secret_access_key: $AWS_SECRET_ACCESS_KEY
        region: eu-west-1
        bucket: "dev.holoviews.org"

    - <<: *doc_build
      stage: docs_daily
      deploy:
        provider: s3
        local_dir: ./builtdocs
        skip_cleanup: true
        access_key_id: $AWS_ACCESS_KEY_ID
        secret_access_key: $AWS_SECRET_ACCESS_KEY
        region: eu-west-1
        bucket: "build.holoviews.org"

    ########## END-USER PACKAGES ##########

    ### CONDA ####

    - &conda_pkg
      <<: *default<commit_msg>Build gallery on travis (#3507)<commit_after># We deliberately don't use travis's language=python option because
# we install miniconda and use conda to get python. Additionally,
# Travis's auto-install of python doesn't work on osx images (see
# https://github.com/travis-ci/travis-ci/issues/4729).
language: generic
sudo: false
os:
  - linux

cache:
  timeout: 300
  directories:
    - $HOME/miniconda

before_cache:
  - rm -rf $HOME/miniconda/pkgs
  - rm -rf $HOME/miniconda/conda-bld
  - rm -rf $HOME/miniconda/envs/*/conda-bld

notifications:
  email:
    on_failure: change # [always|never|change] default: always

env:
  global:
    - PYENV_VERSION=3.6
    - PKG_TEST_PYTHON="--test-python=py36 --test-python=py27"
    - CHANS_DEV="-c pyviz/label/dev -c conda-forge"
    - CHANS="-c pyviz"
    - MPLBACKEND="Agg"

stages:
  - test
  - name: extra_tests
    if: type = cron
  - name: conda_dev_package
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: pip_dev_package
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: conda_package
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: pip_package
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: docs
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: gallery
    if: tag =~ ^v(\d+|\.)*[^a-z]\d*$
  - name: docs_dev
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: gallery_dev
    if: tag =~ ^v(\d+|\.)*[a-z]\d*$
  - name: docs_daily
    if: type = cron
  - name: gallery_daily
    if: type = cron

jobs:
  include:
    ########## Test Stage ##########

    - &default
      stage: test
      env: DESC="Python 3.6 tests" HV_REQUIREMENTS="unit_tests"
      before_install:
        - pip install pyctdev && doit miniconda_install && pip uninstall -y doit pyctdev
        - export PATH="$HOME/miniconda/bin:$PATH" && hash -r
        - conda config --set always_yes True
        - conda install -c pyviz "pyctdev>=0.5" && doit ecosystem_setup
      install:
        - doit env_create $CHANS_DEV --python=$PYENV_VERSION
        - source activate test-environment
        - doit develop_install $CHANS_DEV -o $HV_REQUIREMENTS
        - doit env_capture
      script:
        - doit test_all_recommended
      after_success: coveralls
      after_failure: sleep 10

    - <<: *default
      env: DESC="Python 2.7 tests" PYENV_VERSION=2.7 HV_REQUIREMENTS="unit_tests"

    - &regression_test
      <<: *default
      env: DESC="Python 3.6 regression tests" HV_REQUIREMENTS="nbtests"
      before_script:
        - if [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then
            echo "Attempting to find any associated pull request";
            CURRENT_BUILD=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds?number=$TRAVIS_BUILD_NUMBER");
            NEXT_BUILD=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds?number=$((TRAVIS_BUILD_NUMBER + 1))");
            MSG1=$(echo $CURRENT_BUILD | jq '.[].message' );
            MSG2=$(echo $NEXT_BUILD | jq '.[].message' );
            if [ "$MSG1" == "$MSG2" ] ; then
              BUILD_ID=$(echo $NEXT_BUILD | jq .[].id);
              TRAVIS_PULL_REQUEST=$(curl -s -X GET "https://api.travis-ci.org/repos/pyviz/holoviews/builds/$BUILD_ID" | jq .compare_url | cut -d '/' -f7 | cut -d \" -f1);
              echo "Associated pull request found - PR $TRAVIS_PULL_REQUEST";
            fi
          fi
        - REF_DATA_BRANCH=${TRAVIS_PULL_REQUEST//false/reference_data}
        - git clone https://github.com/ioam/holoviews-data.git -b reference_data ./doc/reference_data
        - pushd ./doc/reference_data
        - echo "Attempting to checkout $REF_DATA_BRANCH branch"
        - if [ $(git branch -a --list *origin/$REF_DATA_BRANCH | wc -l) -eq 1 ] ; then
            git checkout origin/$REF_DATA_BRANCH;
          else
            echo "Using the master branch reference data";
          fi
        - popd
        - export HOLOVIEWSRC=`pwd`'/holoviews.rc'
        - echo 'import holoviews as hv;hv.config(style_17=True);hv.config.warn_options_call=True' > holoviews.rc
        - pushd ./doc/nbpublisher
      script:
        - QT_QPA_PLATFORM='offscreen' BOKEH_DEV=True python ./test_notebooks.py
      after_script:
        - python ./doc/nbpublisher/concat_html.py ./doc/test_data ./doc/test_html
        - if [ "$TRAVIS_BRANCH" == 'master' ]; then
            cd doc/test_data;
            zip -r test_data.zip *;
            aws s3 cp --region eu-west-1 ./test_data.zip "s3://preview.holoviews.org/$TRAVIS_BUILD_NUMBER/test_data_py${PYENV_VERSION:0:1}.zip";
            cd -;
          fi
        - aws s3 cp --recursive --region eu-west-1 ./doc/test_html "s3://travis.holoviews.org/build_$TRAVIS_BUILD_NUMBER"
        - curl -s -X GET "https://kq5y73i0xe.execute-api.eu-west-1.amazonaws.com/dev/travis-holoviews-index"
        - echo insecure >> ~/.curlrc
        - if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then
            curl -X POST -d "$TRAVIS_BUILD_NUMBER" "https://kq5y73i0xe.execute-api.eu-west-1.amazonaws.com/dev/pr-status";
          fi
      after_success:
        - popd
        - mv doc/Tutorials/.coverage ./.coverage
        - coveralls
      after_failure:
        - popd
        - sleep 10

    - <<: *regression_test
      env: DESC="Python 2.7 regression tests" PYENV_VERSION=2.7 HV_REQUIREMENTS="nbtests"

    - &basic_deps
      <<: *default
      stage: extra_tests
      env: DESC="Basic dependencies" HV_REQUIREMENTS="basic_tests"
      after_success: echo "Success"

    ########## DOCS ##########

    - &doc_build
      <<: *default
      stage: docs_dev
      env: DESC="docs" CHANS_DEV="-c pyviz/label/dev" HV_DOC_HTML='true' HV_DOC_GALLERY='false' HV_REQUIREMENTS="doc"
      script:
        - bokeh sampledata
        - nbsite generate-rst --org pyviz --project-name holoviews --skip ^reference
        - nbsite build --what=html --output=builtdocs
      after_success:
        - pip install awscli
        - aws s3 sync ./ s3://holoviews-doc-builds/$TRAVIS_BUILD_NUMBER --exclude ".git/*"

    - &gallery_build
      <<: *doc_build
      stage: gallery_dev
      env: DESC="gallery" CHANS_DEV="-c pyviz/label/dev" HV_DOC_HTML='true' HV_DOC_GALLERY='true' HV_REQUIREMENTS="doc" BUCKET="dev."
      script:
        - bokeh sampledata
        - pip install awscli
        - conda install -c conda-forge mpl_sample_data --no-deps
        - aws s3 sync s3://holoviews-doc-builds/$TRAVIS_BUILD_NUMBER ./
        - nbsite build --what=html --output=builtdocs
      after_success:
        - aws s3 sync ./builtdocs s3://${BUCKET}holoviews.org/$TRAVIS_BUILD_NUMBER
        - aws s3 rm --recursive s3://holoviews-doc-builds/$TRAVIS_BUILD_NUMBER

    - <<: *doc_build
      stage: docs_daily

    - <<: *gallery_build
      stage: gallery_daily
      env: DESC="gallery" CHANS_DEV="-c pyviz/label/dev" HV_DOC_HTML='true' HV_DOC_GALLERY='true' HV_REQUIREMENTS="doc" BUCKET="build."

    - <<: *doc_build
      stage: docs

    - <<: *gallery_build
      stage: gallery
      env: DESC="gallery" CHANS_DEV="-c pyviz/label/dev" HV_DOC_HTML='true' HV_DOC_GALLERY='true' HV_REQUIREMENTS="doc" BUCKET=""

    ########## END-USER PACKAGES ##########

    ### CONDA ####

    - &conda_pkg
      <<: *default
{'fraction_non_alphanumeric': 0.1464106969447972, 'fraction_numerical': 0.010084410248748786, 'mean_word_length': 2.3748424502142678, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 11, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '42932', 'n_tokens_mistral': 5043, 'n_tokens_neox': 4812, 'n_words': 961}