<commit_before>version: 2

jobs:

  lint:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          command: docker version
      - run:
          name: "Lint"
          command: |
            dockerfile=dockerfiles/Dockerfile.lint
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-linter:$CIRCLE_BUILD_NUM .
            docker run --rm cli-linter:$CIRCLE_BUILD_NUM

  cross:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    parallelism: 3
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Cross"
          command: |
            dockerfile=dockerfiles/Dockerfile.cross
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
            name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
            docker run \
                -e CROSS_GROUP=$CIRCLE_NODE_INDEX \
                --name $name cli-builder:$CIRCLE_BUILD_NUM \
                make cross
            docker cp \
                $name:/go/src/github.com/docker/cli/build \
                /work/build
      - store_artifacts:
          path: /work/build

  test:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Unit Test with Coverage"
          command: |
            dockerfile=dockerfiles/Dockerfile.dev
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
            docker run --name \
                test-$CIRCLE_BUILD_NUM cli-builder:$CIRCLE_BUILD_NUM \
                make test-coverage

      - run:
          name: "Upload to Codecov"
          command: |
            docker cp \
                test-$CIRCLE_BUILD_NUM:/go/src/github.com/docker/cli/coverage.txt \
                coverage.txt
            apk add -U bash curl
            curl -s https://codecov.io/bash | bash

  validate:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - run: apk add -U git openssh
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Validate Vendor, Docs, and Code Generation"
          command: |
            dockerfile=dockerfiles/Dockerfile.dev
            echo "COPY . ." >> $dockerfile
            rm -f .dockerignore # include .git
            docker build -f $dockerfile --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
            docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
                make -B vendor compose-jsonschema manpages yamldocs
  shellcheck:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: "Run shellcheck"
          command: |
            dockerfile=dockerfiles/Dockerfile.validate
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-validator:$CIRCLE_BUILD_NUM .
            docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
                make -B shellcheck
workflows:
  version: 2
  ci:
    jobs:
      - lint
      - cross
      - test
      - validate
      - shellcheck<commit_msg>Update dockerfile path for CicleCI build<commit_after>version: 2

jobs:

  lint:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          command: docker version
      - run:
          name: "Lint"
          command: |
            dockerfile=dockerfiles/Dockerfile.lint
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-linter:$CIRCLE_BUILD_NUM .
            docker run --rm cli-linter:$CIRCLE_BUILD_NUM

  cross:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    parallelism: 3
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Cross"
          command: |
            dockerfile=dockerfiles/Dockerfile.cross
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
            name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
            docker run \
                -e CROSS_GROUP=$CIRCLE_NODE_INDEX \
                --name $name cli-builder:$CIRCLE_BUILD_NUM \
                make cross
            docker cp \
                $name:/go/src/github.com/docker/cli/build \
                /work/build
      - store_artifacts:
          path: /work/build

  test:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Unit Test with Coverage"
          command: |
            dockerfile=dockerfiles/Dockerfile.dev
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
            docker run --name \
                test-$CIRCLE_BUILD_NUM cli-builder:$CIRCLE_BUILD_NUM \
                make test-coverage

      - run:
          name: "Upload to Codecov"
          command: |
            docker cp \
                test-$CIRCLE_BUILD_NUM:/go/src/github.com/docker/cli/coverage.txt \
                coverage.txt
            apk add -U bash curl
            curl -s https://codecov.io/bash | bash

  validate:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - run: apk add -U git openssh
      - checkout
      - setup_remote_docker:
            reusable: true
            exclusive: false
      - run:
          name: "Validate Vendor, Docs, and Code Generation"
          command: |
            dockerfile=dockerfiles/Dockerfile.dev
            echo "COPY . ." >> $dockerfile
            rm -f .dockerignore # include .git
            docker build -f $dockerfile --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
            docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
                make -B vendor compose-jsonschema manpages yamldocs
  shellcheck:
    working_directory: /work
    docker: [{image: 'docker:17.05-git'}]
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: "Run shellcheck"
          command: |
            dockerfile=dockerfiles/Dockerfile.shellcheck
            echo "COPY . ." >> $dockerfile
            docker build -f $dockerfile --tag cli-validator:$CIRCLE_BUILD_NUM .
            docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
                make -B shellcheck
workflows:
  version: 2
  ci:
    jobs:
      - lint
      - cross
      - test
      - validate
      - shellcheck
{'fraction_non_alphanumeric': 0.09696800335336035, 'fraction_numerical': 0.00642727399748498, 'mean_word_length': 1.5419034090909092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '1108795', 'n_tokens_mistral': 2309, 'n_tokens_neox': 2095, 'n_words': 472}