<commit_before>---
version: 2.1

executors:
  # Whenever the Go version is updated here, .travis.yml and .promu.yml
  # should also be updated.
  golang:
    docker:
    - image: circleci/golang:1.12

jobs:
  test:
    executor: golang

    steps:
    - checkout
    - run: make promu
    - run: make
    - run: git diff --exit-code
    - store_artifacts:
        path: consul_exporter
        destination: /build/prometheus
    - run: rm -v consul_exporter

  build:
    machine: true

    steps:
    - checkout
    - run: make promu
    - run: promu crossbuild -v
    - persist_to_workspace:
        root: .
        paths:
        - .build
    - store_artifacts:
        path: .build
        destination: /build

  docker_hub_master:
    executor: golang

    steps:
    - checkout
    - setup_remote_docker
    - attach_workspace:
        at: .
    - run: ln -s .build/linux-amd64/consul_exporter consul_exporter
    - run: make docker
    - run: make docker DOCKER_REPO=quay.io/prometheus
    - run: docker images
    - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
    - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
    - run: make docker-publish
    - run: make docker-publish DOCKER_REPO=quay.io/prometheus

  docker_hub_release_tags:
    executor: golang

    steps:
    - checkout
    - setup_remote_docker
    - attach_workspace:
        at: .
    - run: make promu
    - run: promu crossbuild tarballs
    - run: promu checksum .tarballs
    - run: promu release .tarballs
    - store_artifacts:
        path: .tarballs
        destination: releases
    - run: ln -s .build/linux-amd64/prometheus consul_exporter
    - run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
    - run: make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG DOCKER_REPO=quay.io/prometheus
    - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
    - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io
    - run: |
        if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
          make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG"
          make docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus
          make docker-publish DOCKER_IMAGE_TAG="latest"
          make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=quay.io/prometheus
        fi
    - run: make docker-publish DOCKER_IMAGE_TAG=latest
    - run: make docker-publish DOCKER_REPO=quay.io/prometheus DOCKER_IMAGE_TAG=latest

workflows:
  version: 2
  prometheus:
    jobs:
    - test:
        filters:
          tags:
            only: /.*/
    - build:
        filters:
          tags:
            only: /.*/
    - docker_hub_master:
        context: org-context
        requires:
        - test
        - build
        filters:
          branches:
            only: master
    - docker_hub_release_tags:
        context: org-context
        requires:
        - test<commit_msg>.circleci/config.yml: use prometheus/prometheus orb (#118)<commit_after>---
version: 2.1

orbs:
  prometheus: prometheus/prometheus@0.1.0

executors:
  # Whenever the Go version is updated here, .travis.yml and .promu.yml
  # should also be updated.
  golang:
    docker:
    - image: circleci/golang:1.12

jobs:
  test:
    executor: golang

    steps:
    - prometheus/setup_environment
    - run: make
    - run: git diff --exit-code
    - prometheus/store_artifact:
        file: consul_exporter

workflows:
  version: 2
  prometheus:
    jobs:
    - test:
        filters:
          tags:
            only: /.*/
    - prometheus/build:
        name: build
        filters:
          tags:
            only: /.*/
    - prometheus/publish_master:
        context: org-context
        requires:
        - test
        - build
        filters:
          branches:
            only: master
    - prometheus/publish_release:
        context: org-context
        requires:
        - test
{'fraction_non_alphanumeric': 0.0959257349149046, 'fraction_numerical': 0.006962351727694688, 'mean_word_length': 1.9610687022900763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1415822', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1296, 'n_words': 299}