<commit_before>version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:10-jdk
    steps:
      - checkout
      - restore_cache:
          key: gradle-cache
      - run:
          name: build
          command: ./gradlew -Penv=jenkins -b build.gradle clean build --info --stacktrace --parallel -x test -x checkstyleMain -x checkstyleTest -x spotbugsMain -x spotbugsTest
      - run:
          name: check
          command: git status | grep "working tree clean"
      - save_cache:
          key: gradle-cache
          paths:
            - "~/.gradle"
      - persist_to_workspace:
          root: .
          paths:
            - core/build/libs/cloudbreak.jar
            - mock-caas/build/libs/mock-caas.jar
            - integration-test/build/libs/cloudbreak-integration-test.jar

  code-quality-check-checkstyle-test:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: checkstyle-test
          command: ./gradlew -Penv=jenkins -b build.gradle check -x spotbugsMain -x spotbugsTest -x checkstyleMain -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store checkstyle-test results
          command: |
            mkdir -p ~/checkstyle-test
            grep -rls */build/reports/checkstyle/*.xml -e "<error line=" | xargs -I '{}' cp '{}' ~/checkstyle-test
          when: always
      - store_artifacts:
          path: ~/checkstyle-test

  code-quality-check-checkstyle-main:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: checkstyle-main
          command: ./gradlew -Penv=jenkins -b build.gradle check -x spotbugsMain -x spotbugsTest -x checkstyleTest -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store checkstyle results
          command: |
            mkdir -p ~/checkstyle
            grep -rls */build/reports/checkstyle/*.xml -e "<error line=" | xargs -I '{}' cp '{}' ~/checkstyle
          when: always
      - store_artifacts:
          path: ~/checkstyle

  code-quality-check-spotbugs-main:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: spotbugs-main
          command: ./gradlew -Penv=jenkins -b build.gradle check -x checkstyleMain -x checkstyleTest -x spotbugsTest -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store spotbugs main results
          command: |
            mkdir -p ~/spotbugs-main
            grep -rls */build/reports/spotbugs/*.html -e "<b>[^0]</b>" | xargs -I '{}' cp '{}' ~/spotbugs-main
          when: always
      - store_artifacts:
          path: ~/spotbugs-main

  code-quality-check-spotbugs-test:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: spotbugs-test
          command: ./gradlew -Penv=jenkins -b build.gradle check -x checkstyleMain -x checkstyleTest -x spotbugsMain -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store spotbugs test results
          command: |
            mkdir -p ~/spotbugs-test
            grep -rls */build/reports/spotbugs/*.html -e "<b>[^0]</b>" | xargs -I '{}' cp '{}' ~/spotbugs-test
          when: always
      - store_artifacts:
          path: ~/spotbugs-test

  unit-test:
    environment:
      CC_TEST_REPORTER_ID: CC_TEST_REPORTER_ID
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: Setup Code Climate test-reporter
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - run:
          name: test
          command: |
            ./cc-test-reporter before-build
            ./gradlew -Penv=jenkins -b build.gradle test jacocoTestReport --info --stacktrace --parallel -x checkstyleMain -x checkstyleTest -x spotbugsMain -x spotbugsTest --no-daemon --max-workers 1
      - run:
          name: Set jacoco.xml path for code climate<commit_msg>RMP-12797 storing failed artifacts of checkstyle<commit_after>version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:10-jdk
    steps:
      - checkout
      - restore_cache:
          key: gradle-cache
      - run:
          name: build
          command: ./gradlew -Penv=jenkins -b build.gradle clean build --info --stacktrace --parallel -x test -x checkstyleMain -x checkstyleTest -x spotbugsMain -x spotbugsTest
      - run:
          name: check
          command: git status | grep "working tree clean"
      - save_cache:
          key: gradle-cache
          paths:
            - "~/.gradle"
      - persist_to_workspace:
          root: .
          paths:
            - core/build/libs/cloudbreak.jar
            - mock-caas/build/libs/mock-caas.jar
            - integration-test/build/libs/cloudbreak-integration-test.jar

  code-quality-check-checkstyle-test:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: checkstyle-test
          command: ./gradlew -Penv=jenkins -b build.gradle check -x spotbugsMain -x spotbugsTest -x checkstyleMain -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store checkstyle-test results
          command: |
            mkdir -p ~/checkstyle-test
            set +o pipefail
            grep -rls */build/reports/checkstyle/*.xml -e "<error line=" | xargs -I '{}' cp '{}' ~/checkstyle-test
          when: always
      - store_artifacts:
          path: ~/checkstyle-test

  code-quality-check-checkstyle-main:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: checkstyle-main
          command: ./gradlew -Penv=jenkins -b build.gradle check -x spotbugsMain -x spotbugsTest -x checkstyleTest -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store checkstyle results
          command: |
            mkdir -p ~/checkstyle
            set +o pipefail
            grep -rls */build/reports/checkstyle/*.xml -e "<error line=" | xargs -I '{}' cp '{}' ~/checkstyle
          when: always
      - store_artifacts:
          path: ~/checkstyle

  code-quality-check-spotbugs-main:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: spotbugs-main
          command: ./gradlew -Penv=jenkins -b build.gradle check -x checkstyleMain -x checkstyleTest -x spotbugsTest -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store spotbugs main results
          command: |
            mkdir -p ~/spotbugs-main
            set +o pipefail
            grep -rls */build/reports/spotbugs/*.html -e "<b>[^0]</b>" | xargs -I '{}' cp '{}' ~/spotbugs-main
          when: always
      - store_artifacts:
          path: ~/spotbugs-main

  code-quality-check-spotbugs-test:
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: spotbugs-test
          command: ./gradlew -Penv=jenkins -b build.gradle check -x checkstyleMain -x checkstyleTest -x spotbugsMain -x test --no-daemon --max-workers 1 --stacktrace
      - run:
          name: Store spotbugs test results
          command: |
            mkdir -p ~/spotbugs-test
            set +o pipefail
            grep -rls */build/reports/spotbugs/*.html -e "<b>[^0]</b>" | xargs -I '{}' cp '{}' ~/spotbugs-test
          when: always
      - store_artifacts:
          path: ~/spotbugs-test

  unit-test:
    environment:
      CC_TEST_REPORTER_ID: CC_TEST_REPORTER_ID
    docker:
      - image: circleci/openjdk:10-jdk
    environment:
      _JAVA_OPTIONS: "-Xmx2048m"
    steps:
      - checkout
      - attach_workspace:
          at: .
      - restore_cache:
          key: gradle-cache
      - run:
          name: Setup Code Climate test-reporter
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - run:
          name: test
          command: |
            ./cc-test-reporter before-build
            ./gradlew -Penv=jenkins -b build.gradle test jacocoTestReport --info --stacktrace --parallel -x checkstyleMain -x checkstyleTest -x spotbugsMain -x spotbugsTest --no-daemon --max-workers 1
      - run:
          name: Set jacoco.xml path for code climate
{'fraction_non_alphanumeric': 0.11201878893086899, 'fraction_numerical': 0.009088124170325743, 'mean_word_length': 1.6928787462194117, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4969391', 'n_tokens_mistral': 3272, 'n_tokens_neox': 3064, 'n_words': 730}