<commit_before>format_version: 1.0.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
  envs:
  - BITRISE_BIN_NAME: bitrise
  - BITRISE_IO_GO_PATH: "$GOPATH/src/github.com/bitrise-io"
  - BITRISE_PATH: $BITRISE_IO_GO_PATH/bitrise
  - GITHUB_RELEASES_URL: https://github.com/bitrise-io/${BITRISE_BIN_NAME}/releases
  - INTERNAL_DEV_SLACK_WEBHOOK_URL: https://hooks.slack.com/services/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
  - INTERNAL_DEV_SLACK_CHANNEL: bitrise-devs
  - INTERNAL_DEV_LIFELINE_SLACK_CHANNEL: bitrise-dev-lifeline

trigger_map:
- pattern: "/release"
  is_pull_request_allowed: false
  workflow: create-release
- pattern: "/release/docker-compose"
  is_pull_request_allowed: false
  workflow: create-release-with-docker-compose
- pattern: "/release/announce"
  is_pull_request_allowed: false
  workflow: announce-release
- pattern: "*"
  is_pull_request_allowed: true
  workflow: ci

workflows:
  _prepare_and_setup:
    steps:
    - git-clone:
        title: Git Clone bitrise
        inputs:
        - clone_into_dir: $BITRISE_PATH
          opts:
            is_expand: true
    - change-workdir:
        run_if: ".IsCI"
        title: cd to bitrise go path
        inputs:
        - path: $BITRISE_PATH
    - script:
        title: Install required testing tools
        run_if: ".IsCI"
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            brew update

            # Install dependencies
            go get -u github.com/tools/godep

            # Check for unhandled errors
            go get -u github.com/kisielk/errcheck

            # Go lint
            go get -u github.com/golang/lint/golint

  test_and_install:
    before_run:
    - test
    steps:
    - script:
        title: Go install
        inputs:
        - content: go install

  test:
    steps:
    - script:
        title: GOPATH patch
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            envman add --key ORIG_GOPATH --value "$GOPATH"
            envman add --key GOPATH --value "$(godep path):$GOPATH"
    - script:
        title: Err check
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            errcheck -asserts=true -blank=true $(godep go list ./...)
    - script:
        title: Go Lint
        inputs:
        - content: |-
            #!/bin/bash
            set -e

            golint_out="$(golint ./...)"
            if [[ "${golint_out}" != "" ]] ; then
              echo "=> Golint issues found:"
              echo "${golint_out}"
              exit 1
            fi
    - script:
        title: Go Test
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            godep go test ./...
    - script:
        title: Test-build
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v
            mkdir -p ./_tmp
            go build -o ./_tmp/ci-bin
            ./_tmp/ci-bin setup --minimal
            rm ./_tmp/ci-bin

            # setup for the original bitrise as well
            bitrise setup --minimal
    - script:
        title: revert GOPATH patch
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            envman add --key GOPATH --value "$ORIG_GOPATH"
    - script:
        title: Step-template test
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            cd ./_step_template
            bitrise run test

  ci:
    before_run:
    - _prepare_and_setup
    - test
    steps:
    - slack:
        title: Slack notifications
        run_if: ".IsCI"
        inputs:
        - webhook_url: "$INTERNAL_DEV_SLACK_WEBHOOK_URL"
        - channel: "$INTERNAL_DEV_LIFELINE_SLACK_CHANNEL"
        - from_username: "${BITRISE_BIN_NAME} - CI - OK"
        - from_username_on_error: "${BITRISE_BIN_NAME} - CI - ERROR"
        - message: |-
            CI was successful on branch: *${BITRISE_GIT_BRANCH}*

            Build URL: ${BITRISE_BUILD_URL}
        - message_on_error: |-
            CI FAILED on branch: *${BITRISE_GIT_BRANCH}*

            Build URL: ${BITRISE_BUILD_URL}

  godeps-update:
    description: |-
      Dependenci Update

      Used for updating bitrise dependencies with godep
    steps:
    - script:
        title: Dependency update
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            go get -u ./...
            rm -rf ./Godeps
            godep save ./...

  create-release-with-docker-compose:
    steps:
    - script:
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v<commit_msg>typo in bitrise.yml workflow description<commit_after>format_version: 1.0.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
  envs:
  - BITRISE_BIN_NAME: bitrise
  - BITRISE_IO_GO_PATH: "$GOPATH/src/github.com/bitrise-io"
  - BITRISE_PATH: $BITRISE_IO_GO_PATH/bitrise
  - GITHUB_RELEASES_URL: https://github.com/bitrise-io/${BITRISE_BIN_NAME}/releases
  - INTERNAL_DEV_SLACK_WEBHOOK_URL: https://hooks.slack.com/services/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
  - INTERNAL_DEV_SLACK_CHANNEL: bitrise-devs
  - INTERNAL_DEV_LIFELINE_SLACK_CHANNEL: bitrise-dev-lifeline

