<commit_before>version: 2
jobs:
  build:
    docker:
      - image: node:8.5.0
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run: yarn install
      - save_cache:
          name: Save yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
          paths:
            - ~/data-hub-frontend/node_modules
  lint_code:
    docker:
      - image: node:8.5.0
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run:
          name: Lint code
          command: |
            mkdir -p reports
            yarn lint:all:js -- --format junit --output-file reports/eslint.xml
            yarn lint:all:styles
          when: always
      - store_test_results:
          path: reports
      - store_artifacts:
          path: reports
  unit_tests:
    docker:
      - image: node:8.5.0
        environment:
          TZ: "/usr/share/zoneinfo/Europe/London"
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run:
          name: Run unit tests
          command: |
            mkdir junit
            yarn build
            yarn circle:unit
          environment:
            MOCHA_FILE: junit/test-results.xml
          when: always
      - store_test_results:
          path: junit
      - store_artifacts:
          path: junit
      - store_test_results:
          path: coverage
      - store_artifacts:
          path: coverage
  user_acceptance_tests: &user_acceptance_tests
    environment:
      BASH_ENV: "/usr/local/nvm/nvm.sh"
    docker:
      - &docker_dat_hub_base
        image: ukti/docker-data-hub-base
        environment:
          API_CLIENT_ID: circleCiClientId
          API_CLIENT_SECRET: <PASSWORD>
          API_ROOT: http://localhost:8000
          QA_HOST: http://localhost:3000
          QA_SELENIUM_HOST: 127.0.0.1
          QA_SELENIUM_PORT: 4444
          QA_USER_EMAIL: <EMAIL>
          QA_USER_PASSWORD: <PASSWORD>
          REDIS_HOST: localhost
          TZ: "/usr/share/zoneinfo/Europe/London"
          LOG_LEVEL: debug
      - &docker_redis
        image: redis:3.2.10
      - &docker_elasticsearch
        image: elasticsearch:5.5
      - &docker_postgres
        image: postgres:9.5
        name: postgres
        restart: always
        environment:
          POSTGRES_DB: datahub
      - &docker_data_hub_leeloo
        image: ukti/data-hub-leeloo
        command: ./setup-uat.sh
        environment:
          API_CLIENT_ID: circleCiClientId
          API_CLIENT_SECRET: <PASSWORD>
          AWS_DEFAULT_REGION: eu-west-2
          AWS_ACCESS_KEY_ID: foo
          AWS_SECRET_ACCESS_KEY: bar
          CDMS_AUTH_URL: http://example.com
          DATABASE_URL: postgresql://postgres@postgres/datahub
          DATAHUB_SECRET: secret
          DEBUG: True
          DOCUMENTS_BUCKET: baz
          DJANGO_SECRET_KEY: topSecret
          DJANGO_SETTINGS_MODULE: config.settings.local
          ES_INDEX: test_index
          ES5_URL: http://localhost:9200
          POSTGRES_URL: tcp://postgres:5432
          QA_USER_EMAIL: <EMAIL>
          QA_USER_PASSWORD: <PASSWORD>
    parallelism: 4
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - run:
          name: Wait for data hub leeloo
          command: dockerize -wait ${API_ROOT}/admin/ -timeout 240s
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "~/data-hub-frontend/yarn.lock" }}
      - run: yarn build
      - run:
          name: Start data hub frontend
          command: yarn start
          background: true
      - run:
          name: Wait for data hub frontend
          command: dockerize -wait ${QA_HOST}/healthcheck -timeout 60s
      - run:
          name: Split tests for parallelisation and then run acceptance tests
          command: |
            # split .features for parallelisation
            FEATURES="$(circleci tests glob "test/acceptance/features/**/*.feature" | circleci tests split --split-by=filesize)"

            # move groups of .features to folder
            mkdir -p ~/data-hub-frontend/test/acceptance/features_${CIRCLE_NODE_INDEX}
            for featureFile in ${FEATURES}; do<commit_msg>bump up the boxes used on circleCi<commit_after>version: 2
