For Github public projects, it's better to clearly provide the build status so everyone has the confidence to use your code.
It's absolutely necessary to have a Continuous Integration (CI) service integrated with our projects.
There are a series of such online CI services and so far I love Travis-CI the most as IMHO, they're the best friends to work together.
In short, Travis-CI provides online CI services. Most importantly, it's free of charge for open source projects and has fully integrated with Github.
To make it happen, simply follow below steps can do:
- Login with existing Github account and it will automatically sync our public Github repositories which may take a couple of minutes (depending on how many repositories you have in Github);
- Enable one specific (or all) repository for further CI service by one single click to switch on;
- Add a dedicated .travis.yml file under our project (see attached below for my project as an example);
- Git add, commit, push to Github to automatically trigger Travis CI service;
- To display the build status in Github project, simply do these:
- Go to the specific repository (e.g. https://travis-ci.org/{username or org}/{repository})
- Click the build image and select the Markdown from the dropdown list and copy the text;
- Paste it into README.md of our Github project.
For example, below is the text for my project:
[![Build Status](https://travis-ci.org/itstarting/springboot-jersey-swagger.svg?branch=master)](https://travis-ci.org/itstarting/springboot-jersey-swagger) - Then git add, commit, push to Github again and the build status will be displayed in our Github project (see my project as an example here).
Attachment - My .travis.yml
1 2 3 4 5 6 7 8 9 | ## We develop the project by Java language: java ## Do the tests script: mvn clean test ## We have specified the JDK as v8 in Maven pom.xml jdk: - oraclejdk8 |
No comments:
Post a Comment