-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathconfig.yml
185 lines (168 loc) · 5.36 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# These environment variables must be set in CircleCI UI
#
# NPM_TOKEN - A valid NPM token for releases
version: 2.1
references:
defaults: &defaults
working_directory: ~/addons-linter
docker:
# This is the NodeJS version we run in production.
- image: circleci/node:12
defaults-next: &defaults-next
<<: *defaults
docker:
# This is the next NodeJS version we will support.
- image: circleci/node:14
defaults-alternate: &defaults-alternate
<<: *defaults
docker:
# This is an alternate Node version we support or want to support in the
# (far) future. It can either be lower or higher than the current Node
# version we run in production.
- image: circleci/node:16
restore_build_cache: &restore_build_cache
restore_cache:
name: restore npm package cache
keys:
- npm-packages-{{ checksum "package-lock.json" }}
run_npm_install: &run_npm_install
run:
name: install dependencies
command: npm install
save_build_cache: &save_build_cache
save_cache:
name: save npm package cache
key: npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
make_production_build: &make_production_build
run:
name: build project
command: |
node scripts/build-locales
NODE_ENV=production npm run build
configure_global_npm: &configure_global_npm
run:
name: create custom directory for global npm installs
# This is required to avoid a `EACCES` when running `npm link` (which is
# executed in the test suite).
command: |
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
restore_next_build_cache: &restore_next_build_cache
restore_cache:
name: restore npm package cache
keys:
- next-npm-packages-{{ checksum "package-lock.json" }}
save_next_build_cache: &save_next_build_cache
save_cache:
name: save npm package cache
key: next-npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
restore_alternate_build_cache: &restore_alternate_build_cache
restore_cache:
name: restore npm package cache
keys:
- alternate-npm-packages-{{ checksum "package-lock.json" }}
save_alternate_build_cache: &save_alternate_build_cache
save_cache:
name: save npm package cache
key: alternate-npm-packages-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
jobs:
test:
<<: *defaults
steps:
- checkout
- *restore_build_cache
- *run_npm_install
- *save_build_cache
- *make_production_build
- *configure_global_npm
- run: npm run test-ci
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run lint
- run: npm run prettier-ci
- run:
name: build rules
command: |
npm run build-rules
# This will return a non-zero exit code if content in the docs/
# folder has changed. When this fails, run the following command
# and commit the changes:
#
# npm run build-rules
#
git diff --name-only --exit-code docs
# Set up a workspace to share data between this job and the `release-tag`
# one when we want to publish a new npm version.
- persist_to_workspace:
root: ~/addons-linter
paths: .
# This should run after we persist the workspace because this command
# invokes `npm install`.
- run: npm run webext-test-functional
- store_artifacts:
path: coverage
test-next:
<<: *defaults-next
steps:
- checkout
- *restore_next_build_cache
- *run_npm_install
- *save_next_build_cache
- *make_production_build
- *configure_global_npm
- run: npm run test-ci
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run webext-test-functional
test-alternate:
<<: *defaults-alternate
steps:
- checkout
- *restore_alternate_build_cache
- *run_npm_install
- *save_alternate_build_cache
- *make_production_build
- *configure_global_npm
- run: npm run test-ci
# run integration tests using an addons-linter binary in a
# production-like environment
- run: npm run test-integration:production
- run: npm run webext-test-functional
release-tag:
<<: *defaults
steps:
- attach_workspace:
at: ~/addons-linter
- run:
name: authenticate with registry
# We don't want to expand the token in this file, npm will do it.
command: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/addons-linter/.npmrc
- run:
name: publish package
command: npm publish
workflows:
version: 2
default-workflow:
jobs:
- test:
filters: # required since `release-tag` has tag filters AND requires `test`
tags:
only: /.*/
- test-next
- test-alternate
- release-tag:
requires:
- test
filters:
tags:
only: /.*/
branches:
ignore: /.*/