UNPKG

3.94 kBYAMLView Raw
1version: 2.1
2
3executors:
4 node:
5 docker:
6 - image: circleci/node:12.7
7 working_directory: ~/repo
8 environment:
9 GIT_AUTHOR_EMAIL: visjsbot@gmail.com
10 GIT_AUTHOR_NAME: vis-bot
11 GIT_COMMITTER_EMAIL: visjsbot@gmail.com
12 GIT_COMMITTER_NAME: vis-bot
13
14jobs:
15 prepare:
16 executor: node
17
18 steps:
19 - checkout
20
21 # Download and cache dependencies
22 - restore_cache:
23 keys:
24 - v1-dependencies-{{ checksum "package.json" }}
25 # fallback to using the latest cache if no exact match is found
26 - v1-dependencies-
27
28 - run: npm ci
29
30 - save_cache:
31 paths:
32 - node_modules
33 key: v1-dependencies-{{ checksum "package.json" }}
34
35 - persist_to_workspace:
36 root: .
37 paths:
38 - '*'
39
40 build:
41 executor: node
42
43 steps:
44 - attach_workspace:
45 at: .
46
47 - run: npm run build
48
49 - persist_to_workspace:
50 root: .
51 paths:
52 - 'dist'
53
54 examples:
55 executor: node
56
57 steps:
58 - attach_workspace:
59 at: .
60
61 - run:
62 name: Install dependencies for headless Chromium
63 command: |
64 sudo apt-get install -yq \
65 ca-certificates fonts-liberation gconf-service libappindicator1 \
66 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 \
67 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \
68 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 \
69 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 \
70 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 \
71 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget \
72 xdg-utils
73
74 - run: npm run generate-examples-index
75
76 - persist_to_workspace:
77 root: .
78 paths:
79 - 'examples'
80
81 lint:
82 executor: node
83
84 steps:
85 - attach_workspace:
86 at: .
87
88 - run: npm run lint
89
90 test:
91 executor: node
92
93 steps:
94 - attach_workspace:
95 at: .
96
97 - run: npm run test-cov
98
99 gh_pages:
100 executor: node
101
102 steps:
103 - attach_workspace:
104 at: .
105
106 - run:
107 name: Set Git credentials
108 command: |
109 echo 'machine github.com' >> ~/.netrc
110 echo " login $GIT_AUTHOR_NAME" >> ~/.netrc
111 echo " password $GH_TOKEN" >> ~/.netrc
112
113 - run:
114 name: Publish GitHub Pages
115 command: |
116 npx gh-pages --dist . --message "chore: update to $(git rev-parse HEAD) [ci skip]" --repo "$(node -e 'process.stdout.write(require("./package.json").repository.url)')" --src '{{coverage,dist,docs,examples}/**/*,LICENSE*,*.{html,md}}'
117
118 release:
119 executor: node
120
121 steps:
122 - attach_workspace:
123 at: .
124
125 - run:
126 name: Prepare NPM
127 command: |
128 npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
129
130 - run:
131 name: Release
132 command: |
133 npx semantic-release
134
135workflows:
136 version: 2
137
138 build:
139 jobs:
140 - prepare
141
142 - build:
143 requires:
144 - prepare
145
146 - examples:
147 requires:
148 - prepare
149 - build
150
151 # Enable when the code base is ready.
152 # - lint:
153 # requires:
154 # - prepare
155
156 - test:
157 requires:
158 - prepare
159
160 - gh_pages:
161 requires:
162 - prepare
163 - build
164 - examples
165 # - lint
166 - test
167 filters:
168 branches:
169 only:
170 - master
171
172 - release:
173 requires:
174 - prepare
175 - build
176 - examples
177 # - lint
178 - test
179 filters:
180 branches:
181 only:
182 - master