/
config.yml
109 lines (103 loc) · 2.51 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
---
# "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: npm install
- run: 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
- node6:
filters:
tags:
only: /.*/
- node8:
filters:
tags:
only: /.*/
- node10:
filters:
tags:
only: /.*/
- publish_npm:
requires:
- node6
- node8
- node10
filters:
branches:
ignore: /.*/
tags:
only: /^v[\d.]+$/
nightly:
triggers:
- schedule:
cron: 0 7 * * *
filters:
branches:
only: master
jobs: *workflow_jobs
jobs:
node6:
docker:
- image: node:6
user: node
<<: *unit_tests
node8:
docker:
- image: node:8
user: node
<<: *unit_tests
<<: *test_samples
node10:
docker:
- image: node:10
user: node
<<: *unit_tests
publish_npm:
docker:
- image: node:8
user: node
steps:
- checkout
- run: npm install
- run:
name: Build
command: make build
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run:
name: Publish the module to npm.
command: npm publish --access=public