<commit_before>version: 2

jobs:
  build:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk

    steps:
      - checkout

      - restore_cache:
          keys:
            - v4-nevergreen-ui-{{ checksum ".nvmrc" }}-{{ checksum "package-lock.json" }}
            - v4-nevergreen-ui-{{ checksum ".nvmrc" }}- # fall back to any cache for the current version of node

      - restore_cache:
          keys:
            - v1-nevergreen-server-{{ checksum "project.clj" }}

      - run:
          name: update version
          command: |
            export BUILD_NUM=$CIRCLE_BUILD_NUM
            export COMMIT_HASH=${CIRCLE_SHA1:0:7}
            ./ci/update-version.sh

      - run:
          name: install node
          command: ./ci/install-node.sh

      - run:
          name: build
          environment:
            BASH_ENV: "~/.nvm/nvm.sh"
          command: |
            ./ci/dependencies.sh
            ./ci/compile.sh

      - save_cache:
          key: v1-nevergreen-server-{{ checksum "project.clj" }}
          paths:
            - ~/.m2
      - save_cache:
          key: v4-nevergreen-ui-{{ checksum ".nvmrc" }}-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
            - ~/.nvm

      - run:
          name: test
          environment:
            BASH_ENV: "~/.nvm/nvm.sh"
          command: ./ci/test.sh

      - store_test_results:
          path: ./target/test-reports

      - store_artifacts:
          path: ./target/nevergreen-standalone.jar
      - store_artifacts:
          path: ./coverage

      - persist_to_workspace:
          root: .
          paths:
            - ./src/client/version.json
            - ./ci/*
            - ./target/nevergreen-standalone.jar

  deploy-staging:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk

    steps:
      - setup_remote_docker

      - attach_workspace:
          at: ~/nevergreen

      - add_ssh_keys:
          fingerprints:
            - "84:1d:85:ed:80:92:c5:21:53:15:54:b9:52:99:29:35"

      - run:
          name: add nevergreen.io to known hosts
          command: |
            mkdir -p ~/.ssh
            ssh-keyscan 172.16.31.10 >> ~/.ssh/known_hosts

      - run:
          name: install command line json parser
          command: sudo apt-get install jq

      - run:
          name: export version
          command: ./ci/export-version.sh

      - run:
          name: deploy staging
          command: ./ci/deploy.sh

      - run:
          name: smoke test
          environment:
            HOST: "https://staging.nevergreen.io"
          command: ./ci/smoke-test.sh

      - run:
          name: copy nevergreen into remote container
	  command: |
            docker cp circleci/openjdk:8-jdk:/home/circleci/nevergreen /home

      - run:
          name: create release on Dockerhub
          command: ./ci/release-image.sh

  functional-tests:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk-browsers

    steps:
      - checkout

      - restore_cache:
          key: v1-nevergreen-server-{{ checksum "project.clj" }}

      - attach_workspace:
          at: ~/nevergreen

      - run:
          name: export version<commit_msg>[#203] Fixes formatting issues in config yml<commit_after>version: 2

jobs:
  build:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk

    steps:
      - checkout

      - restore_cache:
          keys:
            - v4-nevergreen-ui-{{ checksum ".nvmrc" }}-{{ checksum "package-lock.json" }}
            - v4-nevergreen-ui-{{ checksum ".nvmrc" }}- # fall back to any cache for the current version of node

      - restore_cache:
          keys:
            - v1-nevergreen-server-{{ checksum "project.clj" }}

      - run:
          name: update version
          command: |
            export BUILD_NUM=$CIRCLE_BUILD_NUM
            export COMMIT_HASH=${CIRCLE_SHA1:0:7}
            ./ci/update-version.sh

      - run:
          name: install node
          command: ./ci/install-node.sh

      - run:
          name: build
          environment:
            BASH_ENV: "~/.nvm/nvm.sh"
          command: |
            ./ci/dependencies.sh
            ./ci/compile.sh

      - save_cache:
          key: v1-nevergreen-server-{{ checksum "project.clj" }}
          paths:
            - ~/.m2
      - save_cache:
          key: v4-nevergreen-ui-{{ checksum ".nvmrc" }}-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
            - ~/.nvm

      - run:
          name: test
          environment:
            BASH_ENV: "~/.nvm/nvm.sh"
          command: ./ci/test.sh

      - store_test_results:
          path: ./target/test-reports

      - store_artifacts:
          path: ./target/nevergreen-standalone.jar
      - store_artifacts:
          path: ./coverage

      - persist_to_workspace:
          root: .
          paths:
            - ./src/client/version.json
            - ./ci/*
            - ./target/nevergreen-standalone.jar

  deploy-staging:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk

    steps:
      - setup_remote_docker

      - attach_workspace:
          at: ~/nevergreen

      - add_ssh_keys:
          fingerprints:
            - "84:1d:85:ed:80:92:c5:21:53:15:54:b9:52:99:29:35"

      - run:
          name: add nevergreen.io to known hosts
          command: |
            mkdir -p ~/.ssh
            ssh-keyscan 172.16.31.10 >> ~/.ssh/known_hosts

      - run:
          name: install command line json parser
          command: sudo apt-get install jq

      - run:
          name: export version
          command: ./ci/export-version.sh

      - run:
          name: deploy staging
          command: ./ci/deploy.sh

      - run:
          name: smoke test
          environment:
            HOST: "https://staging.nevergreen.io"
          command: ./ci/smoke-test.sh

      - run:
          name: copy nevergreen into remote container
          command: |
            docker cp circleci/openjdk:8-jdk:/home/circleci/nevergreen /home

      - run:
          name: create release on Dockerhub
          command: ./ci/release-image.sh

  functional-tests:
    working_directory: ~/nevergreen

    docker:
      - image: circleci/openjdk:8-jdk-browsers

    steps:
      - checkout

      - restore_cache:
          key: v1-nevergreen-server-{{ checksum "project.clj" }}

      - attach_workspace:
          at: ~/nevergreen

      - run:
          name: export version
{'fraction_non_alphanumeric': 0.1155130540376442, 'fraction_numerical': 0.015938069216757743, 'mean_word_length': 1.4242089771891095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '726202', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2012, 'n_words': 411}