<commit_before># Setup in CircleCI account the following ENV variables:
# IS_PRODUCTION (default: 0)
# IS_ENTERPRISE (default: 0)
# PACKAGECLOUD_ORGANIZATION (default: stackstorm)
# PACKAGECLOUD_TOKEN
# DOCKER_USER
# DOCKER_EMAIL
# DOCKER_PASSWORD
general:
  # Don't run CI for PR, only for major branches
  branches:
    only:
      - master
      - /st2-[0-9]+\.[0-9]+\.[0-9]+/
  build_dir: st2-packages
  artifacts:
    - ~/packages

machine:
  environment:
    DISTROS: "trusty xenial el6 el7"
    NOTESTS: "xenial el7"
    ST2_PACKAGES_REPO: https://github.com/StackStorm/st2-packages
    # XXX: Set this to 'vX.Y' for release branches
    ST2_PACKAGES_BRANCH: master
    # XXX: Set this to 'st2-X.Y.Z' for the release branches
    ST2MISTRAL_GITREV: master
    ST2_DOCKERFILES_REPO: https://github.com/StackStorm/st2-dockerfiles
    ST2_PACKAGES: "st2mistral"
    BUILD_DOCKER: 0
    DEPLOY_DOCKER: 0
    DEPLOY_PACKAGES: 1
  pre:
    - mkdir -p ~/packages
    # Need latest Docker version for some features to work (CircleCI by default works with outdated version)
    - |
      sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.0-circleci'
      sudo chmod 0755 /usr/bin/docker
  services:
    - docker
    - postgresql
    - rabbitmq-server

checkout:
  post:
    - |
      git clone --depth 1 ${ST2_PACKAGES_REPO} /home/ubuntu/mistral/st2-packages
      cd /home/ubuntu/mistral/st2-packages
      git checkout ${ST2_PACKAGES_BRANCH} || true
    - .circle/buildenv_mistral.sh

dependencies:
  cache_directories:
    - ~/.cache/pip
  pre:
    - sudo .circle/configure-services.sh
    - sudo .circle/fix-cache-permissions.sh
    - sudo apt-get -y install parallel jq
    - gem install package_cloud
    - sudo pip install docker-compose
    - docker-compose version
    - docker version
  override:
    - .circle/docker-compose.sh pull ${DISTRO}
  post:
    - .circle/docker-compose.sh build ${DISTRO}

test:
  override:
    # docker-compose test depends on both mistral and st2 packages being available.
    # Enable the tests, when there are separate tests for mistral.
    # - .circle/docker-compose.sh test ${DISTRO}:
    #    parallel: true
    # Copy all Packages to node0
    - rsync -rv /tmp/st2-packages/ node0:~/packages/${DISTRO}:
        parallel: true
  # post:<commit_msg>Fix build failure due to docker-compose incompatibility<commit_after># Setup in CircleCI account the following ENV variables:
# IS_PRODUCTION (default: 0)
# IS_ENTERPRISE (default: 0)
# PACKAGECLOUD_ORGANIZATION (default: stackstorm)
# PACKAGECLOUD_TOKEN
# DOCKER_USER
# DOCKER_EMAIL
# DOCKER_PASSWORD
general:
  # Don't run CI for PR, only for major branches
  branches:
    only:
      - master
      - /st2-[0-9]+\.[0-9]+\.[0-9]+/
  build_dir: st2-packages
  artifacts:
    - ~/packages

machine:
  environment:
    DISTROS: "trusty xenial el6 el7"
    NOTESTS: "xenial el7"
    ST2_PACKAGES_REPO: https://github.com/StackStorm/st2-packages
    # XXX: Set this to 'vX.Y' for release branches
    ST2_PACKAGES_BRANCH: master
    # XXX: Set this to 'st2-X.Y.Z' for the release branches
    ST2MISTRAL_GITREV: master
    ST2_DOCKERFILES_REPO: https://github.com/StackStorm/st2-dockerfiles
    ST2_PACKAGES: "st2mistral"
    BUILD_DOCKER: 0
    DEPLOY_DOCKER: 0
    DEPLOY_PACKAGES: 1
  pre:
    - mkdir -p ~/packages
    # Need latest Docker version for some features to work (CircleCI by default works with outdated version)
    - |
      sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.0-circleci'
      sudo chmod 0755 /usr/bin/docker
  services:
    - docker
    - postgresql
    - rabbitmq-server

checkout:
  post:
    - |
      git clone --depth 1 ${ST2_PACKAGES_REPO} /home/ubuntu/mistral/st2-packages
      cd /home/ubuntu/mistral/st2-packages
      git checkout ${ST2_PACKAGES_BRANCH} || true
    - .circle/buildenv_mistral.sh

dependencies:
  cache_directories:
    - ~/.cache/pip
  pre:
    - sudo .circle/configure-services.sh
    - sudo .circle/fix-cache-permissions.sh
    - sudo apt-get -y install parallel jq
    - gem install package_cloud
    - sudo pip install "docker-compose==1.14.0"
    - docker-compose version
    - docker version
  override:
    - .circle/docker-compose.sh pull ${DISTRO}
  post:
    - .circle/docker-compose.sh build ${DISTRO}

test:
  override:
    # docker-compose test depends on both mistral and st2 packages being available.
    # Enable the tests, when there are separate tests for mistral.
    # - .circle/docker-compose.sh test ${DISTRO}:
    #    parallel: true
    # Copy all Packages to node0
    - rsync -rv /tmp/st2-packages/ node0:~/packages/${DISTRO}:
        parallel: true
  # post:
{'fraction_non_alphanumeric': 0.10676532769556026, 'fraction_numerical': 0.019027484143763214, 'mean_word_length': 2.846341463414634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '40809', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1673, 'n_words': 415}