<commit_before>language: python

python:
  - "2.7"

env:
  - LIBTIFF_VERSION=4.0.3 OPENJPEG_VERSION=2.1   OPENJPEG_FILE=version.2.1.tar.gz OPENJPEG_DIR="openjpeg-version.2.1"
  - LIBTIFF_VERSION=4.0.6 OPENJPEG_VERSION=2.1.2 OPENJPEG_FILE=v2.1.2.tar.gz      OPENJPEG_DIR="openjpeg-2.1.2" BUILD_VIPS="yes"

cache:
  directories:
    - $HOME/.cache
    - $HOME/build/libs
    - $HOME/build/girder_testing_build/store
    - $HOME/build/girder_testing_build/data

# sudo: false
sudo: required

dist: trusty

compiler:
  - gcc

addons:
  apt:
    packages:
      # Pillow dependencies (see
      # https://pillow.readthedocs.org/en/latest/installation.html)
      - libtiff5-dev
      - libjpeg8-dev
      - zlib1g-dev
      - libfreetype6-dev
      - liblcms2-dev
      - libwebp-dev
      - tcl8.6-dev
      - tk8.6-dev
      - python-tk
      # openjpeg
      - libglib2.0-dev
      - libjpeg-dev
      - libxml2-dev
      - libpng12-dev
      # openslide
      - autoconf
      - automake
      - libtool
      - pkg-config
      - libcairo2-dev
      - libgdk-pixbuf2.0-dev
      - libxml2-dev
      - libsqlite3-dev
      # install vips
      - libvips-tools
      # for building vips
      - build-essential
      - gobject-introspection
      - libcfitsio3-dev
      - libexif-dev
      - libfftw3-dev
      - libgif-dev
      - libgirepository1.0-dev
      - libglib2.0-dev
      - libgsf-1-dev
      - libjpeg-turbo8-dev
      - libmagick++-dev
      - libmatio-dev
      - liborc-0.4-dev
      - libpango1.0-dev
      - libxml2-dev
      - pkg-config
      - python-gi-dev
      # girder worker - not needed; included in travis
      # - rabbitmq-server

services:
  - rabbitmq

