OSDN Git Service

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