jobs:
  build:
    docker:
      - image: node:8.5.0
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run: yarn install
      - save_cache:
          name: Save yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
          paths:
            - ~/data-hub-frontend/node_modules
  lint_code:
    docker:
      - image: node:8.5.0
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run:
          name: Lint code
          command: |
            mkdir -p reports
            yarn lint:all:js -- --format junit --output-file reports/eslint.xml
            yarn lint:all:styles
          when: always
      - store_test_results:
          path: reports
      - store_artifacts:
          path: reports
  unit_tests:
    docker:
      - image: node:8.5.0
        environment:
          TZ: "/usr/share/zoneinfo/Europe/London"
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "yarn.lock" }}
      - run:
          name: Run unit tests
          command: |
            mkdir junit
            yarn build
            yarn circle:unit
          environment:
            MOCHA_FILE: junit/test-results.xml
          when: always
      - store_test_results:
          path: junit
      - store_artifacts:
          path: junit
      - store_test_results:
          path: coverage
      - store_artifacts:
          path: coverage
  user_acceptance_tests: &user_acceptance_tests
    environment:
      BASH_ENV: "/usr/local/nvm/nvm.sh"
    docker:
      - &docker_dat_hub_base
        image: ukti/docker-data-hub-base
        environment:
          API_CLIENT_ID: circleCiClientId
          API_CLIENT_SECRET: youAintSeenMeRight
          API_ROOT: http://localhost:8000
          QA_HOST: http://localhost:3000
          QA_SELENIUM_HOST: 127.0.0.1
          QA_SELENIUM_PORT: 4444
          QA_USER_EMAIL: <EMAIL>
          QA_USER_PASSWORD: <PASSWORD>
          REDIS_HOST: localhost
          TZ: "/usr/share/zoneinfo/Europe/London"
          LOG_LEVEL: debug
      - &docker_redis
        image: redis:3.2.10
      - &docker_elasticsearch
        image: elasticsearch:5.5
      - &docker_postgres
        image: postgres:9.5
        name: postgres
        restart: always
        environment:
          POSTGRES_DB: datahub
      - &docker_data_hub_leeloo
        image: ukti/data-hub-leeloo
        command: ./setup-uat.sh
        environment:
          API_CLIENT_ID: circleCiClientId
          API_CLIENT_SECRET: youAintSeenMeRight
          AWS_DEFAULT_REGION: eu-west-2
          AWS_ACCESS_KEY_ID: foo
          AWS_SECRET_ACCESS_KEY: bar
          CDMS_AUTH_URL: http://example.com
          DATABASE_URL: postgresql://postgres@postgres/datahub
          DATAHUB_SECRET: secret
          DEBUG: True
          DOCUMENTS_BUCKET: baz
          DJANGO_SECRET_KEY: topSecret
          DJANGO_SETTINGS_MODULE: config.settings.local
          ES_INDEX: test_index
          ES5_URL: http://localhost:9200
          POSTGRES_URL: tcp://postgres:5432
          QA_USER_EMAIL: <EMAIL>
          QA_USER_PASSWORD: <PASSWORD>
    parallelism: 6
    working_directory: ~/data-hub-frontend
    steps:
      - checkout
      - run:
          name: Wait for data hub leeloo
          command: dockerize -wait ${API_ROOT}/admin/ -timeout 240s
      - restore_cache:
          name: Restore yarn dependencies cache
          key: yarn-dependencies-{{ checksum "~/data-hub-frontend/yarn.lock" }}
      - run: yarn build
      - run:
          name: Start data hub frontend
          command: yarn start
          background: true
      - run:
          name: Wait for data hub frontend
          command: dockerize -wait ${QA_HOST}/healthcheck -timeout 60s
      - run:
          name: Split tests for parallelisation and then run acceptance tests
          command: |
            # split .features for parallelisation
            FEATURES="$(circleci tests glob "test/acceptance/features/**/*.feature" | circleci tests split --split-by=filesize)"

            # move groups of .features to folder
            mkdir -p ~/data-hub-frontend/test/acceptance/features_${CIRCLE_NODE_INDEX}
            for featureFile in ${FEATURES}; do
{'fraction_non_alphanumeric': 0.08508346795907377, 'fraction_numerical': 0.011200861604738826, 'mean_word_length': 1.8028976758225173, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 2, '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': '3582781', 'n_tokens_mistral': 2926, 'n_tokens_neox': 2778, 'n_words': 625}