Skip to content

Commit a4be7d0

Browse files
adding circle config
1 parent 6b4408b commit a4be7d0

File tree

1 file changed

+229
-0
lines changed

1 file changed

+229
-0
lines changed

.circleci/config.yml

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
---
2+
# "Include" for unit tests definition.
3+
unit_tests: &unit_tests
4+
steps:
5+
- checkout
6+
- run:
7+
name: Install modules and dependencies.
8+
command: npm install
9+
- run:
10+
name: Run unit tests.
11+
command: npm test
12+
# TODO: Re-enable after the translation to Typescript is complete
13+
# - run:
14+
# name: Submit coverage data to codecov.
15+
# command: node_modules/.bin/codecov
16+
# when: always
17+
18+
version: 2.0
19+
workflows:
20+
version: 2
21+
tests:
22+
jobs:
23+
- node4:
24+
filters:
25+
tags:
26+
only: /.*/
27+
- node6:
28+
filters:
29+
tags:
30+
only: /.*/
31+
- node7:
32+
filters:
33+
tags:
34+
only: /.*/
35+
- node8:
36+
filters:
37+
tags:
38+
only: /.*/
39+
- node9:
40+
filters:
41+
tags:
42+
only: /.*/
43+
- lint:
44+
requires:
45+
- node4
46+
- node6
47+
- node7
48+
- node8
49+
- node9
50+
filters:
51+
tags:
52+
only: /.*/
53+
- docs:
54+
requires:
55+
- node4
56+
- node6
57+
- node7
58+
- node8
59+
- node9
60+
filters:
61+
tags:
62+
only: /.*/
63+
- system_tests:
64+
requires:
65+
- lint
66+
- docs
67+
filters:
68+
branches:
69+
only: master
70+
tags:
71+
only: /^v[\d.]+$/
72+
- sample_tests:
73+
requires:
74+
- lint
75+
- docs
76+
filters:
77+
branches:
78+
only: master
79+
tags:
80+
only: /^v[\d.]+$/
81+
- publish_npm:
82+
requires:
83+
- system_tests
84+
- sample_tests
85+
filters:
86+
branches:
87+
ignore: /.*/
88+
tags:
89+
only: /^v[\d.]+$/
90+
91+
jobs:
92+
node4:
93+
docker:
94+
- image: node:4
95+
steps:
96+
- checkout
97+
- run:
98+
name: Install modules and dependencies.
99+
command: npm install --unsafe-perm
100+
- run:
101+
name: Run unit tests.
102+
command: npm test
103+
# TODO: Re-enable after the translation to Typescript is complete
104+
# - run:
105+
# name: Submit coverage data to codecov.
106+
# command: node_modules/.bin/codecov
107+
# when: always
108+
node6:
109+
docker:
110+
- image: node:6
111+
<<: *unit_tests
112+
node7:
113+
docker:
114+
- image: node:7
115+
<<: *unit_tests
116+
node8:
117+
docker:
118+
- image: node:8
119+
<<: *unit_tests
120+
node9:
121+
docker:
122+
- image: node:9
123+
<<: *unit_tests
124+
125+
lint:
126+
docker:
127+
- image: node:8
128+
steps:
129+
- checkout
130+
- run:
131+
name: Install modules and dependencies.
132+
command: |
133+
npm install
134+
npm link
135+
- run:
136+
name: Link the module being tested to the samples.
137+
command: |
138+
cd samples/
139+
npm link @google-cloud/error-reporting
140+
npm install
141+
cd ..
142+
- run:
143+
name: Run linting.
144+
command: npm run lint
145+
146+
docs:
147+
docker:
148+
- image: node:8
149+
steps:
150+
- checkout
151+
- run:
152+
name: Install modules and dependencies.
153+
command: npm install
154+
- run:
155+
name: Build documentation.
156+
command: npm run docs
157+
158+
sample_tests:
159+
docker:
160+
- image: node:8
161+
steps:
162+
- checkout
163+
- run:
164+
name: Decrypt credentials.
165+
command: |
166+
openssl aes-256-cbc -d -in .circleci/key.json.enc \
167+
-out .circleci/key.json \
168+
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
169+
- run:
170+
name: Install and link the module.
171+
command: |
172+
npm install
173+
npm link
174+
- run:
175+
name: Link the module being tested to the samples.
176+
command: |
177+
cd samples/
178+
npm link @google-cloud/error-reporting
179+
npm install
180+
cd ..
181+
- run:
182+
name: Run sample tests.
183+
command: npm run samples-test
184+
environment:
185+
GCLOUD_PROJECT: long-door-651
186+
GOOGLE_APPLICATION_CREDENTIALS: /var/error-reporting/.circleci/key.json
187+
- run:
188+
name: Remove unencrypted key.
189+
command: rm .circleci/key.json
190+
when: always
191+
working_directory: /var/error-reporting/
192+
193+
system_tests:
194+
docker:
195+
- image: node:8
196+
steps:
197+
- checkout
198+
- run:
199+
name: Decrypt credentials.
200+
command: |
201+
openssl aes-256-cbc -d -in .circleci/key.json.enc \
202+
-out .circleci/key.json \
203+
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
204+
- run:
205+
name: Install modules and dependencies.
206+
command: npm install
207+
- run:
208+
name: Run system tests.
209+
command: npm run system-test
210+
environment:
211+
GOOGLE_APPLICATION_CREDENTIALS: /var/error-reporting/.circleci/key.json
212+
GCLOUD_TESTS_KEY: /var/error-reporting/.circleci/key.json
213+
- run:
214+
name: Remove unencrypted key.
215+
command: rm .circleci/key.json
216+
when: always
217+
working_directory: /var/error-reporting/
218+
219+
publish_npm:
220+
docker:
221+
- image: node:8
222+
steps:
223+
- checkout
224+
- run:
225+
name: Set NPM authentication.
226+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
227+
- run:
228+
name: Publish the module to npm.
229+
command: npm publish

0 commit comments

Comments
 (0)