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