Travis ci-a free integrated test environment

Source: Internet
Author: User

Travis Ci is a continuous integration environment dedicated to open-source projects. If you have an open-source project on GitHub, Travis Ci is a perfect choice for open-source CI. In Travis CI

You can log in directly with the GitHub account and configure continuous integration for your project. The following describes how to use Travis CI to practice my own open-source demo Java Web project CI configuration.


Implementation of Java Web project continuous integration is very simple, divided into two parts:


Part 1: project configuration in Travis Ci

Log on to the GitHub account in Travis Ci and select the project to be continuously integrated. Click the project button to enable integration and authorize Travis CI to access your repository, by default, the integration is triggered every time the push is performed.


Part 2: GitHub project configuration

1. Add a file. Travis. yml in the root directory of your project.

2. The specific configuration of. Travis. yml in my project is as follows:

language: javajdk:#  - oraclejdk7#  - openjdk7  - openjdk6before_install:#  - mvn install -Dmaven.javadoc.skip=true   - "echo skipped"install:  - "echo skipped"script:#  - "echo skipped"   - mvn install -Dmaven.javadoc.skip=true# - mvn deploynotifications:  email:    recipients:      - ******@***.com    #on_success: [always|never|change]  default: change    #on_failure: [always|never|change]  default: always
This file should be well understood:

A. First, let's tell Travis CI what our language is. In this way, it will select the build tool for you based on your language. For Java, Travis CI will automatically match whether the build tool is Maven (whether the root directory contains Pom. XML ).

B. The next JDK will tell Travis Ci in which environments I want to test ., When code is submitted, Travis CI runs our tests in different JDK environments to ensure project version compatibility.

C. next, the commands to be executed at various stages of the life cycle should be executed. Execute before_install and install on the installation dependencies, and then execute before_script, script, after_success or after_failure and after_script on the specific build. In Travis CI, MVN install-dskiptests = true is executed in the instal stage for Maven project construction, and MVN test is executed in the script stage. These commands will be tried three times, because my web project has implemented the intergation test, executing the MVN install-dskiptests = true command will first test the integration test and then test the unit test in the script stage, so I made some modifications to the script to be executed, and directly executed all tests in the script stage.

D. Configure the notification to notify the user of the successful or failed CI. Email and IRC are supported.

3. Make sure that there is no syntax error in. Travis. yml in the http://lint.travis-ci.org.

4. Modify the user name and password configuration of the database in the system. Travis CI supports various databases, such as MySQL, PostgreSQL, and MongoDB. In Travis CI, the default username of the MySQL database is root or Travis, and the password is blank. For more details about the specific database, refer to: Database Support

5. As a result, my open-source project also has its own CI.

For more details, see the Travis CI document.


Note:There is a status icon in the upper right corner of the Travis CI project page. Click it to view the project status chart link provided by Travis CI. Select markdown and paste it to the README file of your GitHub project.




Travis ci-a free integrated test environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.