<commit_before># Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2

test_steps:  &test_steps
    steps:
        - checkout

        - restore_cache:
              keys:
                  - v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

        - run:
              name: setup venv
              command: |
                  python3 -m venv --copies venv
                  . venv/bin/activate
                  python3 -m pip install -U wheel pip pytest pytest-cov pycodestyle codecov

        - run:
              name: install fuckery
              command: |
                  . venv/bin/activate
                  python3 -m pip install -e .

        - save_cache:
              paths:
                  - ./venv
              key: v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

        - run:
              name: syntax
              command: |
                  . venv/bin/activate
                  if [ -n "${RUN_SYNTAX}" ]; then pycodestyle --max-line-length=120 --select E111,E101,E201,E202,E203,E221,E222,E223,E224,E225,E226,E227,E228,E231,E241,E242,E251,E303,E304,E502,E711,E712,E713,E714,E721,E741,E742,E743,W191,W291,W293,W292,W391,W602,W603 src/fuckery; fi;

        - run:
              name: run tests
              command: |
                  . venv/bin/activate
                  mkdir test-reports
                  circleci tests glob tests/test_*.py | circleci tests split --split-by=timings | xargs python -m pytest -v -s -rs --durations 6 --maxfail 6 -p no:logging --junitxml=test-reports/junit.xml ${COVERAGE_ARGS}

        - run:
              name: report coverage
              command: |
                  . venv/bin/activate
                  if [ -n "${COVERAGE_ARGS}" ]; then codecov --name ${PYVERS}node${CIRCLE_NODE_INDEX} ${CODECOV_ARGS}; fi;

        - store_test_results:
              path: test-reports

        - store_artifacts:
              path: test-reports

jobs:

    python37:
        parallelism: 2
        docker:
            - image: circleci/python:3.7
              environment:
                  RUN_SYNTAX: 1
                  CODECOV_ARGS: --required
                  COVERAGE_ARGS: --cov fuckery --no-cov-on-fail
                  PYVERS: 3.7

        working_directory: ~/repo

        <<: *test_steps

    python36:
        parallelism: 2
        docker:
            - image: circleci/python:3.6
              environment:
                  RUN_SYNTAX: 1
                  CODECOV_ARGS: --required
                  COVERAGE_ARGS: --cov fuckery --no-cov-on-fail
                  PYVERS: 3.6

        working_directory: ~/repo

        <<: *test_steps

    build_container_branch:
        docker:
            - image: docker:18.05.0-ce
        steps:
            - checkout
            - setup_remote_docker
            - run:
                  name: build image
                  command: |
                      docker build -t fuckery:dev -f Dockerfile .
            - run:
                  name: docker login
                  command: |
                      docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}"

            - run:
                  name: tag and push container
                  command: |
                      docker image tag fuckery:dev williamgibb/fuckery:${CIRCLE_BRANCH}
                      docker push williamgibb/fuckery:${CIRCLE_BRANCH}

    build_container_tags:
        docker:
            - image: docker:18.05.0-ce
        steps:
            - checkout
            - setup_remote_docker
            - run:
                  name: build image
                  command: |
                      docker build -t fuckery:dev -f Dockerfile .
            - run:
                  name: docker login
                  command: |
                      docker login --username "${DOCKER_USERNAME}" --password "${<PASSWORD>_PASSWORD}"
            - run:
                  name: tag and push container
                  command: |
                      docker image tag fuckery:dev williamgibb/fuckery:${CIRCLE_TAG}
                      docker push williamgibb/fuckery:${CIRCLE_TAG}

    build_packages:
        docker:
            - image: circleci/python:3.7
        steps:
            - checkout

            - restore_cache:
                  keys:
                      - v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

            - run:
                  name: install python dependencies
                  command: |
                      python3 -m venv venv
                      . venv/bin/activate
                      python3 -m pip install -U wheel pip
                      python setup.py egg_info
                      python -m pip install -U -r src/fuckery.egg-info/requires.txt

            - save_cache:
                paths:
                    - ./venv
                key: v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

            - run:
                  name: verify git tag vs. version
                  command: |
                      env | grep -i circle
                      . venv/bin/activate
                      python setup.py verify
            - run:
                  name: init .pypirc
                  command: |
                      echo -e "[pypi]" >> ~/.pypirc
                      echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
                      echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
            - run:
                  name: create packages
                  command: |
                      . venv/bin/activate
                      python setup.py sdist bdist_wheel

            - run:
                  name: upload to pypi
                  command: |
                      . venv/bin/activate
                      twine upload dist/*


workflows:
    version: 2
    run_tests:
        jobs:
            - python36
            - python37
            - build_packages:
                  requires:
                      - python36
                      - python37
                  filters:
                      tags:
                          only: /^v.*/
                      branches:
                          ignore: /.*/

            - build_container_branch:<commit_msg>Tweak build pre-requisites<commit_after># Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2