before_install:
  - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "3" ]; then export PY3="true"; else export PY2="true"; fi
  - if [ -n "${PY3}" ]; then export MONGO_VERSION=3.0.7; export PY_COVG="OFF"; else export MONGO_VERSION=2.6.11; export PY_COVG="ON"; export DEPLOY=true; fi
  - GIRDER_VERSION=master
  - GIRDER_WORKER_VERSION=master
  - main_path=$PWD
  - build_path=$PWD/build
  - mkdir -p $build_path
  - lib_build_path=$HOME/build/libs
  - mkdir -p $lib_build_path

  - nvm install v5
  - npm install -g npm

  - girder_path=$build_path/girder
  - rm -fr $girder_path
  - git clone https://github.com/girder/girder.git $girder_path && git -C $girder_path checkout $GIRDER_VERSION
  - ln -sf $main_path $girder_path/plugins/
  - ls -l $girder_path/plugins

  - CACHE=$HOME/.cache CMAKE_VERSION=3.4.3 CMAKE_SHORT_VERSION=3.4 source $girder_path/scripts/install_cmake.sh
  - cmake --version

  # There is an issue with the OpenJPEG library included with Ubuntu 14.04,
  # so install it from source.
  - cd $lib_build_path
  - wget -O "openjpeg-$OPENJPEG_VERSION.tar.gz" "https://github.com/uclouvain/openjpeg/archive/$OPENJPEG_FILE"
  - tar -zxpf "openjpeg-$OPENJPEG_VERSION.tar.gz"
  - cd "$OPENJPEG_DIR"
  # - wget -O openjpeg-1.5.2.tar.gz https://github.com/uclouvain/openjpeg/archive/version.1.5.2.tar.gz
  # - tar -zxf openjpeg-1.5.2.tar.gz
  # - cd openjpeg-version.1.5.2
  - cmake .
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build libtiff so it will use our openjpeg
  - cd $lib_build_path
  - wget -O "tiff-$LIBTIFF_VERSION.tar.gz" "http://download.osgeo.org/libtiff/tiff-$LIBTIFF_VERSION.tar.gz"
  - tar -zxpf "tiff-$LIBTIFF_VERSION.tar.gz"
  - cd "tiff-$LIBTIFF_VERSION"
  - ./configure
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build OpenSlide ourselves so that it will use our libtiff
  - cd $lib_build_path
  - wget -O openslide-3.4.1.tar.gz https://github.com/openslide/openslide/archive/v3.4.1.tar.gz
  - tar -zxpf openslide-3.4.1.tar.gz
  - cd openslide-3.4.1
  - autoreconf -i
  - ./configure
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build vips to use our libraries
  - if [ "$BUILD_VIPS" = "yes" ]; then
    cd $lib_build_path &&
    if [ ! -f vips-8.4.5/config.status ]; then
    wget -O vips-8.4.5.tar.gz http://www.vips.ecs.soton.ac.uk/supported/current/vips-8.4.5.tar.gz &&
    tar -zxpf vips-8.4.5.tar.gz &&
    cd vips-8.4.5 &&
    ./configure &&
    make -j 3 >/tmp/vips_build.txt ;
    else
    cd vips-8.4.5 ;
    fi &&
    sudo make install &&
    sudo ldconfig ;
    fi
  - cd $main_path
  - vips --version

  - girder_worker_path=$build_path/girder_worker
  - git clone https://github.com/girder/girder_worker.git $girder_worker_path && git -C $girder_worker_path checkout $GIRDER_WORKER_VERSION
  - cp $PWD/plugin_tests/test_files/girder_worker.cfg $girder_worker_path/girder_worker/worker.local.cfg
  - python $girder_worker_path/scripts/install_requirements.py --mode=dev
  - pip install --no-cache-dir -U -e $girder_worker_path'[girder_io]'

  - export MONGO_VERSION=3.0.7
  - export PY_COVG="ON"
  - CACHE=$HOME/.cache source $girder_path/scripts/install_mongo.sh
  - mkdir /tmp/db
  - mongod --dbpath=/tmp/db >/dev/null 2>/dev/null &
  - mongod --version

  - npm install -g npm
  - npm install -g npm-install-retry
  - npm --version

  - pip install --no-cache-dir -U pip virtualenv

  - pip install --no-cache-dir numpy==1.10.2  # needed because libtiff doesn't install correctly without it.  This ensures we have the same version for libtiff as for the project.

  - if [ ${LIBTIFF_VERSION} == "4.0.6" ]; then pip install "git+https://github.com/pearu/pylibtiff@848785a6a9a4e2c6eb6f56ca9f7e8f6b32e523d5" --force-reinstall --ignore-installed --upgrade; fi


install:
  - cd $girder_path
  - pip install --no-cache-dir -U -r requirements.txt -r requirements-dev.txt -e .
  - pip install -r $main_path/requirements.txt -e .
  # Make sure we have a prefered version of celery for Girder Worker
  - pip install -U 'celery>=4'
  - python -c "import openslide;print openslide.__version__"
  # This was
  # - npm install
  # but since there are often connection failures, use the retry package.
  - npm-install-retry
  - BABEL_ENV=cover NYC_CWD=$main_path girder-install web --plugins=large_image,worker,jobs --dev

script:
  - cd $girder_worker_path
  - python -m girder_worker >/tmp/worker.out 2>&1 &
  # - python -m girder_worker 2>&1 | tee /tmp/worker.out &
  - mkdir -p $build_path/girder_testing_build
  - cd $build_path/girder_testing_build
  - cmake -DPYTHON_COVERAGE:BOOL=${PY_COVG} -DPYTHON_VERSION:STRING=${TRAVIS_PYTHON_VERSION} -DCOVERAGE_MINIMUM_PASS=80 -DJS_COVERAGE_MINIMUM_PASS=9 -DRUN_CORE_TESTS:BOOL="OFF" -DTEST_PLUGINS:STRING="large_image" $girder_path
  - make -j 3
  - JASMINE_TIMEOUT=15000 ctest -VV

after_failure:
  # On failures, show girder's error long and the worker output
  - cat /tmp/worker.out

