/
config.yml
137 lines (131 loc) · 3.11 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
# "Include" for unit tests definition.
remove_package_lock: &remove_package_lock
name: Remove package-lock.json if needed.
command: |
WORKFLOW_NAME=`python .circleci/get_workflow_name.py`
echo "Workflow name: $WORKFLOW_NAME"
if [ "$WORKFLOW_NAME" = "nightly" ]; then
echo "Nightly build detected, removing package-lock.json"
rm -f package-lock.json
else
echo "Not a nightly build, skipping this step."
fi
unit_tests: &unit_tests
steps:
- checkout
- run: *remove_package_lock
- run:
name: Install modules and dependencies.
command: npm install
- run:
name: Run unit tests.
command: npm test
- run:
name: Submit coverage data to codecov.
command: node_modules/.bin/codecov
when: always
# Testing the samples requires running `npm link` and
# `npm link googleapis`, which attempts to make a global
# change. This leads to a permissions error unless the
# global npm module directory is changed. These samples
# only tested against latest LTS.
test_samples: &test_samples
steps:
- checkout
- run: *remove_package_lock
- run: npm install
- run: mkdir ~/.npm-packages
- run: echo "prefix = $HOME/.npm-packages" >> ~/.npmrc
- run: export PATH=~/.npm-packages/bin:$PATH
- run: make && make test-samples
version: 2.0
workflows:
version: 2
tests:
jobs: &workflow_jobs
- node4:
filters:
tags:
only: /.*/
- node6:
filters:
tags:
only: /.*/
- node8:
filters:
tags:
only: /.*/
- node9:
filters:
tags:
only: /.*/
- node10:
filters:
tags:
only: /.*/
- publish_npm:
requires:
- node4
- node6
- node8
- node9
- node10
filters:
branches:
ignore: /.*/
tags:
only: /^v[\d.]+$/
nightly:
triggers:
- schedule:
cron: 0 7 * * *
filters:
branches:
only: master
jobs: *workflow_jobs
jobs:
node4:
docker:
- image: node:4
user: node
<<: *unit_tests
node6:
docker:
- image: node:6
user: node
<<: *unit_tests
node8:
docker:
- image: node:8
user: node
<<: *unit_tests
<<: *test_samples
node9:
docker:
- image: node:9
user: node
<<: *unit_tests
node10:
docker:
- image: node:10
user: node
<<: *unit_tests
publish_npm:
docker:
- image: node:8
user: node
steps:
- checkout
- run:
name: Install modules and dependencies.
command: npm install --unsafe-perm
- run:
name: Build
command: make build
- run:
name: Set NPM authentication.
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run:
name: Publish the module to npm.
command: npm publish --access=public