Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Adding Continuous Integration to Play!

DZone's Guide to

Adding Continuous Integration to Play!

· DevOps Zone
Free Resource

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

With services like Travis, it has become quite easy add setup Continuous Integration to projects. This post will show you quickly how to setup Travis to build and test your Play project. This assumes you have signed up for Github and Travis, and have authorised travis to connect to your github account. If you have not done this already, follow the Travis steps here.

  1. Create a .travis.yml file in the root of your Play project.
  2. Add the following contents.

    language: java
    env:
      - PLAY_VERSION=2.2.1
    before_script:
      - wget http://downloads.typesafe.com/play/${PLAY_VERSION}/play-${PLAY_VERSION}.zip
      - unzip -q play-${PLAY_VERSION}.zip
    script: play-${PLAY_VERSION}/play test
    
  3. Ensure travis is building your repository. Click on https://travis-ci.org/profile and ensure that your github repository is synchronised and building. Upon committing, your travis build should start.

    To save SBT from redownloading dependencies, you can use the experimental caching feature of Travis. However this is only available for private repositories.

     
    language: java
    cache:
      directories:
      - .sbt
    env:
      - PLAY_VERSION=2.2.1
    before_script:
      - wget http://downloads.typesafe.com/play/${PLAY_VERSION}/play-${PLAY_VERSION}.zip
      - unzip -q play-${PLAY_VERSION}.zip
    script: play-${PLAY_VERSION}/play test
    
  4. The source to this post can be found here

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}