<commit_before># Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
defaults: &defaults
  working_directory: ~/repo
  environment:
    - DATABASE_URL=postgres://root@127.0.0.1:5432/circle_test


cache_keys:
  python_cache: &python_cache
    key: dependencies-v1-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/base.txt" }}
    paths:
      - venv
  node_cache: &node_cache
    key: dependencies-v1-{{ checksum "package-lock.json" }}
    paths:
      - node_modules
      - ~/.npm

version: 2
jobs:
  bundle_assets:
    <<: *defaults
    docker:
      - image: circleci/node:8.9

    steps:
      - checkout

      - restore_cache:
          name: Restore NPM cache
          <<: *node_cache

      - run:
          name: Install NPM packages
          command: npm install --no-optional

      - save_cache:
          name: Save NPM cache
          <<: *node_cache

      - run:
          name: Build assets
          command: ./node_modules/.bin/webpack

      - run:
          name: Copy asset bundles to workspace
          command: |
            mkdir -p /tmp/workspace
            cp -r assets/bundles /tmp/workspace
            cp -r webpack-stats.json /tmp/workspace

      - persist_to_workspace:
          root: /tmp/workspace
          paths:
            - bundles
            - webpack-stats.json

  python_tests:
    <<: *defaults
    docker:
      - image: circleci/python:3.6.1
      - image: circleci/postgres:9.6.2

    steps:
      - checkout

      - restore_cache:
          name: Restore python cache
          <<: *python_cache

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements/dev.txt
            cp env.json{.sample,} || /bin/true

      - save_cache:
          name: Save python cache
          <<: *python_cache

      - attach_workspace:
          at: /tmp/workspace

      - run:
          name: Copy bundles from workspace
          command: |
            cp -r /tmp/workspace/bundles assets
            cp /tmp/workspace/webpack-stats.json .

      - run:
          name: run tests
          command: |
            . venv/bin/activate
            py.test --cov --cov-report term --cov-report xml --cov-report html

      - run:
          name: Upload coverage to Codacy
          command: |
            . venv/bin/activate
            python-codacy-coverage -r coverage.xml

      - store_artifacts:
          path: coverage_html_report
          destination: test-reports
workflows:
  version: 2
  test:
    jobs:
      - bundle_assets
      - python_tests:
          requires:
            - bundle_assets<commit_msg>Remove webpack asset bundling from CircleCI<commit_after># Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
defaults: &defaults
  working_directory: ~/repo
  environment:
    - DATABASE_URL=postgres://root@127.0.0.1:5432/circle_test


cache_keys:
  python_cache: &python_cache
    key: dependencies-v1-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/base.txt" }}
    paths:
      - venv

version: 2
jobs:
  python_tests:
    <<: *defaults
    docker:
      - image: circleci/python:3.6.1
      - image: circleci/postgres:9.6.2

    steps:
      - checkout

      - restore_cache:
          name: Restore python cache
          <<: *python_cache

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements/dev.txt
            cp env.json{.sample,} || /bin/true

      - save_cache:
          name: Save python cache
          <<: *python_cache

      - run:
          name: Build assets
          command: |
            . venv/bin/activate
            ./manage.py assets build

      - run:
          name: run tests
          command: |
            . venv/bin/activate
            py.test --cov --cov-report term --cov-report xml --cov-report html

      - run:
          name: Upload coverage to Codacy
          command: |
            . venv/bin/activate
            python-codacy-coverage -r coverage.xml

      - store_artifacts:
          path: coverage_html_report
          destination: test-reports

workflows:
  version: 2
  test:
    jobs:
      - python_tests
{'fraction_non_alphanumeric': 0.09993217273343884, 'fraction_numerical': 0.01153063531539679, 'mean_word_length': 1.6131128174837566, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 2, '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': '4398443', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1304, 'n_words': 310}