<commit_before>---
version: 2

x-config:
  - &docker-node-8
    image: 'circleci/node:8'
  - &restore-cache-yarn
    key: 'v3-yarn-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}'
  - &save-cache-yarn
    key: 'v3-yarn-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}'
    paths: [~/.cache/yarn, ~/Library/Caches/Yarn]
  - &restore-cache-bundler
    key: 'v2-ruby-dependencies-{{ arch }}-{{ checksum "Gemfile.lock" }}'
  - &save-cache-bundler
    key: 'v2-ruby-dependencies-{{ arch }}-{{ checksum "Gemfile.lock" }}'
    paths: [./vendor/bundle]
  - &restore-cache-gradle
    key: 'v1-gradle-dependencies-{{ arch }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "node_modules/react-native/package.json" }}'
  - &save-cache-gradle
    key: 'v1-gradle-dependencies-{{ arch }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "node_modules/react-native/package.json" }}'
    paths: [~/.gradle]
  - &set-ruby-version
    name: Set Ruby Version
    command: echo "ruby-2.4.2" > ~/.ruby-version
  - &run-danger
    command: yarn run danger --id $task
    when: always

workflows:
  version: 2
  analyze:
    jobs:
      - cache-yarn-linux
      - danger: {requires: [cache-yarn-linux]}
      - flow: {requires: [cache-yarn-linux]}
      - jest: {requires: [cache-yarn-linux]}
      - prettier: {requires: [cache-yarn-linux]}
      - eslint: {requires: [cache-yarn-linux]}
      - data: {requires: [cache-yarn-linux]}
      - ios: {requires: [danger, flow, jest, prettier, eslint, data]}
      - android: {requires: [danger, flow, jest, prettier, eslint, data]}

jobs:
  cache-yarn-linux:
    docker: [*docker-node-8]
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - run: yarn --version
      - save_cache: *save-cache-yarn

  danger:
    docker: [*docker-node-8]
    environment:
      task: JS-general
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: *run-danger

  flow:
    docker: [*docker-node-8]
    environment:
      task: JS-flow
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run bundle-data
      - run: yarn run --silent flow check --quiet | tee logs/flow
      - run: *run-danger

  jest:
    docker: [*docker-node-8]
    environment:
      task: JS-jest
      JEST_JUNIT_OUTPUT: ./logs/jest-junit.xml
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run bundle-data
      - run: yarn run --silent test --coverage --testResultsProcessor="jest-junit" 2>&1 | tee logs/jest
      - run: *run-danger
      - store_test_results:
          path: ./logs/jest-junit.xml
      - run: yarn global add coveralls
      - run:
          name: coveralls
          command: |
            export PATH=$PATH:$(yarn global bin)
            export COVERALLS_SERVICE_NAME=CircleCI
            export COVERALLS_SERVICE_JOB_ID=$CIRCLE_BUILD_NUM
            coveralls < ./coverage/lcov.info

  prettier:
    docker: [*docker-node-8]
    environment:
      task: JS-prettier
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run prettier
      - run:
          name: git diff
          command: |
            touch logs/prettier  # to ensure that the file exists
            if ! git diff --quiet *.js source/ scripts/; then
              git diff *.js source/ scripts/ | tee logs/prettier
            fi
      - run: *run-danger

  eslint:
    docker: [*docker-node-8]
    environment:
      task: JS-lint
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run bundle-data
      - run: yarn run --silent lint | tee logs/eslint
      - run: yarn run --silent lint --format > logs/eslint-junit.xml
      - run: *run-danger
      - store_test_results:
          path: ./logs/eslint-junit.xml

  data:
    docker: [*docker-node-8]
    environment:
      task: JS-data
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run --silent validate-data --quiet | tee logs/validate-data
      - run: yarn run --silent validate-bus-data | tee logs/validate-bus-data
      - run: *run-danger

  android:
    docker: [{image: 'circleci/android:api-27-node8-alpha'}]
    environment:
      task: ANDROID
      FASTLANE_SKIP_UPDATE_CHECK: '1'
      FASTLANE_DISABLE_ANIMATION: '1'
    steps:<commit_msg>poke at updating the junit output<commit_after>---
version: 2

