<commit_before>####################
# Templates
####################

scala_211_version: &scala_211_version 2.11.12
scala_212_version: &scala_212_version 2.12.6

common_settings: &common_settings
  docker:
    - image: circleci/openjdk:8-jdk
      environment:
        GOOGLE_APPLICATION_CREDENTIALS: scripts/data-integration-test.json
  working_directory: ~/scio
  resource_class: xlarge

restore_cache_settings: &restore_cache_settings
  keys:
    - scio-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ checksum "build.sbt" }}
    - scio-{{ .Environment.CIRCLE_JOB }}-

save_cache_settings: &save_cache_settings
  key: scio-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ checksum "build.sbt" }}
  paths:
    - ~/.ivy2
    - ~/.sbt
    - ~/resolution-cache.tar.gz
    - ~/stream.tar.gz

build_settings: &build_settings
  <<: *common_settings
  steps:
    - checkout
    - restore_cache: *restore_cache_settings
    - run: if [ "$CIRCLE_BRANCH" == "beam-master" ]; then ./scripts/circleci_snapshot.sh; fi
    - run:
        name: Unpacking sbt cache
        command: |
          find ~ -maxdepth 1 -name "*.tar.gz"
          if [ -f ~/resolution-cache.tar.gz ]; then tar xzf ~/resolution-cache.tar.gz; fi
          if [ -f ~/stream.tar.gz ]; then tar xzf ~/stream.tar.gz; fi
    - run: ./scripts/circleci_test.sh
    - run: ./scripts/circleci_repl.sh
    - run:
        name: Packing sbt cache
        command: |
          find ~/.sbt -name "*.lock" -delete
          find ~/.ivy2 -name "ivydata-*.properties" -delete
          tar czf ~/resolution-cache.tar.gz $(find . -type d -name resolution-cache)
          tar czf ~/stream.tar.gz $(find . -type d -path "*/target/streams")
          find ~ -maxdepth 1 -name "*.tar.gz"
    - run: if [ $SCOVERAGE -eq 1 ]; then bash <(curl -s https://codecov.io/bash); fi
    - save_cache: *save_cache_settings

publish_settings: &publish_settings
  <<: *common_settings
  steps:
    - checkout
    - restore_cache: *restore_cache_settings
    - run: ./scripts/circleci_publish.sh
    - run: sbt ++$SCALA_VERSION publish

####################
# Jobs
####################

version: 2
jobs:
  build_211:
    <<: *build_settings
    environment:
      - SCALA_VERSION: *scala_211_version
      - SCOVERAGE: 0

  build_212:
    <<: *build_settings
    environment:
      - SCALA_VERSION: *scala_212_version
      - SCOVERAGE: 1

  deploy:
    # Workaround for sbt-assembly hitting Docker aufs file name length limit
    # https://github.com/sbt/sbt-assembly/issues/69
    machine: true
    working_directory: ~/scio
    environment:
      - SCALA_VERSION: *scala_211_version
    steps:
      - checkout
      - restore_cache:
          keys:
            - scio-build_211-{{ .Branch }}-{{ checksum "build.sbt" }}
            - scio-build_211-
      - run: sbt ++$SCALA_VERSION scio-repl/assembly
      - run: go get -u github.com/tcnksm/ghr
      - run: ghr -u spotify -draft $CIRCLE_TAG scio-repl/target/scala-*/scio-repl-*.jar

  publish_211:
    <<: *publish_settings
    environment:
      - SCALA_VERSION: *scala_211_version

  publish_212:
    <<: *publish_settings
    environment:
      - SCALA_VERSION: *scala_212_version

  bench:
    <<: *common_settings
    steps:
      - checkout
      - restore_cache: *restore_cache_settings
      - run:
          command: ./scripts/circleci_bench.sh
          no_output_timeout: 30m
    environment:
      - SCALA_VERSION: *scala_212_version

####################
# Workflows
####################

workflows:<commit_msg>save cache in CircleCI bench builds<commit_after>####################
# Templates
####################

scala_211_version: &scala_211_version 2.11.12
scala_212_version: &scala_212_version 2.12.6

common_settings: &common_settings
  docker:
    - image: circleci/openjdk:8-jdk
      environment:
        GOOGLE_APPLICATION_CREDENTIALS: scripts/data-integration-test.json
  working_directory: ~/scio
  resource_class: xlarge

restore_cache_settings: &restore_cache_settings
  keys:
    - scio-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ checksum "build.sbt" }}
    - scio-{{ .Environment.CIRCLE_JOB }}-

