Build POS app on Travis CI
![Test Coverage](https://camo.githubusercontent.com/a6bf18210159d5a3129f8c223bed0598a313a71ef2e3bb1ce2c70664fed96f31/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f30313234383639373436393233616339643837622f746573745f636f766572616765)
- Sign up to Travis CI with your Github account.
- Click the green Activate button, and select the repositories you want to use with Travis CI.
- Add a
.travis.yml
file with the following content to your repository to tell Travis CI what to do:
language: java
jdk:
- oraclejdk8
- commit and push your changes to the github repo.
- New build will be triggered
Run tests and measure code coverage
apply plugin: "jacoco"
<...>
jacoco {
toolVersion = "0.8.1"
}
jacocoTestReport {
reports {
xml.enabled=true
}
}
- Add script step to the
.travis.yml
file:
- gradle test jacocoTestReport
- commit these changes. If some of unit tests fail the build becomes red
- Sign up to Code climate with your Github account.
- Activate "Free for open source" account
- Add Github repository
- To analyze your code with each commit on Code Climate navigate to
Pero Settings
-> Test Coverage
-> Copy TEST_REPORTED_ID
key
- Add following lines to your
.travis.yml
file:
env:
global:
- CC_TEST_REPORTER_ID=<your_test_reporter_id>
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- gradle test jacocoTestReport
- JACOCO_SOURCE_PATH=src/main/java ./cc-test-reporter format-coverage ./build/reports/jacoco/test/jacocoTestReport.xml --input-type jacoco
- ./cc-test-reporter upload-coverage -r $CC_TEST_REPORTER_ID
- If no mistakes your next build will trigger code coverage analysis on Code climate