<commit_before>sudo: required

services:
  - docker

language: ruby

env:
    global:
        - DOCKER_ENGINE_VERSION=1.12.1
        - DOCKER_MACHINE_VERSION=0.8.1
        - DOCKER_COMPOSE_VERSION=1.8.0
        - DOCKER_DIR=${TRAVIS_BUILD_DIR}/docker

before_install:
    # list docker-engine versions
    - apt-cache madison docker-engine

    # travis documentation says I'm in trusty container
    - lsb_release -a | grep trusty

    # upgrade docker-engine to specific version
    - sudo apt-get -o Dpkg::Options::="--force-confnew" install -y docker-engine=${DOCKER_ENGINE_VERSION}-0~trusty
    - docker version | grep ${DOCKER_ENGINE_VERSION}

    # reinstall docker-compose at specific version
    - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
    - chmod +x docker-compose
    - sudo mv docker-compose /usr/local/bin
    - docker-compose version | grep ${DOCKER_COMPOSE_VERSION}

    # install docker-machine at specific version
    - curl -L https://github.com/docker/machine/releases/download/v{DOCKER_COMPOSE_VERSION}/docker-machine-`uname -s`-`uname -m` > docker-machine
    - chmod +x docker-machine
    - sudo mv docker-machine /usr/local/bin
    #- docker-machine version  FAILS ???

    # smoke test
    - docker run --rm hello-world
    - docker images

script:
    # Build the cyber-dojo web image
    #- cd ${DOCKER_DIR}/nginx
    #- ./build-image.sh
    #- cd ${DOCKER_DIR}/user-base
    #- ./build-image.sh
    #- cd ${DOCKER_DIR}/web-base
    #- ./build-image.sh ${DOCKER_ENGINE_VERSION}

    - cd ${DOCKER_DIR}/web
    - ./build-image.sh ${DOCKER_ENGINE_VERSION}
    - cd ${TRAVIS_BUILD_DIR}/cli
    - ./cyber-dojo up
    - cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"`
    - docker logs cyber-dojo-web
    - docker inspect -f {{.State.Running}} ${cid}
    - docker ps -a
    #- docker --debug exec ${cid} sh -c "cd test && ./run.sh"
    - docker         exec ${cid} sh -c "cd test && ./run.sh"<commit_msg>pre-pull images in travis.yml script before running tests<commit_after>sudo: required

services:
  - docker

language: ruby

env:
    global:
        - DOCKER_ENGINE_VERSION=1.12.1
        - DOCKER_MACHINE_VERSION=0.8.1
        - DOCKER_COMPOSE_VERSION=1.8.0
        - DOCKER_DIR=${TRAVIS_BUILD_DIR}/docker

before_install:
    # list docker-engine versions
    - apt-cache madison docker-engine

    # travis documentation says I'm in trusty container
    - lsb_release -a | grep trusty

    # upgrade docker-engine to specific version
    - sudo apt-get -o Dpkg::Options::="--force-confnew" install -y docker-engine=${DOCKER_ENGINE_VERSION}-0~trusty
    - docker version | grep ${DOCKER_ENGINE_VERSION}

    # reinstall docker-compose at specific version
    - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
    - chmod +x docker-compose
    - sudo mv docker-compose /usr/local/bin
    - docker-compose version | grep ${DOCKER_COMPOSE_VERSION}

    # install docker-machine at specific version
    - curl -L https://github.com/docker/machine/releases/download/v{DOCKER_COMPOSE_VERSION}/docker-machine-`uname -s`-`uname -m` > docker-machine
    - chmod +x docker-machine
    - sudo mv docker-machine /usr/local/bin
    #- docker-machine version  FAILS ???

    # smoke test
    - docker run --rm hello-world
    - docker images

script:
    # Build the cyber-dojo web image
    #- cd ${DOCKER_DIR}/nginx
    #- ./build-image.sh
    #- cd ${DOCKER_DIR}/user-base
    #- ./build-image.sh
    #- cd ${DOCKER_DIR}/web-base
    #- ./build-image.sh ${DOCKER_ENGINE_VERSION}

    - cd ${DOCKER_DIR}/web
    - ./build-image.sh ${DOCKER_ENGINE_VERSION}
    - cd ${TRAVIS_BUILD_DIR}/cli
    - ./cyber-dojo up
    - cid=`docker ps --all --quiet --filter "name=cyber-dojo-web"`
    - docker logs cyber-dojo-web
    - docker inspect -f {{.State.Running}} ${cid}
    - docker ps -a
    #- docker --debug exec ${cid} sh -c "cd test && ./run.sh"
    - docker pull cyberdojofoundation/gcc_assert:latest
    - docker pull cyberdojofoundation/ruby_test_unit:latest
    - docker         exec ${cid} sh -c "cd test && ./run.sh"
{'fraction_non_alphanumeric': 0.13349056603773585, 'fraction_numerical': 0.005188679245283019, 'mean_word_length': 2.6560344827586206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4954816', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1476, 'n_words': 322}