Software Engineering (C-T-303-HUGB), Week 10 Fall Semester 2017
Status: <Add Travis Status Badge>
Is a very simple Spark Web application, built with Gradle.
- To run
gradle run
- To create a deployable package:
gradle installDist
- This creates an executable in
build/install/<NAME-OF-PROJECT>/bin
, both a shell file and a bat file that can be run.
- To run tests
gradle test
Once running, head over to localhost:4567 and witness the magic.
The objective is that the students experiment with setting up a continuous integration pipeline; from a code change to running tests automatically and getting feedback. In addition deploying a working artifact to a staging-like environment is a logical next step.
- Fork the calcApi repository: github.com/arnlaugsson/stringCalcWeb
- Note: since this is a public repo, you can't fork is as a private repo (directly at least).
- Go to Travis-ci.org
- # with GitHub
- Give GitHub access to this repository (note you might need to "sync" repos to Travis CI, using a button).
- Clone the repo to your local environment and make the following changes:
- Create a
.travis.yml
file in the root of the project. If you are unsure about what to put in this file, or what it is used for, go read a bit on Java projects in Travis CI, docs.travis-ci.com/. - Add the new file, but don't commit yet.
- Add a build badge into the top of a README.md file
- This should be something like:
[![Build Status](your travis url for the repo here.png)](your travis url for the repo here)
- Add some information to the README file.
- This should be something like:
- Add the new README.md, commit and push.
- Create a
- If everything went OK, you should see something happening. In Github (the badge) and on Travis CI.
Heroku offers a great step-by-step introduction for deploying Gradle applications on Heroku, if you get stuck somewhere, head over there to check that out.
Deploying Gradle apps on Heroku
- # for free on Heroku.com.
- Setup the Heroku Toolbelt
- # using the Heroku Toolbelt
- Using the same repo as in the first part of the assignment; in the root, create a new Heroku app:
heroku apps:create
- Take a look at the Getting started with Gradle on Heroku guide
- Add a
stage
task to your build.gradle file, and add a Procfile, similar to the one given in the Getting started guide. - Commit and push to Heroku:
git commit -m "Added Heroku Procfile"; git push heroku master
- You should now have a running application somewhere on herokuapp.
Disclaimer: This is where things get tricker, and we'll only help move you in the right direction.
To move from a simple Continuous integration cycle, to something more complicated continuous delivery, you will need to define a staging server. This can easily be a Heroku app server. How would you go about setting the following up:
- Code changes are made to a feature branch as a part of a pull request
- Travis runs all unit and integration tests on commit and push to GitHub
- If there are failures, GitHub would show this on the pull request.
- If the tests pass and other checks pass
- Travis CI will deploy the application to a staging server.
- That can be used for manual testing, or later some functional tests like Selenium tests.
You will need:
- A basic understanding of how Heroku and Travis can communicate: http://docs.travis-ci.com/user/deployment/heroku/
- Travis command line tools: https://github.com/travis-ci/travis.rb