trigger_map:
- pattern: "/release"
  is_pull_request_allowed: false
  workflow: create-release
- pattern: "/release/docker-compose"
  is_pull_request_allowed: false
  workflow: create-release-with-docker-compose
- pattern: "/release/announce"
  is_pull_request_allowed: false
  workflow: announce-release
- pattern: "*"
  is_pull_request_allowed: true
  workflow: ci

workflows:
  _prepare_and_setup:
    steps:
    - git-clone:
        title: Git Clone bitrise
        inputs:
        - clone_into_dir: $BITRISE_PATH
          opts:
            is_expand: true
    - change-workdir:
        run_if: ".IsCI"
        title: cd to bitrise go path
        inputs:
        - path: $BITRISE_PATH
    - script:
        title: Install required testing tools
        run_if: ".IsCI"
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            brew update

            # Install dependencies
            go get -u github.com/tools/godep

            # Check for unhandled errors
            go get -u github.com/kisielk/errcheck

            # Go lint
            go get -u github.com/golang/lint/golint

  test_and_install:
    before_run:
    - test
    steps:
    - script:
        title: Go install
        inputs:
        - content: go install

  test:
    steps:
    - script:
        title: GOPATH patch
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            envman add --key ORIG_GOPATH --value "$GOPATH"
            envman add --key GOPATH --value "$(godep path):$GOPATH"
    - script:
        title: Err check
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            errcheck -asserts=true -blank=true $(godep go list ./...)
    - script:
        title: Go Lint
        inputs:
        - content: |-
            #!/bin/bash
            set -e

            golint_out="$(golint ./...)"
            if [[ "${golint_out}" != "" ]] ; then
              echo "=> Golint issues found:"
              echo "${golint_out}"
              exit 1
            fi
    - script:
        title: Go Test
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            godep go test ./...
    - script:
        title: Test-build
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v
            mkdir -p ./_tmp
            go build -o ./_tmp/ci-bin
            ./_tmp/ci-bin setup --minimal
            rm ./_tmp/ci-bin

            # setup for the original bitrise as well
            bitrise setup --minimal
    - script:
        title: revert GOPATH patch
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            envman add --key GOPATH --value "$ORIG_GOPATH"
    - script:
        title: Step-template test
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            cd ./_step_template
            bitrise run test

  ci:
    before_run:
    - _prepare_and_setup
    - test
    steps:
    - slack:
        title: Slack notifications
        run_if: ".IsCI"
        inputs:
        - webhook_url: "$INTERNAL_DEV_SLACK_WEBHOOK_URL"
        - channel: "$INTERNAL_DEV_LIFELINE_SLACK_CHANNEL"
        - from_username: "${BITRISE_BIN_NAME} - CI - OK"
        - from_username_on_error: "${BITRISE_BIN_NAME} - CI - ERROR"
        - message: |-
            CI was successful on branch: *${BITRISE_GIT_BRANCH}*

            Build URL: ${BITRISE_BUILD_URL}
        - message_on_error: |-
            CI FAILED on branch: *${BITRISE_GIT_BRANCH}*

            Build URL: ${BITRISE_BUILD_URL}

  godeps-update:
    description: |-
      Dependency Update

      Used for updating bitrise dependencies with godep
    steps:
    - script:
        title: Dependency update
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v

            go get -u ./...
            rm -rf ./Godeps
            godep save ./...

  create-release-with-docker-compose:
    steps:
    - script:
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -v
{'fraction_non_alphanumeric': 0.10198620973551507, 'fraction_numerical': 0.003704847175054029, 'mean_word_length': 1.410218253968254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, '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': '7074406', 'n_tokens_mistral': 3223, 'n_tokens_neox': 3070, 'n_words': 699}