Skip to content

omelkova/CI_travis_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build POS app on Travis CI

Build Status Maintainability Test Coverage

Build app with Travis CI

  • 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

  • To measure code coverage we will use JaCoCo gradle plugin
  • Add following lines to build.gradle file:
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

Track code coverage and code quality using Code climate

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages