<commit_before>language: node_js

branches:
  only:
    - master

env:
  global:
    - "SAUCE_USERNAME=$SAUCE_NEXT_USERNAME"
    - "SAUCE_ACCESS_KEY=$SAUCE_NEXT_ACCESS_KEY"

jobs:
  include:
    - stage: test
      env: CI_BUILD_TYPE=default
      node_js: 10
      before_install:
        - export DISPLAY=:99.0
        - export CHROME_BIN=chromium-browser
        - sh -e /etc/init.d/xvfb start
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli
        - yarn global add codecov
      install:
        - yarn install
      script:
        - yarn test
      after_success:
        - cat reports/unit/coverage/*/lcov.info | codecov
    - stage: test
      os: linux
      env: CI_BUILD_TYPE=saucelabs
      node_js: 10
      before_install:
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli
      install:
        - yarn install
      script:
        - yarn run test-saucelabs
    - stage: test
      os: linux
      env: CI_BUILD_TYPE=electron
      node_js: 10
      before_install:
        - export DISPLAY=':99.0'
        - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli electron
      install:
        - yarn install
      script:
        - yarn run test-electron
    - stage: test
      os: osx
      env: CI_BUILD_TYPE=electron
      node_js: 10
      before_install:
        - export DISPLAY=':99.0'
        - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli electron
      install:
        - yarn install
      script:
        - yarn run test-electron
    - stage: deploy
      os: linux
      env: CI_BUILD_TYPE=docs
      node_js: 10
      install:
        - yarn global add documentation
        - yarn install --ignore-scripts
      script:
        - git config --global user.email "<EMAIL>"
        - git config --global user.name "travis-ci"
        - git clone https://${GH_TOKEN}@github.com/Chialab/dna.wiki.git wiki
        - documentation build packages/core/index.js -f md > ./wiki/API.md
        - cd wiki
        - git add .
        - git diff-index --quiet HEAD || git commit -m "Lastest api reference on successful travis build ${TRAVIS_BUILD_NUMBER} auto-pushed to wiki"
        - git push origin
    - stage: deploy
      os: linux
      env: CI_BUILD_TYPE=website CNAME=dna.chialab.io
      node_js: 10
      install:
        - pip install --user awscli
      before_script:
        - mkdir -p public
      script:
        - git config --global user.email "<EMAIL>"
        - git config --global user.name "travis-ci"
        - git clone https://gitlab.com/chialab/project-pages.git pages
        - cd pages
        - npm install
        - cd ..
        - node ./pages/index.js . --extra.ga 'UA-149131-70'
        - ls -R public
      after_success:
        - for file in public/*.html; do mv -- "$file" "${file%%.html}"; done
        - for file in public/**/*.html; do mv -- "$file" "${file%%.html}"; done
        - sed -i 's/\.html//g' public/service-worker.js
        - aws s3 sync public s3://$CNAME/ --region us-east-1 --size-only --exclude "*" --include "*.*" --delete
        - aws s3 sync public s3://$CNAME/ --region us-east-1 --size-only --content-type text/html --exclude "*.*" --delete
        - aws cloudfront create-invalidation --paths '/*' --distribution-id $(aws cloudfront list-distributions --query "DistributionList.Items[?contains(Aliases.Items, '${CNAME}')].Id" --output text)
  allow_failures:
    - env: CI_BUILD_TYPE=electron
    - env: CI_BUILD_TYPE=saucelabs

addons:
  apt:
    packages:
      - xvfb<commit_msg>chore: remove website deploy<commit_after>language: node_js

branches:
  only:
    - master

env:
  global:
    - "SAUCE_USERNAME=$SAUCE_NEXT_USERNAME"
    - "SAUCE_ACCESS_KEY=$SAUCE_NEXT_ACCESS_KEY"

jobs:
  include:
    - stage: test
      env: CI_BUILD_TYPE=default
      node_js: 10
      before_install:
        - export DISPLAY=:99.0
        - export CHROME_BIN=chromium-browser
        - sh -e /etc/init.d/xvfb start
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli
        - yarn global add codecov
      install:
        - yarn install
      script:
        - yarn test
      after_success:
        - cat reports/unit/coverage/*/lcov.info | codecov
    - stage: test
      os: linux
      env: CI_BUILD_TYPE=saucelabs
      node_js: 10
      before_install:
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli
      install:
        - yarn install
      script:
        - yarn run test-saucelabs
    - stage: test
      os: linux
      env: CI_BUILD_TYPE=electron
      node_js: 10
      before_install:
        - export DISPLAY=':99.0'
        - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli electron
      install:
        - yarn install
      script:
        - yarn run test-electron
    - stage: test
      os: osx
      env: CI_BUILD_TYPE=electron
      node_js: 10
      before_install:
        - export DISPLAY=':99.0'
        - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
        - yarn config set registry https://registry.npmjs.org/
        - yarn global add @chialab/rna-cli electron
      install:
        - yarn install
      script:
        - yarn run test-electron
    - stage: deploy
      os: linux
      env: CI_BUILD_TYPE=docs
      node_js: 10
      install:
        - yarn global add documentation
        - yarn install --ignore-scripts
      script:
        - git config --global user.email "<EMAIL>"
        - git config --global user.name "travis-ci"
        - git clone https://${GH_TOKEN}@github.com/Chialab/dna.wiki.git wiki
        - documentation build packages/core/index.js -f md > ./wiki/API.md
        - cd wiki
        - git add .
        - git diff-index --quiet HEAD || git commit -m "Lastest api reference on successful travis build ${TRAVIS_BUILD_NUMBER} auto-pushed to wiki"
        - git push origin
  allow_failures:
    - env: CI_BUILD_TYPE=electron
    - env: CI_BUILD_TYPE=saucelabs

addons:
  apt:
    packages:
      - xvfb
{'fraction_non_alphanumeric': 0.1077956569286049, 'fraction_numerical': 0.017184814872676143, 'mean_word_length': 1.8390243902439025, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '852782', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2039, 'n_words': 536}