<commit_before>
version: 2

jobs:
  test:
    docker:
      - image: circleci/node:latest

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: npm test
  deploy:
    docker:
      - image: circleci/node:latest
    steps:
      - add_ssh_keys:
          fingerprints:
            - "73:b7:b4:63:6a:82:76:02:ae:41:8f:80:5e:ca:01:8f"
      - run: ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "bash --login -c 'cd /var/www/spacexdata.com/SpaceX-API && git checkout master --force && git pull --force && npm install --production && pm2 reload spacex-api'"

workflows:
  version: 2
  build-test-and-deploy:
    jobs:
      - test
      - deploy:
          requires:<commit_msg>make sure deploy workflow only occurs for master branch builds<commit_after>
version: 2

jobs:
  test:
    docker:
      - image: circleci/node:latest

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: npm test
  deploy:
    branches:
      only: master
    docker:
      - image: circleci/node:latest
    steps:
      - add_ssh_keys:
          fingerprints:
            - "73:b7:b4:63:6a:82:76:02:ae:41:8f:80:5e:ca:01:8f"
      - run: ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "bash --login -c 'cd /var/www/spacexdata.com/SpaceX-API && git checkout master --force && git pull --force && npm install --production && pm2 reload spacex-api'"

workflows:
  version: 2
  build-test-and-deploy:
    jobs:
      - test
      - deploy:
          requires:
{'fraction_non_alphanumeric': 0.11169744942832015, 'fraction_numerical': 0.024626209322779244, 'mean_word_length': 1.981651376146789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2806628', 'n_tokens_mistral': 784, 'n_tokens_neox': 719, 'n_words': 183}