<commit_before>version: 2
jobs:
  build:
    docker:
      - image: jmichelsen/fixtureless:latest
    environment:
      - IMAGE_NAME: jmichelsen/fixtureless
    steps:
    - checkout
    - run:
        name: Install Docker client
        command: |
          set -x
          VER="18.06.0-ce"
          curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
          tar -xz -C /tmp -f /tmp/docker-$VER.tgz
          mv /tmp/docker/* /usr/bin
    - setup_remote_docker
    - run:
        name: Build Docker Image
        command: |
          docker build -t $IMAGE_NAME:latest .
  # Test Fixtureless with sqlite
  test_sqlite:
    docker:
    - image: jmichelsen/fixtureless:latest
    environment:
      - DJANGO_SETTINGS_MODULE: test_django_project.settings.sqlite
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
      - checkout: &checkout
          path: /code
      - run: &update_requirements
          name: Install any newly added requirements
          command: |
            /py2/bin/pip install -r /requirements/p2.pip
            /py3/bin/pip install -r /requirements/p3.pip
            mkdir test_reports
      - run: &run_python2_tests
          name: Run Python2 tests
          command: |
            /py2/bin/pytest --cov --junitxml=test_reports/junit_py2.xml
      - run: &run_python3_tests
          name: Run Python3 tests
          command: |
            /py3/bin/pytest --cov --junitxml=test_reports/junit_py3.xml
      - store_test_results: &store_results
          path: test_reports
      - store_artifacts: &store_artifacts
          path: test_reports
  # Test Fixtureless with Postgres
  test_postgres:
    docker:
    - image: jmichelsen/fixtureless:latest
    - image: postgres:alpine
      environment:
        POSTGRES_PASSWORD: fixtureless
        POSTGRES_USER: fixtureless
        POSTGRES_DB: fixtureless
    environment:
    - PSQL_HOST: localhost
    - DJANGO_SETTINGS_MODULE: test_django_project.settings.postgres
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
    - checkout: *checkout
    - run: *update_requirements
    - run:
        name: Waiting for Postgres to be ready
        command: |
          for i in `seq 1 10`;
          do
            nc -z localhost 5432 && echo Success && exit 0
            echo -n .
            sleep 1
          done
          echo Failed waiting for Postgress && exit 1
    - run: *run_python2_tests
    - run: *run_python3_tests
    - store_test_results: *store_results
    - store_artifacts: *store_artifacts
  # Test Fixtureless with MySQL
  test_mysql:
    docker:
      - image: jmichelsen/fixtureless:latest
      - image: circleci/mysql:8.0.4
        environment:
          MYSQL_DATABASE: fixtureless
          MYSQL_USER: fixtureless
          MYSQL_PASSWORD: <PASSWORD>
    environment:
      - MYSQL_HOST: localhost
      - DJANGO_SETTINGS_MODULE: test_django_project.settings.mysql
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
    - checkout: *checkout
    - run: *update_requirements
    - run:
        name: Waiting for MySQL to be ready
        command: |
          while ! mysqladmin ping -h 127.0.0.1; do sleep 1; done
    - run: *run_python2_tests
    - run: *run_python3_tests
    - store_test_results: *store_results
    - store_artifacts: *store_artifacts

workflows:
  version: 2
  build_and_test:
    jobs:
    - build
    - test_sqlite:
        requires:
          - build
    - test_postgres:
        requires:
          - build
    - test_mysql:
        requires:
          - build
<commit_msg>Update image to be dynamically created and tagged<commit_after>version: 2
jobs:
  build:
    docker:
      - image: jmichelsen/fixtureless:latest
    environment:
      - IMAGE_NAME: jmichelsen/fixtureless
    steps:
    - checkout
    - run:
        name: Install Docker client
        command: |
          set -x
          VER="18.06.0-ce"
          curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
          tar -xz -C /tmp -f /tmp/docker-$VER.tgz
          mv /tmp/docker/* /usr/bin
    - setup_remote_docker
    - run:
        name: Build Docker Image
        command: |
          docker build -t $IMAGE_NAME:$CIRCLE_WORKFLOW_ID .
  # Test Fixtureless with sqlite
  test_sqlite:
    docker:
    - image: jmichelsen/fixtureless:$CIRCLE_WORKFLOW_ID
    environment:
      - DJANGO_SETTINGS_MODULE: test_django_project.settings.sqlite
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
      - checkout: &checkout
          path: /code
      - run: &update_requirements
          name: Install any newly added requirements
          command: |
            /py2/bin/pip install -r /requirements/p2.pip
            /py3/bin/pip install -r /requirements/p3.pip
            mkdir test_reports
      - run: &run_python2_tests
          name: Run Python2 tests
          command: |
            /py2/bin/pytest --cov --junitxml=test_reports/junit_py2.xml
      - run: &run_python3_tests
          name: Run Python3 tests
          command: |
            /py3/bin/pytest --cov --junitxml=test_reports/junit_py3.xml
      - store_test_results: &store_results
          path: test_reports
      - store_artifacts: &store_artifacts
          path: test_reports
  # Test Fixtureless with Postgres
  test_postgres:
    docker:
    - image: jmichelsen/fixtureless:latest
    - image: postgres:alpine
      environment:
        POSTGRES_PASSWORD: fixtureless
        POSTGRES_USER: fixtureless
        POSTGRES_DB: fixtureless
    environment:
    - PSQL_HOST: localhost
    - DJANGO_SETTINGS_MODULE: test_django_project.settings.postgres
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
    - checkout: *checkout
    - run: *update_requirements
    - run:
        name: Waiting for Postgres to be ready
        command: |
          for i in `seq 1 10`;
          do
            nc -z localhost 5432 && echo Success && exit 0
            echo -n .
            sleep 1
          done
          echo Failed waiting for Postgress && exit 1
    - run: *run_python2_tests
    - run: *run_python3_tests
    - store_test_results: *store_results
    - store_artifacts: *store_artifacts
  # Test Fixtureless with MySQL
  test_mysql:
    docker:
      - image: jmichelsen/fixtureless:latest
      - image: circleci/mysql:8.0.4
        environment:
          MYSQL_DATABASE: fixtureless
          MYSQL_USER: fixtureless
          MYSQL_PASSWORD: <PASSWORD>
    environment:
      - MYSQL_HOST: localhost
      - DJANGO_SETTINGS_MODULE: test_django_project.settings.mysql
    working_directory: /code/fixtureless/tests/test_django_project
    steps:
    - checkout: *checkout
    - run: *update_requirements
    - run:
        name: Waiting for MySQL to be ready
        command: |
          while ! mysqladmin ping -h 127.0.0.1; do sleep 1; done
    - run: *run_python2_tests
    - run: *run_python3_tests
    - store_test_results: *store_results
    - store_artifacts: *store_artifacts

workflows:
  version: 2
  build_and_test:
    jobs:
    - build
    - test_sqlite:
        requires:
          - build
    - test_postgres:
        requires:
          - build
    - test_mysql:
        requires:
          - build

{'fraction_non_alphanumeric': 0.08138268916712031, 'fraction_numerical': 0.012792596624931955, 'mean_word_length': 2.0292662819455893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 2, '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': '2443398', 'n_tokens_mistral': 2416, 'n_tokens_neox': 2299, 'n_words': 515}