after_success:
  - bash <(curl -s https://codecov.io/bash) -R $main_path -s $build_path/girder_testing_build
<commit_msg>Fix travis build.<commit_after>language: python

python:
  - "2.7"

env:
  - LIBTIFF_VERSION=4.0.3 OPENJPEG_VERSION=2.1   OPENJPEG_FILE=version.2.1.tar.gz OPENJPEG_DIR="openjpeg-version.2.1"
  - LIBTIFF_VERSION=4.0.6 OPENJPEG_VERSION=2.1.2 OPENJPEG_FILE=v2.1.2.tar.gz      OPENJPEG_DIR="openjpeg-2.1.2" BUILD_VIPS="yes"

cache:
  directories:
    - $HOME/.cache
    - $HOME/build/libs
    - $HOME/build/girder_testing_build/store
    - $HOME/build/girder_testing_build/data

# sudo: false
sudo: required

dist: trusty

compiler:
  - gcc

addons:
  apt:
    packages:
      # Pillow dependencies (see
      # https://pillow.readthedocs.org/en/latest/installation.html)
      - libtiff5-dev
      - libjpeg8-dev
      - zlib1g-dev
      - libfreetype6-dev
      - liblcms2-dev
      - libwebp-dev
      - tcl8.6-dev
      - tk8.6-dev
      - python-tk
      # openjpeg
      - libglib2.0-dev
      - libjpeg-dev
      - libxml2-dev
      - libpng12-dev
      # openslide
      - autoconf
      - automake
      - libtool
      - pkg-config
      - libcairo2-dev
      - libgdk-pixbuf2.0-dev
      - libxml2-dev
      - libsqlite3-dev
      # install vips
      - libvips-tools
      # for building vips
      - build-essential
      - gobject-introspection
      - libcfitsio3-dev
      - libexif-dev
      - libfftw3-dev
      - libgif-dev
      - libgirepository1.0-dev
      - libglib2.0-dev
      - libgsf-1-dev
      - libjpeg-turbo8-dev
      - libmagick++-dev
      - libmatio-dev
      - liborc-0.4-dev
      - libpango1.0-dev
      - libxml2-dev
      - pkg-config
      - python-gi-dev
      # girder worker - not needed; included in travis
      # - rabbitmq-server

services:
  - rabbitmq

before_install:
  - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "3" ]; then export PY3="true"; else export PY2="true"; fi
  - if [ -n "${PY3}" ]; then export MONGO_VERSION=3.0.7; export PY_COVG="OFF"; else export MONGO_VERSION=2.6.11; export PY_COVG="ON"; export DEPLOY=true; fi
  - GIRDER_VERSION=master
  - GIRDER_WORKER_VERSION=master
  - main_path=$PWD
  - build_path=$PWD/build
  - mkdir -p $build_path
  - lib_build_path=$HOME/build/libs
  - mkdir -p $lib_build_path

  - nvm install v5
  - npm install -g npm

  - girder_path=$build_path/girder
  - rm -fr $girder_path
  - git clone https://github.com/girder/girder.git $girder_path && git -C $girder_path checkout $GIRDER_VERSION
  - ln -sf $main_path $girder_path/plugins/
  - ls -l $girder_path/plugins

  - CACHE=$HOME/.cache CMAKE_VERSION=3.4.3 CMAKE_SHORT_VERSION=3.4 source $girder_path/scripts/install_cmake.sh
  - cmake --version

  # There is an issue with the OpenJPEG library included with Ubuntu 14.04,
  # so install it from source.
  - cd $lib_build_path
  - wget -O "openjpeg-$OPENJPEG_VERSION.tar.gz" "https://github.com/uclouvain/openjpeg/archive/$OPENJPEG_FILE"
  - tar -zxpf "openjpeg-$OPENJPEG_VERSION.tar.gz"
  - cd "$OPENJPEG_DIR"
  # - wget -O openjpeg-1.5.2.tar.gz https://github.com/uclouvain/openjpeg/archive/version.1.5.2.tar.gz
  # - tar -zxf openjpeg-1.5.2.tar.gz
  # - cd openjpeg-version.1.5.2
  - cmake .
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build libtiff so it will use our openjpeg
  - cd $lib_build_path
  - wget -O "tiff-$LIBTIFF_VERSION.tar.gz" "http://download.osgeo.org/libtiff/tiff-$LIBTIFF_VERSION.tar.gz"
  - tar -zxpf "tiff-$LIBTIFF_VERSION.tar.gz"
  - cd "tiff-$LIBTIFF_VERSION"
  - ./configure
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build OpenSlide ourselves so that it will use our libtiff
  - cd $lib_build_path
  - wget -O openslide-3.4.1.tar.gz https://github.com/openslide/openslide/archive/v3.4.1.tar.gz
  - tar -zxpf openslide-3.4.1.tar.gz
  - cd openslide-3.4.1
  - autoreconf -i
  - ./configure
  - make -j 3
  - sudo make install
  - sudo ldconfig
  - cd $main_path

  # Build vips to use our libraries
  - if [ "$BUILD_VIPS" = "yes" ]; then
    cd $lib_build_path &&
    if [ ! -f vips-8.4.5/config.status ]; then
    wget -O vips-8.4.5.tar.gz http://www.vips.ecs.soton.ac.uk/supported/current/vips-8.4.5.tar.gz &&
    tar -zxpf vips-8.4.5.tar.gz &&
    cd vips-8.4.5 &&
    ./configure &&
    make -j 3 >/tmp/vips_build.txt ;
    else
    cd vips-8.4.5 ;
    fi &&
    sudo make install &&
    sudo ldconfig ;
    fi
  - cd $main_path
  - vips --version

  - girder_worker_path=$build_path/girder_worker
  - git clone https://github.com/girder/girder_worker.git $girder_worker_path && git -C $girder_worker_path checkout $GIRDER_WORKER_VERSION
  - cp $PWD/plugin_tests/test_files/girder_worker.cfg $girder_worker_path/girder_worker/worker.local.cfg
  - python $girder_worker_path/scripts/install_requirements.py --mode=dev
  - pip install --no-cache-dir -U -e $girder_worker_path'[girder_io]'

  - export MONGO_VERSION=3.0.7
  - export PY_COVG="ON"
  - CACHE=$HOME/.cache source $girder_path/scripts/install_mongo.sh
  - mkdir /tmp/db
  - mongod --dbpath=/tmp/db >/dev/null 2>/dev/null &
  - mongod --version

  - npm install -g npm
  - npm install -g npm-install-retry
  - npm --version

  - pip install --no-cache-dir -U pip virtualenv

  - pip install --no-cache-dir numpy==1.10.2  # needed because libtiff doesn't install correctly without it.  This ensures we have the same version for libtiff as for the project.

  - if [ ${LIBTIFF_VERSION} == "4.0.6" ]; then pip install "git+https://github.com/pearu/pylibtiff@848785a6a9a4e2c6eb6f56ca9f7e8f6b32e523d5" --force-reinstall --ignore-installed --upgrade; fi


