<commit_before>version: 2

jobs:
  install_deps:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}
            - v1-

      # Install dependencies and build the plugin and library.
      - run: |
          mkdir -p ~/bin
          curl -fsSLo ~/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh
          chmod +x ~/bin/boot
      - run: cd library && lein deps
      - run: cd library && npm install
      - run: cd library && lein install
      - run: cd plugin && lein deps
      - run: cd plugin && lein install
      - run: cd example && npm install
      - run: cd example && lein deps
      - run: cd example && ~/bin/boot deps

      - save_cache:
          paths:
            - ~/.m2
            - ~/doo/library/node_modules
            - ~/doo/example/node_modules
            - ~/.boot/cache/bin
            - ~/.boot/cache/lib
          key: v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}

  test_lib_and_plugin:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}
            - v1-
      - run: sudo apt-get update && sudo apt-get install -y phantomjs rhino
      - run: sudo npm install karma-cli -g
      - run: cd library && lein test
      - run: cd plugin && lein test

  test_example:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    parallelism: 4
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}
            - v1-
      - run: sudo apt-get update && sudo apt-get install -y phantomjs rhino
      - run: sudo npm install karma-cli -g
      - run:
          name: "Install Bats"
          command: |
            git clone https://github.com/sstephenson/bats.git ~/bats
            cd ~/bats
            sudo ./install.sh /usr/local
      - run:
          name: "Run tests"
          command: |
            cd example
            export PATH="$HOME/bin:$PATH"
            mkdir -p ~/test-results/example
            TESTS=$(circleci tests glob test/bats/*.bats | circleci tests split)
            bats --tap $TESTS | tee ~/test-results/example/results.tap
      - run:
          name: Format the test results
          when: always
          command: |
            sudo apt-get install -y libtap-formatter-junit-perl
            cd ~/test-results/example && tap2junit results.tap
      - store_test_results:
          path: ~/test-results

workflows:
  version: 2
  test:<commit_msg>Circle: Always install the plugin and the library<commit_after>version: 2

jobs:
  install_deps:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}
            - v1-

      # Install dependencies and build the plugin and library.
      - run: |
          mkdir -p ~/bin
          curl -fsSLo ~/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh
          chmod +x ~/bin/boot
      - run: cd library && lein deps
      - run: cd library && npm install
      - run: cd library && lein install
      - run: cd plugin && lein deps
      - run: cd plugin && lein install
      - run: cd example && npm install
      - run: cd example && lein deps
      - run: cd example && ~/bin/boot deps

      - save_cache:
          paths:
            - ~/.m2
            - ~/doo/library/node_modules
            - ~/doo/example/node_modules
            - ~/.boot/cache/bin
            - ~/.boot/cache/lib
          key: v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}

  test_lib_and_plugin:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}-{{ checksum "library/package.json" }}
            - v1-
      - run: sudo apt-get update && sudo apt-get install -y phantomjs rhino
      - run: sudo npm install karma-cli -g
      - run: cd library && lein test && lein install
      - run: cd plugin && lein test

  test_example:
    docker:
      - image: circleci/clojure:lein-2.8.1-node-browsers
    working_directory: ~/doo
    parallelism: 4
    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: "-Xmx3200m"
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-{{ checksum "library/project.clj" }}-{{ checksum "plugin/project.clj" }}-{{ checksum "example/package.json" }}-{{ checksum "library/package.json" }}
            - v1-
      - run: sudo apt-get update && sudo apt-get install -y phantomjs rhino
      - run: sudo npm install karma-cli -g
      - run:
          name: "Install Bats"
          command: |
            git clone https://github.com/sstephenson/bats.git ~/bats
            cd ~/bats
            sudo ./install.sh /usr/local
      # The ~/.m2 cache might not have the latest lib and plugin because it only
      # changes when the project.clj checksums change!
      - run:
          name: "Install Doo library and plugin"
          command: |
            (cd library && lein install)
            (cd plugin && lein install)
      - run:
          name: "Run tests"
          command: |
            cd example
            export PATH="$HOME/bin:$PATH"
            mkdir -p ~/test-results/example
            TESTS=$(circleci tests glob test/bats/*.bats | circleci tests split)
            bats --tap $TESTS | tee ~/test-results/example/results.tap
      - run:
          name: Format the test results
          when: always
          command: |
            sudo apt-get install -y libtap-formatter-junit-perl
            cd ~/test-results/example && tap2junit results.tap
      - store_test_results:
          path: ~/test-results

workflows:
  version: 2
  test:
{'fraction_non_alphanumeric': 0.12496429591545273, 'fraction_numerical': 0.009568694658668952, 'mean_word_length': 1.7451979615836926, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6302278', 'n_tokens_mistral': 2339, 'n_tokens_neox': 2233, 'n_words': 554}