Travis CI

Travis CI (https://travis-ci.org/) is a distributed build server used to build and test software projects hosted on GitHub. Travis supports open source projects with no charge.

The configuration of Travis CI is done using a file named .travis.yaml. The content of this file is structured using different keywords, including:

  • language: Project language, that is, java, node_js, ruby, python, or php among others (the complete list is available on https://docs.travis-ci.com/user/languages/).
  • sudo: Flag value to set if superuser privileges are needed (for example to install Ubuntu packages).
  • dist: Builds can be executed on Linux environments (Ubuntu Precise 12.04 or Ubuntu Trusty 14.04).
  • addons: Declarative shortcuts to basic operations of the apt-get commands.
  • install: First part of the Travis build life cycle, in which the installation of the required dependencies is done. This part can be optionally initiated using before_install.
  • script: Actual execution of the build. This phase can be optionally surrounded by before_script and after_script.
  • deploy: Finally, the deployment of the build can be optionally made in this phase. This stage has its own life cycle controlled with before_deploy and after_deploy.
YAML is lightweight markup language used broadly for configuration files due to its minimalist syntax. It was originally defined as Yet Another Markup Language, but then it was repurposed to YAML Ain't Markup Language to distinguish its purpose as data oriented.

The following snippet shows an example of .travis.yaml:

language: java
sudo: false
dist: trusty

addons:
firefox: latest
apt:
packages:
- google-chrome-stable
sonarcloud:
organization: "bonigarcia-github"
token:
secure: "encripted-token"

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start &
- sleep 3

script:
- mvn test sonar:sonar
- bash <(curl -s https://codecov.io/bash)

Travis CI provides a web dashboard in which we can check the status of the current and past build generated in the projects using Travis CI of our GitHub account:

Travis CI dashboard
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.32.67