<commit_before># opentrons platform travis config
cache:
  pip: true
  yarn: true

stages:
  - test
  - name: app
    # don't build the app on pull requests
    if: type != pull_request

# base configs
_deploy_s3: &deploy_s3
  provider: s3
  skip_cleanup: true
  access_key_id: $AWS_ACCESS_KEY_ID
  secret_access_key: $AWS_SECRET_ACCESS_KEY
  acl: public_read
  on:
    repo: Opentrons/opentrons
    all_branches: true

_app_stage_build: &app_stage_build
  stage: app
  language: node_js
  install:
    - pip install --user awscli
    - make install-js
  before_script:
    # pull API wheel from S3
    - mkdir -p ./api/dist
    - aws s3 sync $OT_CI_TEMP_S3_PATH/api/dist ./api/dist
  deploy:
    - # deploy Opentrons App to S3
      <<: *deploy_s3
      local-dir: app-shell/dist/publish
      bucket: $OT_APP_DEPLOY_BUCKET
      upload-dir: $OT_APP_DEPLOY_FOLDER

jobs:
  include:
    # test, build, and upload wheels for Python projects
    - stage: test
      name: 'Python API unit tests, build API docs'
      language: python
      python: 3.6
      before_install:
        - sudo apt-get install -y --no-install-recommends texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended
      install:
        - pip install awscli
        - nvm install
        - yarn global add shx@0.2.2 codecov@3.1.0
        - make install-py
      script:
        - make test-py
        - make lint-py
        - make -C api docs docs-pdf
      after_success:
        - make coverage
        - aws s3 sync ./api/dist $OT_CI_TEMP_S3_PATH/api/dist
      deploy:
        # push docs on tag
        - provider: pages
          skip_cleanup: true
          keep-history: false
          local-dir: api/docs/dist
          github-token: $GITHUB_TOKEN
          on:
            branch: edge
            repo: Opentrons/opentrons

        # push to real pypi on tag
        - provider: script
          skip_cleanup: true
          script: make -C api deploy pypi_username=${PYPI_USER} pypi_password=${PY<PASSWORD>}
          on:
            all_branches: true
            condition: $TRAVIS_TAG =~ ^v
            repo: Opentrons/opentrons

        # push to test pypi on pr
        - provider: script
          skip_cleanup: true
          script: make -C api deploy-staging pypi_username=${TEST_PYPI_USER} pypi_password=${<PASSWORD>}
          on:
            repo: Opentrons/opentrons
            branch: edge

    # test, build, and upload for JavaScript projects
    - stage: test
      name: 'JS unit tests; build/deploy Protocol Designer, Components Library'
      # node version pulled from .nvmrc
      language: node_js
      install:
        - make install-js
      script:
        - make test-js
        - make lint-js lint-css
        - make -C components
        - make -C protocol-designer
      after_success:
        - make coverage
      deploy:
        - # deploy protocol designer to S3
          <<: *deploy_s3
          region: us-east-2
          dot_match: true
          local-dir: protocol-designer/dist
          bucket: opentrons-protocol-designer-builds
          upload-dir: $TRAVIS_BRANCH
        - # deploy components library to S3
          <<: *deploy_s3
          # TODO(mc, 2018-03-26): why is this region not default?
          region: us-west-2
          local-dir: components/dist
          bucket: opentrons-components
          upload-dir: $TRAVIS_BRANCH

    # typecheck JavaScript projects
    - stage: test
      name: 'JS type checks'
      language: node_js
      install:
        - make install-js
      script:
        - make check-js

    - # build the Opentrons App for POSIX (dev branch builds)
      <<: *app_stage_build
      name: 'Build/deploy Opentrons App for POSIX (unsigned dev builds)'
      os: linux
      script: make -C app-shell dist-posix
      # TODO(mc, 2019-03-07): app-shell makefile still looks for presense of
      # tag rather than correct tag format. For now, skip app builds entirely if
      # tag is present but does not match ^v
      if: tag IS blank AND (NOT branch =~ ^(edge|release_.+)$)

    - # build the Opentrons App for Linux (tagged / edge / RC builds)
      <<: *app_stage_build<commit_msg>ci(protocol-designer): make deploy bucket env var (#3195)<commit_after># opentrons platform travis config
cache:
  pip: true
  yarn: true

stages:
  - test
  - name: app
    # don't build the app on pull requests
    if: type != pull_request

# base configs
_deploy_s3: &deploy_s3
  provider: s3
  skip_cleanup: true
  access_key_id: $AWS_ACCESS_KEY_ID
  secret_access_key: $AWS_SECRET_ACCESS_KEY
  acl: public_read
  on:
    repo: Opentrons/opentrons
    all_branches: true

_app_stage_build: &app_stage_build
  stage: app
  language: node_js
  install:
    - pip install --user awscli
    - make install-js
  before_script:
    # pull API wheel from S3
    - mkdir -p ./api/dist
    - aws s3 sync $OT_CI_TEMP_S3_PATH/api/dist ./api/dist
  deploy:
    - # deploy Opentrons App to S3
      <<: *deploy_s3
      local-dir: app-shell/dist/publish
      bucket: $OT_APP_DEPLOY_BUCKET
      upload-dir: $OT_APP_DEPLOY_FOLDER

jobs:
  include:
    # test, build, and upload wheels for Python projects
    - stage: test
      name: 'Python API unit tests, build API docs'
      language: python
      python: 3.6
      before_install:
        - sudo apt-get install -y --no-install-recommends texlive-fonts-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended
      install:
        - pip install awscli
        - nvm install
        - yarn global add shx@0.2.2 codecov@3.1.0
        - make install-py
      script:
        - make test-py
        - make lint-py
        - make -C api docs docs-pdf
      after_success:
        - make coverage
        - aws s3 sync ./api/dist $OT_CI_TEMP_S3_PATH/api/dist
      deploy:
        # push docs on tag
        - provider: pages
          skip_cleanup: true
          keep-history: false
          local-dir: api/docs/dist
          github-token: $GITHUB_TOKEN
          on:
            branch: edge
            repo: Opentrons/opentrons

        # push to real pypi on tag
        - provider: script
          skip_cleanup: true
          script: make -C api deploy pypi_username=${PYPI_USER} pypi_password=${<PASSWORD>}
          on:
            all_branches: true
            condition: $TRAVIS_TAG =~ ^v
            repo: Opentrons/opentrons

        # push to test pypi on pr
        - provider: script
          skip_cleanup: true
          script: make -C api deploy-staging pypi_username=${TEST_PYPI_USER} pypi_password=${<PASSWORD>}
          on:
            repo: Opentrons/opentrons
            branch: edge

    # test, build, and upload for JavaScript projects
    - stage: test
      name: 'JS unit tests; build/deploy Protocol Designer, Components Library'
      # node version pulled from .nvmrc
      language: node_js
      install:
        - make install-js
      script:
        - make test-js
        - make lint-js lint-css
        - make -C components
        - make -C protocol-designer
      after_success:
        - make coverage
      deploy:
        - # deploy protocol designer to S3
          <<: *deploy_s3
          region: us-east-2
          dot_match: true
          local-dir: protocol-designer/dist
          bucket: $OT_PD_DEPLOY_BUCKET
          upload-dir: $TRAVIS_BRANCH
        - # deploy components library to S3
          <<: *deploy_s3
          # TODO(mc, 2018-03-26): why is this region not default?
          region: us-west-2
          local-dir: components/dist
          bucket: opentrons-components
          upload-dir: $TRAVIS_BRANCH

    # typecheck JavaScript projects
    - stage: test
      name: 'JS type checks'
      language: node_js
      install:
        - make install-js
      script:
        - make check-js

    - # build the Opentrons App for POSIX (dev branch builds)
      <<: *app_stage_build
      name: 'Build/deploy Opentrons App for POSIX (unsigned dev builds)'
      os: linux
      script: make -C app-shell dist-posix
      # TODO(mc, 2019-03-07): app-shell makefile still looks for presense of
      # tag rather than correct tag format. For now, skip app builds entirely if
      # tag is present but does not match ^v
      if: tag IS blank AND (NOT branch =~ ^(edge|release_.+)$)

    - # build the Opentrons App for Linux (tagged / edge / RC builds)
      <<: *app_stage_build
{'fraction_non_alphanumeric': 0.0807829181494662, 'fraction_numerical': 0.0099644128113879, 'mean_word_length': 1.9780996114447191, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '2162486', 'n_tokens_mistral': 2717, 'n_tokens_neox': 2620, 'n_words': 785}