<commit_before>version: 2.1
executors:
  toxandnode:
    working_directory: ~/project
    docker:
      - image: girder/tox-and-node
      - image: memcached
      - image: circleci/mongo:4.0-ram
      - image: rabbitmq
commands:
  tox:
    description: "Run tox"
    parameters:
      env:
        type: string
    steps:
      - run:
          name: Upgrade pip
          command: pip install -U pip
      - run:
          name: Upgrade virtualenv and tox
          command: pip install -U virtualenv tox
      - run:
          name: Preinstall phantomjs to work around an npm permission issue
          command: npm install -g phantomjs-prebuilt --unsafe-perm
      - run:
          name: Run tests via tox
          # Piping through cat does less buffering of the output but can
          # consume the exit code
          command: PYTEST_ADDOPTS=--forked tox -e << parameters.env >> | cat; test ${PIPESTATUS[0]} -eq 0
  upgradepython:
    description: "Upgrade python"
    parameters:
      version:
        type: string
    steps:
      - run:
          name: Upgrade pyenv
          command: |
            rm -rf /opt/circleci/.pyenv
            curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
            pyenv install --list list
      - run:
          name: Use pyenv to install python
          command: |
            pyenv install << parameters.version >>
  allservices:
    description: "Switch to a python version and start other services"
    parameters:
      version:
        type: string
      node:
        type: string
    steps:
      - upgradepython:
          version: << parameters.version >>
      - run:
          name: Use pyenv to set python version
          command: |
            pyenv versions
            pyenv global << parameters.version >>
      - run:
          name: start mongo
          command: |
            docker run --rm -d -p 27017:27017 circleci/mongo:4.0-ram
      - run:
          name: start rabbitmq
          command: |
            docker run --rm -d -p 5672:5672 rabbitmq
      - run:
          name: start memcached
          command: |
            docker run --rm -d -p 11211:11211 memcached -m 64
      - run:
          name: Use nvm
          # see https://discuss.circleci.com/t/nvm-does-not-change-node-version-on-machine/28973/14
          command: |
            echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
            echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
      - run:
          name: Switch node versions
          command: |
            nvm install << parameters.node >>
            nvm alias default  << parameters.node >>
      - run:
          name: Check node versions
          command: |
            node --version
            npm --version
  coverage:
    description: "Upload coverage"
    steps:
      - run:
          name: Install Codecov client
          command: pip install codecov==2.1.9
      - run:
          name: Upload coverage
          command: codecov --tries 10 --required --disable search pycov gcov --root project --file .tox/coverage/py_coverage.xml -f build/test/coverage/cobertura-coverage.xml

jobs:
  testdocker:
    machine: true
    steps:
      - checkout
      - run:
          name: Build the test docker
          command: docker build --force-rm -t girder/tox-and-node .<commit_msg>Fix coverage reporting.<commit_after>version: 2.1
executors:
  toxandnode:
    working_directory: ~/project
    docker:
      - image: girder/tox-and-node
      - image: memcached
      - image: circleci/mongo:4.0-ram
      - image: rabbitmq
commands:
  tox:
    description: "Run tox"
    parameters:
      env:
        type: string
    steps:
      - run:
          name: Upgrade pip
          command: pip install -U pip
      - run:
          name: Upgrade virtualenv and tox
          command: pip install -U virtualenv tox
      - run:
          name: Preinstall phantomjs to work around an npm permission issue
          command: npm install -g phantomjs-prebuilt --unsafe-perm
      - run:
          name: Run tests via tox
          # Piping through cat does less buffering of the output but can
          # consume the exit code
          command: PYTEST_ADDOPTS=--forked tox -e << parameters.env >> | cat; test ${PIPESTATUS[0]} -eq 0
  upgradepython:
    description: "Upgrade python"
    parameters:
      version:
        type: string
    steps:
      - run:
          name: Upgrade pyenv
          command: |
            rm -rf /opt/circleci/.pyenv
            curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
            pyenv install --list list
      - run:
          name: Use pyenv to install python
          command: |
            pyenv install << parameters.version >>
  allservices:
    description: "Switch to a python version and start other services"
    parameters:
      version:
        type: string
      node:
        type: string
    steps:
      - upgradepython:
          version: << parameters.version >>
      - run:
          name: Use pyenv to set python version
          command: |
            pyenv versions
            pyenv global << parameters.version >>
      - run:
          name: start mongo
          command: |
            docker run --rm -d -p 27017:27017 circleci/mongo:4.0-ram
      - run:
          name: start rabbitmq
          command: |
            docker run --rm -d -p 5672:5672 rabbitmq
      - run:
          name: start memcached
          command: |
            docker run --rm -d -p 11211:11211 memcached -m 64
      - run:
          name: Use nvm
          # see https://discuss.circleci.com/t/nvm-does-not-change-node-version-on-machine/28973/14
          command: |
            echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
            echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
      - run:
          name: Switch node versions
          command: |
            nvm install << parameters.node >>
            nvm alias default  << parameters.node >>
      - run:
          name: Check node versions
          command: |
            node --version
            npm --version
  coverage:
    description: "Upload coverage"
    steps:
      - run:
          name: Install Codecov client
          command: pip install codecov
      - run:
          name: Upload coverage
          command: |
              codecov --disable search pycov gcov --file build/test/coverage/py_coverage.xml build/test/coverage/cobertura-coverage.xml

jobs:
  testdocker:
    machine: true
    steps:
      - checkout
      - run:
          name: Build the test docker
          command: docker build --force-rm -t girder/tox-and-node .
{'fraction_non_alphanumeric': 0.09337304542069992, 'fraction_numerical': 0.014147431124348473, 'mean_word_length': 1.5950540958268933, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, 'https://': 4, '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': '5731255', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1917, 'n_words': 584}