<commit_before>﻿version: 2

_defaults: &defaults
  docker:
    - image: docker:17.05.0-ce
  working_directory: ~/scbd/eunomia.cbd.int
  parallelism: 1

_run:
  buildDocker: &buildDocker
    name: Build docker image
    command: |
      docker info
      docker build -t output --build-arg VERSION=$CIRCLE_SHA1 --build-arg BRANCH=${CIRCLE_BRANCH:-master} --build-arg TAG=$CIRCLE_TAG .
  testImage: &testImage
    name: Test docker image
    command:  |
      docker run --name eunomia -d -p 8000:8000 output;sleep 10;
      docker exec eunomia curl --retry 10 --retry-delay 5 -v http://localhost:8000/

jobs:
  build:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker
      - run: *buildDocker
      - run: *testImage

  build-deploy-branches:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker
      - run: *buildDocker
      - run: *testImage
      - deploy:
          name: Deploy build to docker hub
          command:  |
            docker login -u $DOCKER_USER -p $DOCKER_PASS
            docker tag output scbd/$CIRCLE_PROJECT_REPONAME:$CIRCLE_BRANCH
            docker push scbd/$CIRCLE_PROJECT_REPONAME:$CIRCLE_BRANCH

  build_and_deploy_releases:
    <<: *defaults<commit_msg>version to commit<commit_after>﻿version: 2

_defaults: &defaults
  docker:
    - image: docker:17.05.0-ce
  working_directory: ~/scbd/eunomia.cbd.int
  parallelism: 1

_run:
  buildDocker: &buildDocker
    name: Build docker image
    command: |
      docker info
      docker build -t output --build-arg COMMIT=$CIRCLE_SHA1 --build-arg BRANCH=${CIRCLE_BRANCH:-master} --build-arg TAG=$CIRCLE_TAG .
  testImage: &testImage
    name: Test docker image
    command:  |
      docker run --name eunomia -d -p 8000:8000 output;sleep 10;
      docker exec eunomia curl --retry 10 --retry-delay 5 -v http://localhost:8000/

jobs:
  build:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker
      - run: *buildDocker
      - run: *testImage

  build-deploy-branches:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker
      - run: *buildDocker
      - run: *testImage
      - deploy:
          name: Deploy build to docker hub
          command:  |
            docker login -u $DOCKER_USER -p $DOCKER_PASS
            docker tag output scbd/$CIRCLE_PROJECT_REPONAME:$CIRCLE_BRANCH
            docker push scbd/$CIRCLE_PROJECT_REPONAME:$CIRCLE_BRANCH

  build_and_deploy_releases:
    <<: *defaults
{'fraction_non_alphanumeric': 0.10052695581678152, 'fraction_numerical': 0.020267531414673693, 'mean_word_length': 2.413554633471646, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1314755', 'n_tokens_mistral': 927, 'n_tokens_neox': 841, 'n_words': 199}