@@ -23,15 +23,28 @@ workflows:
23
23
- node8
24
24
- node10
25
25
filters : *all_commits
26
- - publish_npm :
26
+ - system_tests :
27
+ requires :
28
+ - lint
29
+ - docs
30
+ filters : &master_and_releases
31
+ branches :
32
+ only : master
33
+ tags : &releases
34
+ only : ' /^v[\d.]+$/'
35
+ - sample_tests :
27
36
requires :
28
37
- lint
29
38
- docs
39
+ filters : *master_and_releases
40
+ - publish_npm :
41
+ requires :
42
+ - system_tests
43
+ - sample_tests
30
44
filters :
31
45
branches :
32
46
ignore : /.*/
33
- tags :
34
- only : ' /^v[\d.]+$/'
47
+ tags : *releases
35
48
nightly :
36
49
triggers :
37
50
- schedule :
@@ -46,17 +59,17 @@ jobs:
46
59
- image : ' node:6'
47
60
user : node
48
61
steps : &unit_tests_steps
49
- - checkout
62
+ - checkout
50
63
- run : &npm_install_and_link
51
64
name : Install and link the module
52
65
command : |-
53
66
mkdir -p /home/node/.npm-global
54
- npm install
67
+ ./.circleci/ npm- install-retry.js
55
68
environment :
56
69
NPM_CONFIG_PREFIX : /home/node/.npm-global
57
70
- run : npm test
58
71
- run : node_modules/.bin/codecov
59
-
72
+
60
73
node8 :
61
74
docker :
62
75
- image : ' node:8'
@@ -74,12 +87,12 @@ jobs:
74
87
steps :
75
88
- checkout
76
89
- run : *npm_install_and_link
77
- - run :
90
+ - run : &samples_npm_install_and_link
78
91
name : Link the module being tested to the samples.
79
92
command : |
80
93
cd samples/
81
- npm install
82
94
npm link ../
95
+ ./../.circleci/npm-install-retry.js
83
96
environment :
84
97
NPM_CONFIG_PREFIX : /home/node/.npm-global
85
98
- run :
@@ -94,14 +107,71 @@ jobs:
94
107
steps :
95
108
- checkout
96
109
- run : *npm_install_and_link
110
+ - run : npm run docs
111
+ sample_tests :
112
+ docker :
113
+ - image : ' node:8'
114
+ user : node
115
+ steps :
116
+ - checkout
97
117
- run :
98
- name : Build documentation.
99
- command : npm run docs
118
+ name : Decrypt credentials.
119
+ command : |
120
+ if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
121
+ openssl aes-256-cbc -d -in .circleci/key.json.enc \
122
+ -out .circleci/key.json \
123
+ -k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
124
+ fi
125
+ - run : *npm_install_and_link
126
+ - run : *samples_npm_install_and_link
127
+ - run :
128
+ name : Run sample tests.
129
+ command : npm run samples-test
130
+ environment :
131
+ GCLOUD_PROJECT : long-door-651
132
+ GOOGLE_APPLICATION_CREDENTIALS : /home/node/samples/.circleci/key.json
133
+ NPM_CONFIG_PREFIX : /home/node/.npm-global
134
+ - run :
135
+ name : Remove unencrypted key.
136
+ command : |
137
+ if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
138
+ rm .circleci/key.json
139
+ fi
140
+ when : always
141
+ working_directory : /home/node/samples/
142
+ system_tests :
143
+ docker :
144
+ - image : ' node:8'
145
+ user : node
146
+ steps :
147
+ - checkout
148
+ - run :
149
+ name : Decrypt credentials.
150
+ command : |
151
+ if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
152
+ openssl aes-256-cbc -d -in .circleci/key.json.enc \
153
+ -out .circleci/key.json \
154
+ -k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
155
+ fi
156
+ - run : *npm_install_and_link
157
+ - run :
158
+ name : Run system tests.
159
+ command : npm run system-test
160
+ environment :
161
+ GOOGLE_APPLICATION_CREDENTIALS : .circleci/key.json
162
+ - run :
163
+ name : Remove unencrypted key.
164
+ command : |
165
+ if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
166
+ rm .circleci/key.json
167
+ fi
168
+ when : always
100
169
publish_npm :
101
170
docker :
102
171
- image : ' node:8'
103
172
user : node
104
173
steps :
105
174
- checkout
106
- - run : ' echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
175
+ - run : ./.circleci/npm-install-retry.js
176
+ - run : echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
107
177
- run : npm publish --access=public
0 commit comments