The Build Lifecycle
A build on Travis CI is made up of two steps:
- install: install any dependencies required
- script: run the build script
You can run custom commands before the installation step (
and before (
or after (
the script step.
you can install additional dependencies required by your project such as Ubuntu packages or custom services.
You can perform additional steps when your build succeeds or fails using the
as building documentation, or deploying to a custom server) or
as uploading log files) options. In both
you can access the build result using the
The complete build lifecycle, including three optional deployment steps and after checking out the git repository and changing to the repository directory, is:
- OPTIONAL Install
- OPTIONAL Install
cleaning up cache)
Breaking the Build
If any of the commands in the first four stages of the build lifecycle return a non-zero exit code, the build is broken:
a non-zero exit code, the build is errored and stops immediately.
a non-zero exit code, the build is failed, but continues to run before being marked as failed.
The exit code of
subsequent stages do not affect the build result. However, if one of these stages times out, the build is marked as a failure.
You can run steps before a deploy by using the
A non-zero exit code in this phase will mark the build as errored.
If there are any steps you’d like to run after the deployment, you can use the
It is very common for test suites or build scripts to hang. Travis CI has specific time limits for each job, and will stop the build and add an error message to the build log in the following situations:
- A job produces no log output for 10 minutes
- A job on travis-ci.org takes longer than 50 minutes
- A job on travis-ci.com takes longer than 120 minutes
Some common reasons why builds might hang:
- Waiting for keyboard input or other kind of human interaction
- Concurrency issues (deadlocks, livelocks and so on)
- Installation of native extensions that take very long time to compile
There is no timeout for a build; a build will run as long as all the jobs do as long as each job does not timeout.