save_cache_settings: &save_cache_settings
  key: scio-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ checksum "build.sbt" }}
  paths:
    - ~/.ivy2
    - ~/.sbt
    - ~/resolution-cache.tar.gz
    - ~/stream.tar.gz

build_settings: &build_settings
  <<: *common_settings
  steps:
    - checkout
    - restore_cache: *restore_cache_settings
    - run: if [ "$CIRCLE_BRANCH" == "beam-master" ]; then ./scripts/circleci_snapshot.sh; fi
    - run:
        name: Unpacking sbt cache
        command: |
          find ~ -maxdepth 1 -name "*.tar.gz"
          if [ -f ~/resolution-cache.tar.gz ]; then tar xzf ~/resolution-cache.tar.gz; fi
          if [ -f ~/stream.tar.gz ]; then tar xzf ~/stream.tar.gz; fi
    - run: ./scripts/circleci_test.sh
    - run: ./scripts/circleci_repl.sh
    - run:
        name: Packing sbt cache
        command: |
          find ~/.sbt -name "*.lock" -delete
          find ~/.ivy2 -name "ivydata-*.properties" -delete
          tar czf ~/resolution-cache.tar.gz $(find . -type d -name resolution-cache)
          tar czf ~/stream.tar.gz $(find . -type d -path "*/target/streams")
          find ~ -maxdepth 1 -name "*.tar.gz"
    - run: if [ $SCOVERAGE -eq 1 ]; then bash <(curl -s https://codecov.io/bash); fi
    - save_cache: *save_cache_settings

publish_settings: &publish_settings
  <<: *common_settings
  steps:
    - checkout
    - restore_cache: *restore_cache_settings
    - run: ./scripts/circleci_publish.sh
    - run: sbt ++$SCALA_VERSION publish

####################
# Jobs
####################

version: 2
jobs:
  build_211:
    <<: *build_settings
    environment:
      - SCALA_VERSION: *scala_211_version
      - SCOVERAGE: 0

  build_212:
    <<: *build_settings
    environment:
      - SCALA_VERSION: *scala_212_version
      - SCOVERAGE: 1

  deploy:
    # Workaround for sbt-assembly hitting Docker aufs file name length limit
    # https://github.com/sbt/sbt-assembly/issues/69
    machine: true
    working_directory: ~/scio
    environment:
      - SCALA_VERSION: *scala_211_version
    steps:
      - checkout
      - restore_cache:
          keys:
            - scio-build_211-{{ .Branch }}-{{ checksum "build.sbt" }}
            - scio-build_211-
      - run: sbt ++$SCALA_VERSION scio-repl/assembly
      - run: go get -u github.com/tcnksm/ghr
      - run: ghr -u spotify -draft $CIRCLE_TAG scio-repl/target/scala-*/scio-repl-*.jar

  publish_211:
    <<: *publish_settings
    environment:
      - SCALA_VERSION: *scala_211_version

  publish_212:
    <<: *publish_settings
    environment:
      - SCALA_VERSION: *scala_212_version

  bench:
    <<: *common_settings
    steps:
      - checkout
      - restore_cache: *restore_cache_settings
      - run:
          command: ./scripts/circleci_bench.sh
          no_output_timeout: 30m
      - save_cache: *save_cache_settings
    environment:
      - SCALA_VERSION: *scala_212_version

####################
# Workflows
####################

workflows:
{'fraction_non_alphanumeric': 0.15627209729882618, 'fraction_numerical': 0.019799179748267573, 'mean_word_length': 2.5898477157360404, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '71709', 'n_tokens_mistral': 2578, 'n_tokens_neox': 2415, 'n_words': 484}