test_steps:  &test_steps
    steps:
        - checkout

        - restore_cache:
              keys:
                  - v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

        - run:
              name: setup venv
              command: |
                  python3 -m venv --copies venv
                  . venv/bin/activate
                  python3 -m pip install -U wheel pip pytest pytest-cov pycodestyle codecov

        - run:
              name: install fuckery
              command: |
                  . venv/bin/activate
                  python3 -m pip install -e .

        - save_cache:
              paths:
                  - ./venv
              key: <KEY> .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

        - run:
              name: syntax
              command: |
                  . venv/bin/activate
                  if [ -n "${RUN_SYNTAX}" ]; then pycodestyle --max-line-length=120 --select E111,E101,E201,E202,E203,E221,E222,E223,E224,E225,E226,E227,E228,E231,E241,E242,E251,E303,E304,E502,E711,E712,E713,E714,E721,E741,E742,E743,W191,W291,W293,W292,W391,W602,W603 src/fuckery; fi;

        - run:
              name: run tests
              command: |
                  . venv/bin/activate
                  mkdir test-reports
                  circleci tests glob tests/test_*.py | circleci tests split --split-by=timings | xargs python -m pytest -v -s -rs --durations 6 --maxfail 6 -p no:logging --junitxml=test-reports/junit.xml ${COVERAGE_ARGS}

        - run:
              name: report coverage
              command: |
                  . venv/bin/activate
                  if [ -n "${COVERAGE_ARGS}" ]; then codecov --name ${PYVERS}node${CIRCLE_NODE_INDEX} ${CODECOV_ARGS}; fi;

        - store_test_results:
              path: test-reports

        - store_artifacts:
              path: test-reports

jobs:

    python37:
        parallelism: 2
        docker:
            - image: circleci/python:3.7
              environment:
                  RUN_SYNTAX: 1
                  CODECOV_ARGS: --required
                  COVERAGE_ARGS: --cov fuckery --no-cov-on-fail
                  PYVERS: 3.7

        working_directory: ~/repo

        <<: *test_steps

    python36:
        parallelism: 2
        docker:
            - image: circleci/python:3.6
              environment:
                  RUN_SYNTAX: 1
                  CODECOV_ARGS: --required
                  COVERAGE_ARGS: --cov fuckery --no-cov-on-fail
                  PYVERS: 3.6

        working_directory: ~/repo

        <<: *test_steps

    build_container_branch:
        docker:
            - image: docker:18.05.0-ce
        steps:
            - checkout
            - setup_remote_docker
            - run:
                  name: build image
                  command: |
                      docker build -t fuckery:dev -f Dockerfile .
            - run:
                  name: docker login
                  command: |
                      docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}"

            - run:
                  name: tag and push container
                  command: |
                      docker image tag fuckery:dev williamgibb/fuckery:${CIRCLE_BRANCH}
                      docker push williamgibb/fuckery:${CIRCLE_BRANCH}

    build_container_tags:
        docker:
            - image: docker:18.05.0-ce
        steps:
            - checkout
            - setup_remote_docker
            - run:
                  name: build image
                  command: |
                      docker build -t fuckery:dev -f Dockerfile .
            - run:
                  name: docker login
                  command: |
                      docker login --username "${DOCKER_USERNAME}" --password "${<PASSWORD>}"
            - run:
                  name: tag and push container
                  command: |
                      docker image tag fuckery:dev williamgibb/fuckery:${CIRCLE_TAG}
                      docker push williamgibb/fuckery:${CIRCLE_TAG}

    build_packages:
        docker:
            - image: circleci/python:3.7
        steps:
            - checkout

            - restore_cache:
                  keys:
                      - v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

            - run:
                  name: install python dependencies
                  command: |
                      python3 -m venv venv
                      . venv/bin/activate
                      python3 -m pip install -U wheel pip
                      python setup.py egg_info
                      python -m pip install -U -r src/fuckery.egg-info/requires.txt

            - save_cache:
                paths:
                    - ./venv
                key: v1-venv-{{ .Environment.CIRCLE_STAGE }}-{{ .Branch }}-{{ checksum "setup.py" }}

            - run:
                  name: verify git tag vs. version
                  command: |
                      env | grep -i circle
                      . venv/bin/activate
                      python setup.py verify
            - run:
                  name: init .pypirc
                  command: |
                      echo -e "[pypi]" >> ~/.pypirc
                      echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
                      echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
            - run:
                  name: create packages
                  command: |
                      . venv/bin/activate
                      python setup.py sdist bdist_wheel

            - run:
                  name: upload to pypi
                  command: |
                      . venv/bin/activate
                      twine upload dist/*


workflows:
    version: 2
    run_tests:
        jobs:
            - python36:
                  filters:
                      tags:
                          only: /.*/
                      branches:
                          only: /.*/

            - python37
                  filters:
                      tags:
                          only: /.*/
                      branches:
                          only: /.*/

            - build_packages:
                  requires:
                      - python36
                      - python37
                  filters:
                      tags:
                          only: /^v.*/
                      branches:
                          ignore: /.*/

            - build_container_branch:
{'fraction_non_alphanumeric': 0.0921736472026903, 'fraction_numerical': 0.024533781718129012, 'mean_word_length': 1.0149368647982753, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 18, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '2088218', 'n_tokens_mistral': 3920, 'n_tokens_neox': 3436, 'n_words': 781}