<commit_before>machine:
  node:
    version: 6
  environment:
    browser_name: $(case $CIRCLE_NODE_INDEX in 0) browser='chrome' ;; 1) browser='firefox' ;; 2) browser='internet explorer' ;; 3) browser='iphone' ;; esac; echo $browser)
    browser_version: $(case $CIRCLE_NODE_INDEX in 3) version='8.2' ;; esac; echo $version)
    SAUCE_LOG: $CIRCLE_ARTIFACTS/sauce_log.txt
    WATAI_TESTS: test/integration
    SAUCE_USERNAME: mes-aides-bot
    # SAUCE_ACCESS_KEY is defined in the CircleCI web UI

dependencies:
  post:
    - npm install saucelabs@0.1.1 # allow sending Watai results to SauceLabs
    - wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
    - tar -xzf sc-latest-linux.tar.gz
    - virtualenv --python=python2 ~/virtualenv
    - source ~/virtualenv/bin/activate && pip install --upgrade pip
    - source ~/virtualenv/bin/activate && pip install gunicorn
    - source ~/virtualenv/bin/activate && npm run install-openfisca

test:
  pre:
    - source ~/virtualenv/bin/activate && npm run openfisca:
        background: true
        parallel: true
    # start Sauce Connect
    - cd sc-*-linux && ./bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --tunnel-identifier "circle-$CIRCLE_PROJECT_USERNAME-$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX" --readyfile ~/sauce_is_ready > $SAUCE_LOG:
        background: true
        parallel: true
    # wait for Sauce Connect
    - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done:
        parallel: true
    # wait for OpenFisca
    - wget --retry-connrefused --waitretry=1 --output-document=/dev/null http://localhost:2000:
        parallel: true
    # prepare CI-specific config holder and add CI-specific config to Watai
    - cp $WATAI_TESTS/config-ci.js $WATAI_TESTS/config.js && rm $WATAI_TESTS/config.json:
        parallel: true

  override:
    - npm test
    # start server
    - npm start:
        background: true
        parallel: true
    # wait for server (after Sauce Connect because it is faster to start)
    - wget --retry-connrefused --waitretry=4 --output-document=/dev/null http://localhost:9000:
        parallel: true
    - watai $WATAI_TESTS/base-suite --config '{"driverCapabilities":{"browserName":"'"$browser_name"'","version":"'"$browser_version"'"}}':
        parallel: true
    - watai $WATAI_TESTS/family-suite  --config '{"driverCapabilities":{"browserName":"'"$browser_name"'","version":"'"$browser_version"'"}}':
        parallel: true

  post:
    - killall --wait sc:  # wait until Sauce Connect closes the tunnel
        parallel: true

deployment:
  # Continuous deployment is done on a dedicated instance in OVH datacenters
  metal:
    branch: master
    commands:
      # CircleCI relies on a private key that triggers /opt/mes-aides/update.sh deploy
      - ssh root@metal.mes-aides.gouv.fr<commit_msg>Setup automatic deployment on VPS<commit_after>machine:
  node:
    version: 6
  environment:
    browser_name: $(case $CIRCLE_NODE_INDEX in 0) browser='chrome' ;; 1) browser='firefox' ;; 2) browser='internet explorer' ;; 3) browser='iphone' ;; esac; echo $browser)
    browser_version: $(case $CIRCLE_NODE_INDEX in 3) version='8.2' ;; esac; echo $version)
    SAUCE_LOG: $CIRCLE_ARTIFACTS/sauce_log.txt
    WATAI_TESTS: test/integration
    SAUCE_USERNAME: mes-aides-bot
    # SAUCE_ACCESS_KEY is defined in the CircleCI web UI

dependencies:
  post:
    - npm install saucelabs@0.1.1 # allow sending Watai results to SauceLabs
    - wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
    - tar -xzf sc-latest-linux.tar.gz
    - virtualenv --python=python2 ~/virtualenv
    - source ~/virtualenv/bin/activate && pip install --upgrade pip
    - source ~/virtualenv/bin/activate && pip install gunicorn
    - source ~/virtualenv/bin/activate && npm run install-openfisca

test:
  pre:
    - source ~/virtualenv/bin/activate && npm run openfisca:
        background: true
        parallel: true
    # start Sauce Connect
    - cd sc-*-linux && ./bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --tunnel-identifier "circle-$CIRCLE_PROJECT_USERNAME-$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX" --readyfile ~/sauce_is_ready > $SAUCE_LOG:
        background: true
        parallel: true
    # wait for Sauce Connect
    - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done:
        parallel: true
    # wait for OpenFisca
    - wget --retry-connrefused --waitretry=1 --output-document=/dev/null http://localhost:2000:
        parallel: true
    # prepare CI-specific config holder and add CI-specific config to Watai
    - cp $WATAI_TESTS/config-ci.js $WATAI_TESTS/config.js && rm $WATAI_TESTS/config.json:
        parallel: true

  override:
    - npm test
    # start server
    - npm start:
        background: true
        parallel: true
    # wait for server (after Sauce Connect because it is faster to start)
    - wget --retry-connrefused --waitretry=4 --output-document=/dev/null http://localhost:9000:
        parallel: true
    - watai $WATAI_TESTS/base-suite --config '{"driverCapabilities":{"browserName":"'"$browser_name"'","version":"'"$browser_version"'"}}':
        parallel: true
    - watai $WATAI_TESTS/family-suite  --config '{"driverCapabilities":{"browserName":"'"$browser_name"'","version":"'"$browser_version"'"}}':
        parallel: true

  post:
    - killall --wait sc:  # wait until Sauce Connect closes the tunnel
        parallel: true

deployment:
  # Continuous deployment is done on a dedicated instance in OVH datacenters
  metal:
    branch: master
    commands:
      # CircleCI relies on a private key that triggers /opt/mes-aides/update.sh deploy
      - ssh <EMAIL>@metal.<EMAIL>
  vps:
    branch: vps
    commands:
      # CircleCI relies on a private key that triggers /opt/mes-aides/update.sh deploy
      - ssh root@vps.mes-aides.gouv.fr
{'fraction_non_alphanumeric': 0.1210670314637483, 'fraction_numerical': 0.00786593707250342, 'mean_word_length': 3.1423512747875355, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '440660', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1903, 'n_words': 483}