Travis CI Onboarding
This is a short guide to using Travis CI with your cloud platform-hosted code repository. If you’re new to continuous integration or would like some more information on what Travis CI does, start with Core Concepts for Beginners instead.
Prerequisites #
To start using Travis CI, make sure you have the following:
- A GitHub, Assembla, Bitbucket, or GitLab account.
- Owner permissions for a project hosted on GitHub, Assembla, Bitbucket, or GitLab.
Get Started with Travis CI #
Get started with Travis CI, a continuous integration service used to test and build software projects hosted on GitHub, Assembla, Bitbucket, or GitLab.
- Sign up for Travis CI.
Go to Travis-ci.com and Sign-in with your preferred account.
- Accept Travis CI Authorization.
Once redirected to your chosen platform, log into your account and accept Travis CI’s authorization request.
If you have any doubts about the Travis CI access rights to your chosen platform, read more details here:
- GitHub Authorized OAuth App.
- GitHub permissions used by Travis CI.
- Assembla permissions used by Travis CI
- BitBucket permissions used by Travis CI
- GitLab permissions used by Travis CI
- Verify your email account.
Travis CI sends a verification email. Check your email and verify your account to continue. Otherwise, you will have limited build functions.
- Select a Plan.
Choose the best plan for you, or get started with our Trial Plan.
- Credit Card Validation.
To commence the selected plan, you must first insert your billing information and a valid Credit Card.
Note: For Trial Plans, credit card authorization may result in a small fee being held on the card for a short duration. Trial Plan users are granted a small allotment of trial credits to be used within the next 14 days.
- Settings configurations.
In your Travis Dashboard, click on your profile picture at the top right and select the Settings option to see a list of your available repositories.
- Select repositories.
Click the Manage Repositories button. Once directed to your chosen platform, select the repositories you want to use with Travis CI.
Depending on your chosen platform, you can also make this selection with the authorization message by clicking the Activate all repositories button on the Getting Started page to activate all your repos.
Add a .travis.yml File #
The next step is to add a .travis.yml
file to your repository to tell Travis CI what to do. The following example specifies a Ruby project built with Ruby 2.2 and the latest version of JRuby.
language: ruby
rvm:
- 2.2
- jruby
The defaults for Ruby projects are
bundle install
to install dependencies, andrake
to build the project.
Add the .travis.yml
to a specific location in your repository.
Travis only runs builds on the commits you push after you’ve added a
.travis.yml
file. Finally, visit Travis CI and select your repository to check the build status page to see if your build passes or fails according to the return status of the build command.
Assembla .travis.yml File Configuration #
This section documents the new Assembla option that is currently in beta.
For Assembla users, configure the .travis.yml
as follows:
- Git Repository: in the repositories root (
main
and branches). - SVN Repository:
1. In the
/trunk/
(default is/trunk/.travis.yml
) for builds to run after commits totrunk
. 2. In the/branches/<branch name>/
(e.g.,/branches/abc/.travis.yml
for branch namedabc
) for builds to run after commits to a specific branch. - P4 (Perforce Helix Core) Repository:
1. In the
/<depotname>/main/
(default is/depot/main/.travis.yml
) for builds to run after submits to/<depotname>/main
. 2. In the directory respective to specific stream/depot/<stream name>/
.travis.yml (e.g.,/depot/abc/.travis.yml
for streamabc
) for builds to run after submits to a specific stream.
IMPORTANT
Perforce depot/repository may be very heavy, so downloading it fully for build (e.g., terabytes of data) is often unwanted, as the source code to be built/tested is only a fraction of the whole depot size. To download it partially, a Travis CI user must define a specific subpath, which is later downloaded by the Travis CI build job. Such subpaths may be defined using the perforce_test_path
tag within a .travis.yml
file. If the property is not provided, the default behavior is downloading the whole depot/repository.
See the example below for reference.
dist: focal
language: ruby
rvm:
- 2.2
- jruby
perforce_test_path: /your/subpath/within/repository/which/will/be/downloaded
Perforce and SVN builds are currently available only for Linux Ubuntu and standard amd64 CPU architecture build environments, starting from the Bionic Beaver Ubuntu distribution.
Switch Accounts #
You can easily switch between your cloud platform provider accounts:
-
Click on your account icon in the top right corner on Travis-ci.com.
-
Select the desired account and have fun using Travis CI.
Select a different programming language #
Use one of these common languages:
language: ruby
language: java
language: node_js
language: python
language: php
language: go
If you have tests that need to run on macOS or your project uses Swift or Objective-C, use our macOS environment:
os: osx
You do not necessarily need to use macOS if you develop on a Mac. macOS is required only if you need Swift, Objective-C, or other macOS-specific software.
Travis CI supports many programming languages.
Further Reading #
Find more useful information in our Tutorial pages: