OSDN Git Service

Regular updates
[twpd/master.git] / travis.md
1 ---
2 title: Travis.yml
3 category: Devops
4 layout: 2017/sheet
5 prism_languages: [yaml]
6 intro: |
7   Quick reference for [Travis CI](https://travis-ci.org) yaml configuration. See [official documentation](https://docs.travis-ci.com/user/customizing-the-build/).
8 ---
9
10 ## Reference
11 {:.-three-column}
12
13 ### Node.js
14
15 ```yaml
16 language: node_js
17 node_js:
18   - '4'
19 ```
20
21 Defaults install to `npm install`, and defaults test to `npm test`.
22
23 ### Ruby
24
25 ```yaml
26 language: ruby
27 rvm:
28   - 2.0.0
29   - 1.9.3
30   - 1.8.7
31 ```
32
33 Defaults install to `bundle install`, defaults test to `rake`.
34
35 ### Build lifecycle
36
37 | Lifecycle                          |
38 | ---------------------------------- |
39 | `before_install`                   |
40 | `install`                          |
41 | ---                                |
42 | `before_script`                    |
43 | `script`                           |
44 | ---                                |
45 | `after_success` or `after_failure` |
46 | `after_script`                     |
47 | ---                                |
48 | `before_deploy` (optional)         |
49 | `deploy` (optional)                |
50 | `after_deploy` (optional)          |
51
52 ### Branches
53
54 ```yaml
55 branches:
56   except: ['..']
57   only: ['master']
58 ```
59
60 ### Environment vars
61
62 ```yaml
63 env:
64   - 'rack=master'
65   - 'rack=1.3.4'
66 ```
67
68 ### Custom test command
69
70 ```yaml
71 script: make test
72 before_script: make pretest
73 after_script:  make clean
74
75 before_script:
76   - make pretest1
77   - make pretest2
78 ```
79
80 ### Branches
81
82 ```yaml
83 branches:
84   except:
85     - legacy
86
87   only:
88     - gh-pages
89     - /^deploy/
90 ```
91
92 ### Apt packages
93
94 ```yaml
95 before_install:
96   - sudo apt-get update -q
97   - sudo apt-get install gcc-4.8 -y
98 ```
99
100 <https://docs.travis-ci.com/user/installing-dependencies/>
101
102 ### Etc
103
104 ```yaml
105 gemfile:
106   - gemfiles/Gemfile.rails-2.3.x
107   - gemfiles/Gemfile.rails-3.0.x
108 ```
109
110 ### References
111
112 - http://about.travis-ci.org/docs/user/build-configuration/
113 - http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/
114 - http://about.travis-ci.org/docs/user/languages/ruby/