OSDN Git Service

Regular updates
[twpd/master.git] / circle.md
1 ---
2 title: CircleCI
3 category: Devops
4 layout: 2017/sheet
5 ---
6
7 ### About
8 {: .-intro}
9
10 - <https://circleci.com/docs/config-sample>
11
12 ### circle.yml
13
14 * __machine__: adjusting the VM to your preferences and requirements
15 * __checkout__: checking out and cloning your git repo
16 * __dependencies__: setting up your project's language-specific dependencies
17 * __database__: preparing the databases for your tests
18 * __test__: running your tests
19 * __deployment__: deploying your code to your web servers
20
21 See: <https://circleci.com/docs/configuration>
22
23 ### Sample
24
25 ```yml
26 ## Customize the test machine
27 machine:
28
29   timezone:
30     America/Los_Angeles # Set the timezone
31
32   # Version of ruby to use
33   ruby:
34     version:
35       1.8.7-p358-falcon-perf
36
37   # Override /etc/hosts
38   hosts:
39     circlehost: 127.0.0.1
40     dev.mycompany.com: 127.0.0.1
41
42   # Add some environment variables
43   environment:
44     CIRCLE_ENV: test
45     DATABASE_URL: postgres://ubuntu:@127.0.0.1:5432/circle_test
46
47 ## Customize checkout
48 checkout:
49   post:
50     - git submodule sync
51     - git submodule update --init # use submodules
52
53 ## Customize dependencies
54 dependencies:
55   pre:
56     - npm install coffeescript # install from a different package manager
57     - gem uninstall bundler # use a custom version of bundler
58     - gem install bundler --pre
59
60   override:
61     - bundle install: # note ':' here
62         timeout: 180 # fail if command has no output for 3 minutes
63
64   # we automatically cache and restore many dependencies between
65   # builds. If you need to, you can add custom paths to cache:
66   cache_directories:
67     - "custom_1"   # relative to the build directory
68     - "~/custom_2" # relative to the user's home directory
69
70 ## Customize database setup
71 database:
72   override:
73     # replace CircleCI's generated database.yml
74     - cp config/database.yml.ci config/database.yml
75     - bundle exec rake db:create db:schema:load
76
77 ## Customize test commands
78 test:
79   override:
80     - phpunit test/unit-tests # use PHPunit for testing
81   post:
82     - bundle exec rake jasmine:ci: # add an extra test type
83         environment:
84           RAILS_ENV: test
85           RACK_ENV: test
86
87 ## Customize deployment commands
88 deployment:
89   staging:
90     branch: master
91     heroku:
92       appname: foo-bar-123
93
94 ## Custom notifications
95 notify:
96   webhooks:
97     # A list of hashes representing hooks. Only the url field is supported.
98     - url: https://someurl.com/hooks/circle
99 ```