<commit_before>version: 2

workflows:
  version: 2
  build:
    jobs:
      - install
      - lint:
          requires:
            - install
      - build:
          requires:
            - install
      - deploy:
          requires:
            - install
            - lint
            - build
          filters:
            branches:
              only:
                - master
                - dev

jobs:
  install:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - checkout:
          path: ~/stockflux
      - run:
          name: Root package install
          command: npm ci
      - save_cache:
          key: deps-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules

  lint:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - checkout:
          path: ~/stockflux
      - restore_cache:
          key: deps-{{ checksum "package-lock.json" }}
      - run:
          name: Lint *.js files
          command: npm run lint

  build:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - checkout:
          path: ~/stockflux
      - restore_cache:
          key: deps-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Bitflux Cache
          command: cd ~/stockflux/packages/stockflux-bitflux
      - restore_cache:
          key: deps-bitflux-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Chart Cache
          command: cd ~/stockflux/packages/stockflux-chart
      - restore_cache:
          key: deps-chart-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Components Cache
          command: cd ~/stockflux/packages/stockflux-components
      - restore_cache:
          key: deps-components-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Container Cache
          command: cd ~/stockflux/packages/stockflux-container
      - restore_cache:
          key: deps-container-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Core Cache
          command: cd ~/stockflux/packages/stockflux-core
      - restore_cache:
          key: deps-core-{{ checksum "package-lock.json" }}
      - run:
          name: Restore Launcher Cache
          command: cd ~/stockflux/packages/stockflux-launcher
      - restore_cache:
          key: deps-launcher-{{ checksum "package-lock.json" }}
      - run:
          name: Restore News Cache
          command: cd ~/stockflux/packages/stockflux-news
      - restore_cache:
          key: deps-news-{{ checksum "package-lock.json" }}
      - run:
          name: Bootstrap Packages
          command: npm run bootstrap
      - run:
          name: Build Packages
          command: npm run build
      - run:
          name: Save Bitflux Cache
          command: cd ~/stockflux/packages/stockflux-bitflux
      - save_cache:
          key: deps-bitflux-{{ checksum "package-lock.json" }}
          paths: ./node_modules
      - run:
          name: Save Chart Cache
          command: cd ~/stockflux/packages/stockflux-chart
      - save_cache:
          key: deps-chart-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save Components Cache
          command: cd ~/stockflux/packages/stockflux-components
      - save_cache:
          key: deps-components-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save Container Cache
          command: cd ~/stockflux/packages/stockflux-container
      - save_cache:
          key: deps-container-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save Core Cache
          command: cd ~/stockflux/packages/stockflux-core
      - save_cache:
          key: deps-core-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save Launcher Cache
          command: cd ~/stockflux/packages/stockflux-launcher
      - save_cache:
          key: deps-launcher-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save News Cache
          command: cd ~/stockflux/packages/stockflux-news
      - save_cache:
          key: deps-news-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - run:
          name: Save Watchlist Cache
          command: cd ~/stockflux/packages/stockflux-watchlist
      - save_cache:
          key: deps-watchlist-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules
      - persist_to_workspace:
          root: ~/stockflux
          paths: .

  deploy:
    working_directory: ~/stockflux
    docker:
      - image: circleci/python:3.7.2
    steps:
      - attach_workspace:
          at: ~/stockflux
      - add_ssh_keys:
          fingerprints:
            - 'e1:6c:ab:38:9e:8f:ed:f1:60:4a:c7:b1:23:33:0c:07'
            - 'fdf8:f53e:61e4::18:63:1b:56:4d:eb:df:a6:48' # GitHub RSA
            - 'ad:1c:08:a4:40:e3:6f:9c:f5:66:26:5d:4b:33:5d:8c' # GitHub DSA
      - run:
          name: Add GitHub SSH fingerprints to known hosts
          command: |
            # https://serverfault.com/questions/447028/non-interactive-git-clone-ssh-fingerprint-prompt
            # Grabbed GitHub's public key by running ssh-keyscan github.com
            # locally and directing it to the github_key file. Adding this key
            # to known hosts (creating it if it doesn't exist) prevents the
            # prompt that warns about the authenticity of the host when trying
            # to push tags, that causes the build to hang until it times out.
            cd ~/stockflux/.circleci
            mkdir -p ~/.ssh
            touch ~/.ssh/known_hosts
            echo $(cat github_key) >> ~/.ssh/known_hosts
      - run:
          name: Determine version<commit_msg>Remove caching from circleci config<commit_after>version: 2

workflows:
  version: 2
  build:
    jobs:
      - install
      - lint:
          requires:
            - install
      - build:
          requires:
            - install
      - deploy:
          requires:
            - install
            - lint
            - build
          filters:
            branches:
              only:
                - master
                - dev

jobs:
  install:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - checkout:
          path: ~/stockflux
      - run:
          name: Root package install
          command: npm ci
      - persist_to_workspace:
          root: ~/stockflux
          paths: .

  lint:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - attach_workspace:
          at: ~/stockflux
      - run:
          name: Lint *.js files
          command: npm run lint

  build:
    working_directory: ~/stockflux
    docker:
      - image: circleci/node:10.15.1
    steps:
      - attach_workspace:
          at: ~/stockflux
      - run:
          name: Bootstrap Packages
          command: npm run bootstrap
      - run:
          name: Build Packages
          command: npm run build
      - persist_to_workspace:
          root: ~/stockflux
          paths: .

  deploy:
    working_directory: ~/stockflux
    docker:
      - image: circleci/python:3.7.2
    steps:
      - attach_workspace:
          at: ~/stockflux
      - add_ssh_keys:
          fingerprints:
            - 'fdf8:f53e:61e4::18:60:4a:c7:b1:23:33:0c:07'
            - '16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48' # GitHub RSA
            - 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:f5:66:26:5d:4b:33:5d:8c' # GitHub DSA
      - run:
          name: Add GitHub SSH fingerprints to known hosts
          command: |
            # https://serverfault.com/questions/447028/non-interactive-git-clone-ssh-fingerprint-prompt
            # Grabbed GitHub's public key by running ssh-keyscan github.com
            # locally and directing it to the github_key file. Adding this key
            # to known hosts (creating it if it doesn't exist) prevents the
            # prompt that warns about the authenticity of the host when trying
            # to push tags, that causes the build to hang until it times out.
            cd ~/stockflux/.circleci
            mkdir -p ~/.ssh
            touch ~/.ssh/known_hosts
            echo $(cat github_key) >> ~/.ssh/known_hosts
      - run:
          name: Determine version
{'fraction_non_alphanumeric': 0.10180890538033395, 'fraction_numerical': 0.020756029684601114, 'mean_word_length': 1.560106856634016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3057053', 'n_tokens_mistral': 2797, 'n_tokens_neox': 2568, 'n_words': 617}