This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
194 lines (194 loc) · 4.24 KB
/
.gitlab-ci.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
186
187
188
189
190
191
192
193
194
image: node:latest
stages:
- build
- test
- post_test
- deploy
build_commonjs:
stage: build
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull-push
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-common"
paths:
- lib/common
expire_in: 1 hour
script:
- yarn install
- yarn build:common
build_es6:
stage: build
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull-push
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-es6"
paths:
- lib/es6
expire_in: 1 hour
script:
- yarn install
- yarn build:es6
build_quality:
stage: build
script:
- yarn install
- yarn build:quality
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-quality"
paths:
- quality/
expire_in: 1 hour
build_docs:
stage: build
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull-push
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-docs"
paths:
- docs/
expire_in: 1 hour
script:
- yarn install
- yarn build:docs
test_commonjs_node_6:
stage: test
image: node:6
dependencies:
- build_commonjs
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
script:
- yarn install
- yarn test
test_commonjs_node_8:
stage: test
image: node:8
dependencies:
- build_commonjs
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
script:
- yarn install
- yarn test
test_commonjs_node_10:
stage: test
image: node:10
dependencies:
- build_commonjs
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
script:
- yarn install
- yarn test
test_commonjs_node_latest:
stage: test
image: node:latest
dependencies:
- build_commonjs
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
artifacts:
paths:
- .nyc_output/
script:
- yarn install
- "./node_modules/.bin/nyc -x \"**/lib/es6/**/*.js\" -x \"**/src/**/*.js\" -x \"**/tests/**/*.js\" yarn test"
code_coverage:
stage: post_test
image: node:latest
allow_failure: true
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
script:
- "./node_modules/.bin/nyc report --reporter=\"text-summary\" --reporter=\"lcov\""
dependencies:
- test_commonjs_node_latest
artifacts:
paths:
- coverage/lcov-report/
expire_in: 1 day
coverage: '/^Statements\s*:\s*([^%]+)/'
code_quality:
image: docker:latest
stage: post_test
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
dependencies:
- build_quality
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD/quality"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [gl-code-quality-report.json]
dependency_scanning:
image: docker:latest
stage: post_test
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
dependencies:
- build_commonjs
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- node_modules/
policy: pull
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code
artifacts:
paths: [gl-dependency-scanning-report.json]
publish_npm:
stage: deploy
only:
- tags
- triggers
dependencies:
- build_docs
- build_commonjs
- build_es6
script:
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- npm publish --scope=@openrailuk --access=public