x-config:
  - &docker-node-8
    image: 'circleci/node:8'
  - &restore-cache-yarn
    key: 'v3-yarn-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}'
  - &save-cache-yarn
    key: 'v3-yarn-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}'
    paths: [~/.cache/yarn, ~/Library/Caches/Yarn]
  - &restore-cache-bundler
    key: 'v2-ruby-dependencies-{{ arch }}-{{ checksum "Gemfile.lock" }}'
  - &save-cache-bundler
    key: 'v2-ruby-dependencies-{{ arch }}-{{ checksum "Gemfile.lock" }}'
    paths: [./vendor/bundle]
  - &restore-cache-gradle
    key: 'v1-gradle-dependencies-{{ arch }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "node_modules/react-native/package.json" }}'
  - &save-cache-gradle
    key: 'v1-gradle-dependencies-{{ arch }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "node_modules/react-native/package.json" }}'
    paths: [~/.gradle]
  - &set-ruby-version
    name: Set Ruby Version
    command: echo "ruby-2.4.2" > ~/.ruby-version
  - &run-danger
    command: yarn run danger --id $task
    when: always

workflows:
  version: 2
  analyze:
    jobs:
      - cache-yarn-linux
      - danger: {requires: [cache-yarn-linux]}
      - flow: {requires: [cache-yarn-linux]}
      - jest: {requires: [cache-yarn-linux]}
      - prettier: {requires: [cache-yarn-linux]}
      - eslint: {requires: [cache-yarn-linux]}
      - data: {requires: [cache-yarn-linux]}
      - ios: {requires: [danger, flow, jest, prettier, eslint, data]}
      - android: {requires: [danger, flow, jest, prettier, eslint, data]}

jobs:
  cache-yarn-linux:
    docker: [*docker-node-8]
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - run: yarn --version
      - save_cache: *save-cache-yarn

  danger:
    docker: [*docker-node-8]
    environment:
      task: JS-general
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: *run-danger

  flow:
    docker: [*docker-node-8]
    environment:
      task: JS-flow
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run bundle-data
      - run: yarn run --silent flow check --quiet | tee logs/flow
      - run: *run-danger

  jest:
    docker: [*docker-node-8]
    environment:
      task: JS-jest
      JEST_JUNIT_OUTPUT: ./test-results/jest.xml
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/ test-results
      - run: yarn run bundle-data
      - run: yarn run --silent test --coverage --testResultsProcessor="jest-junit" 2>&1 | tee logs/jest
      - run: *run-danger
      - store_test_results: {path: ./test-results}
      - run: yarn global add coveralls
      - run:
          name: coveralls
          command: |
            export PATH=$PATH:$(yarn global bin)
            export COVERALLS_SERVICE_NAME=CircleCI
            export COVERALLS_SERVICE_JOB_ID=$CIRCLE_BUILD_NUM
            coveralls < ./coverage/lcov.info

  prettier:
    docker: [*docker-node-8]
    environment:
      task: JS-prettier
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run prettier
      - run:
          name: git diff
          command: |
            touch logs/prettier  # to ensure that the file exists
            if ! git diff --quiet *.js source/ scripts/; then
              git diff *.js source/ scripts/ | tee logs/prettier
            fi
      - run: *run-danger

  eslint:
    docker: [*docker-node-8]
    environment:
      task: JS-lint
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/ test-results/
      - run: yarn run bundle-data
      - run: yarn run --silent lint | tee logs/eslint
      - run: yarn run --silent lint --format > test-results/eslint.xml
      - run: *run-danger
      - store_test_results: {path: ./test-results}

  data:
    docker: [*docker-node-8]
    environment:
      task: JS-data
    steps:
      - checkout
      - restore_cache: *restore-cache-yarn
      - run: yarn install
      - save_cache: *save-cache-yarn
      - run: mkdir -p logs/
      - run: yarn run --silent validate-data --quiet | tee logs/validate-data
      - run: yarn run --silent validate-bus-data | tee logs/validate-bus-data
      - run: *run-danger

  android:
    docker: [{image: 'circleci/android:api-27-node8-alpha'}]
    environment:
      task: ANDROID
      FASTLANE_SKIP_UPDATE_CHECK: '1'
      FASTLANE_DISABLE_ANIMATION: '1'
    steps:
{'fraction_non_alphanumeric': 0.1411067590639751, 'fraction_numerical': 0.005423320277191925, 'mean_word_length': 2.1070202808112324, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '5032844', 'n_tokens_mistral': 3595, 'n_tokens_neox': 3363, 'n_words': 778}