cheatsheets/travis.md

114 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2013-10-14 02:36:58 +00:00
---
title: Travis.yml
2018-12-06 22:15:40 +00:00
category: Devops
prism_languages: [yaml]
intro: |
Quick reference for [Travis CI](https://travis-ci.org) yaml configuration. See [official documentation](https://docs.travis-ci.com/user/customizing-the-build/).
2013-05-29 12:19:07 +00:00
---
## Reference
{:.-three-column}
2013-05-29 12:19:07 +00:00
### Node.js
```yaml
2015-10-15 10:55:41 +00:00
language: node_js
node_js:
- '4'
2015-10-15 10:55:41 +00:00
```
2013-05-29 12:19:07 +00:00
Defaults install to `npm install`, and defaults test to `npm test`.
2013-05-29 12:19:07 +00:00
### Ruby
```yaml
2015-10-15 10:55:41 +00:00
language: ruby
rvm:
- 2.0.0
- 1.9.3
- 1.8.7
2015-10-15 10:55:41 +00:00
```
Defaults install to `bundle install`, defaults test to `rake`.
2015-10-15 10:55:41 +00:00
### Build lifecycle
| Lifecycle |
| ---------------------------------- |
| `before_install` |
| `install` |
| --- |
| `before_script` |
| `script` |
| --- |
| `after_success` or `after_failure` |
| `after_script` |
| --- |
| `before_deploy` (optional) |
| `deploy` (optional) |
| `after_deploy` (optional) |
2013-05-29 12:19:07 +00:00
### Branches
```yaml
branches:
except: ['..']
only: ['master']
```
2013-05-29 12:19:07 +00:00
### Environment vars
```yaml
env:
- 'rack=master'
- 'rack=1.3.4'
```
2013-05-29 12:19:07 +00:00
2013-06-20 05:38:19 +00:00
### Custom test command
2013-05-29 12:19:07 +00:00
```yaml
script: make test
before_script: make pretest
after_script: make clean
2013-05-29 12:19:07 +00:00
before_script:
- make pretest1
- make pretest2
```
2013-05-29 12:19:07 +00:00
2013-06-20 05:38:19 +00:00
### Branches
```yaml
branches:
except:
- legacy
2013-06-20 05:38:19 +00:00
only:
- gh-pages
- /^deploy/
```
2013-06-20 05:38:19 +00:00
2016-08-11 10:26:59 +00:00
### Apt packages
```yaml
before_install:
- sudo apt-get update -q
- sudo apt-get install gcc-4.8 -y
```
2016-08-11 10:26:59 +00:00
<https://docs.travis-ci.com/user/installing-dependencies/>
2013-06-20 05:38:19 +00:00
### Etc
```yaml
gemfile:
- gemfiles/Gemfile.rails-2.3.x
- gemfiles/Gemfile.rails-3.0.x
```
2013-06-20 05:38:19 +00:00
2013-05-29 12:19:07 +00:00
### References
- https://about.travis-ci.org/docs/user/build-configuration/
- https://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/
- https://about.travis-ci.org/docs/user/languages/ruby/