install:
  - cd $girder_path
  - pip install --no-cache-dir -U -r requirements.txt -r requirements-dev.txt -e .
  - pip install -r $main_path/requirements.txt -e .
  # Make sure we have a prefered version of celery for Girder Worker
  - pip install -U 'celery>=4'
  # Make sure we have a prefered version of cryptography for Girder Worker
  - pip install -U 'cryptography>=1.7'
  - python -c "import openslide;print openslide.__version__"
  # This was
  # - npm install
  # but since there are often connection failures, use the retry package.
  - npm-install-retry
  - BABEL_ENV=cover NYC_CWD=$main_path girder-install web --plugins=large_image,worker,jobs --dev

script:
  - cd $girder_worker_path
  - python -m girder_worker >/tmp/worker.out 2>&1 &
  # - python -m girder_worker 2>&1 | tee /tmp/worker.out &
  - mkdir -p $build_path/girder_testing_build
  - cd $build_path/girder_testing_build
  - cmake -DPYTHON_COVERAGE:BOOL=${PY_COVG} -DPYTHON_VERSION:STRING=${TRAVIS_PYTHON_VERSION} -DCOVERAGE_MINIMUM_PASS=80 -DJS_COVERAGE_MINIMUM_PASS=9 -DRUN_CORE_TESTS:BOOL="OFF" -DTEST_PLUGINS:STRING="large_image" $girder_path
  - make -j 3
  - JASMINE_TIMEOUT=15000 ctest -VV

after_failure:
  # On failures, show girder's error long and the worker output
  - cat /tmp/worker.out

after_success:
  - bash <(curl -s https://codecov.io/bash) -R $main_path -s $build_path/girder_testing_build

{'fraction_non_alphanumeric': 0.1264645577035735, 'fraction_numerical': 0.025483304042179262, 'mean_word_length': 2.646728971962617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 16, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7093316', 'n_tokens_mistral': 5657, 'n_tokens_neox': 5405, 'n_words': 1064}