Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 2.32 KB

travisci.md

File metadata and controls

57 lines (42 loc) · 2.32 KB

TravisCI

Continuous Integration: Running tests before deployment

In this example, we are deploying to Heroku, but we're going run tests on TravisCI before deploying to Heroku.

Pre-requisites:

Steps:

  • Visit https://travis-ci.org and add repo as a travis project
  • Launch a terminal and change current directory to home directory of your project
  • create an empty .travis.yml file in your project directory: touch .travis.yml
  • add the following configuration to .travis.yml:
language: node_js
node_js:
  - "9"
cache:
  directories:
  - node_modules
script:
  - npm test
deploy:
  provider: heroku
  app: swift-waters-95000 # replace this with the name of your heroku app
  on:
    repo: davified/temp_heroku_travis   # replace this with your_github_username/your_repo
  • Generate secure api_key in .travis.yml: travis encrypt $(heroku auth:token) --add deploy.api_key
  • git add, git commit and git push .travis.yml
  • Go to https://dashboard.heroku.com/ to complete the Heroku-Github integration
    • Click on your project

    • Click on Deploy tab → Deployment method → select GitHub

      heroku_connect_github

    • Search for the repo of the application that you’re deploying → click Connect

      heroku_ci

    • Further below, click on ‘Wait for CI to pass before deploy’ and ‘Enable Automatic Deploy’

  • Lastly, add any add-ons services (e.g. mlab) that you're using on heroku and add the necessary config vars (if any) on the heroku dashboard

Resources