@@ -13,9 +13,6 @@ variables:
13
13
npm_config_cache : " ${CI_PROJECT_DIR}/tmp/npm"
14
14
# Prefer offline node module installation
15
15
npm_config_prefer_offline : " true"
16
- # `ts-node` has its own cache
17
- TS_CACHED_TRANSPILE_CACHE : " ${CI_PROJECT_DIR}/tmp/ts-node-cache"
18
- TS_CACHED_TRANSPILE_PORTABLE : " true"
19
16
# Homebrew cache only used by macos runner
20
17
HOMEBREW_CACHE : " ${CI_PROJECT_DIR}/tmp/Homebrew"
21
18
33
30
when : ' always'
34
31
paths :
35
32
- ./tmp/npm/
36
- - ./tmp/ts-node-cache/
37
33
# Homebrew cache is only used by the macos runner
38
34
- ./tmp/Homebrew
39
35
# Chocolatey cache is only used by the windows runner
@@ -56,10 +52,11 @@ check:lint:
56
52
needs : []
57
53
script :
58
54
- >
59
- nix-shell --run '
60
- npm run lint;
61
- npm run lint-native;
62
- '
55
+ nix-shell --arg ci true --run $'
56
+ npm run lint;
57
+ npm run lint-native;
58
+ npm run lint-shell;
59
+ '
63
60
rules :
64
61
# Runs on feature and staging commits and ignores version commits
65
62
- if : $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
@@ -74,10 +71,10 @@ check:test:
74
71
needs : []
75
72
script :
76
73
- >
77
- nix-shell --run '
78
- npm run build --verbose;
79
- npm test -- --ci --coverage;
80
- '
74
+ nix-shell --arg ci true -- run $ '
75
+ npm run prebuild --verbose;
76
+ npm test -- --ci --coverage;
77
+ '
81
78
artifacts :
82
79
when : always
83
80
reports :
@@ -88,7 +85,7 @@ check:test:
88
85
path : ./tmp/coverage/cobertura-coverage.xml
89
86
coverage : ' /All files[^|]*\|[^|]*\s+([\d\.]+)/'
90
87
rules :
91
- # Runs on staging commits and ignores version commits
88
+ # Runs on feature commits and ignores version commits
92
89
- if : $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
93
90
# Manually run on commits other than master and staging and ignore version commits
94
91
- if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
@@ -102,20 +99,38 @@ build:merge:
102
99
# Required for `gh pr create`
103
100
- git remote add upstream "$GH_PROJECT_URL"
104
101
- >
105
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
106
- gh pr create \
107
- --head staging \
108
- --base master \
109
- --title "ci: merge staging to master" \
110
- --body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
111
- --assignee "@me" \
112
- --no-maintainer-edit \
113
- --repo "$GH_PROJECT_PATH" || true;
114
- printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
115
- | gh pr comment staging \
116
- --body-file - \
117
- --repo "$GH_PROJECT_PATH";
118
- '
102
+ nix-shell --arg ci true --run $'
103
+ gh pr create \
104
+ --head staging \
105
+ --base master \
106
+ --title "ci: merge staging to master" \
107
+ --body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
108
+ --assignee "@me" \
109
+ --no-maintainer-edit \
110
+ --repo "$GH_PROJECT_PATH" || true;
111
+ printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
112
+ | gh pr comment staging \
113
+ --body-file - \
114
+ --repo "$GH_PROJECT_PATH";
115
+ '
116
+ rules :
117
+ # Runs on staging commits and ignores version commits
118
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
119
+ # Runs on tag pipeline where the tag is a prerelease or release version
120
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
121
+
122
+ build:dist :
123
+ stage : build
124
+ needs : []
125
+ script :
126
+ - >
127
+ nix-shell --arg ci true --run $'
128
+ npm run build --ignore-scripts --verbose;
129
+ '
130
+ artifacts :
131
+ when : always
132
+ paths :
133
+ - ./dist
119
134
rules :
120
135
# Runs on staging commits and ignores version commits
121
136
- if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
@@ -130,10 +145,11 @@ build:linux:
130
145
npm_config_arch : " x64"
131
146
script :
132
147
- >
133
- nix-shell --run '
134
- npm run build --verbose;
135
- npm test -- --ci --coverage;
136
- '
148
+ nix-shell --arg ci true --run $'
149
+ npm run prebuild --verbose;
150
+ npm test -- --ci --coverage;
151
+ npm run bench;
152
+ '
137
153
artifacts :
138
154
when : always
139
155
reports :
@@ -142,10 +158,9 @@ build:linux:
142
158
coverage_report :
143
159
coverage_format : cobertura
144
160
path : ./tmp/coverage/cobertura-coverage.xml
161
+ metrics : ./benches/results/metrics.txt
145
162
paths :
146
163
- ./prebuilds/
147
- # Only the build:linux preserves the dist
148
- - ./dist
149
164
coverage : ' /All files[^|]*\|[^|]*\s+([\d\.]+)/'
150
165
rules :
151
166
# Runs on staging commits and ignores version commits
@@ -170,13 +185,18 @@ build:windows:
170
185
- refreshenv
171
186
- npm install --ignore-scripts
172
187
- $env:Path = "$(npm bin);" + $env:Path
173
- - npm run build --verbose
174
- - npm test -- --ci
188
+ - npm run prebuild --verbose
189
+ - npm test -- --ci --coverage
190
+ - npm run bench
175
191
artifacts :
176
192
when : always
177
193
reports :
178
194
junit :
179
195
- ./tmp/junit/junit.xml
196
+ coverage_report :
197
+ coverage_format : cobertura
198
+ path : ./tmp/coverage/cobertura-coverage.xml
199
+ metrics : ./benches/results/metrics.txt
180
200
paths :
181
201
- ./prebuilds/
182
202
rules :
@@ -202,13 +222,18 @@ build:macos:
202
222
- hash -r
203
223
- npm install --ignore-scripts
204
224
- export PATH="$(npm bin):$PATH"
205
- - npm run build --verbose
206
- - npm test -- --ci
225
+ - npm run prebuild --verbose
226
+ - npm test -- --ci --coverage
227
+ - npm run bench
207
228
artifacts :
208
229
when : always
209
230
reports :
210
231
junit :
211
232
- ./tmp/junit/junit.xml
233
+ coverage_report :
234
+ coverage_format : cobertura
235
+ path : ./tmp/coverage/cobertura-coverage.xml
236
+ metrics : ./benches/results/metrics.txt
212
237
paths :
213
238
- ./prebuilds/
214
239
rules :
@@ -220,19 +245,19 @@ build:macos:
220
245
build:prerelease :
221
246
stage : build
222
247
needs :
248
+ - build:dist
223
249
- build:linux
224
250
- build:windows
225
251
- build:macos
226
252
# Don't interrupt publishing job
227
253
interruptible : false
228
- before_script :
229
- - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
230
254
script :
255
+ - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
231
256
- echo 'Publishing library prerelease'
232
257
- >
233
- nix-shell --run '
234
- npm publish --tag prerelease --access public;
235
- '
258
+ nix-shell --arg ci true -- run $ '
259
+ npm publish --tag prerelease --access public;
260
+ '
236
261
- >
237
262
for d in prebuilds/*; do
238
263
tar \
@@ -243,16 +268,16 @@ build:prerelease:
243
268
"$(basename $d)";
244
269
done
245
270
- >
246
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
247
- gh release \
248
- create "$CI_COMMIT_TAG" \
249
- prebuilds/*.tar \
250
- --title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
251
- --notes "" \
252
- --prerelease \
253
- --target staging \
254
- --repo "$GH_PROJECT_PATH";
255
- '
271
+ nix-shell --arg ci true --run $ '
272
+ gh release \
273
+ create "$CI_COMMIT_TAG" \
274
+ prebuilds/*.tar \
275
+ --title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
276
+ --notes "" \
277
+ --prerelease \
278
+ --target staging \
279
+ --repo "$GH_PROJECT_PATH";
280
+ '
256
281
after_script :
257
282
- rm -f ./.npmrc
258
283
rules :
@@ -282,12 +307,12 @@ integration:merge:
282
307
GIT_DEPTH : 0
283
308
script :
284
309
- >
285
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
286
- printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
287
- | gh pr comment staging \
288
- --body-file - \
289
- --repo "$GH_PROJECT_PATH";
290
- '
310
+ nix-shell --arg ci true --run $ '
311
+ printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
312
+ | gh pr comment staging \
313
+ --body-file - \
314
+ --repo "$GH_PROJECT_PATH";
315
+ '
291
316
- git remote add upstream "$GH_PROJECT_URL"
292
317
- git checkout origin/master
293
318
# Merge up to the current commit (not the latest commit)
@@ -302,20 +327,20 @@ integration:merge:
302
327
release:distribution :
303
328
stage : release
304
329
needs :
330
+ - build:dist
305
331
- build:linux
306
332
- build:windows
307
333
- build:macos
308
334
- integration:merge
309
335
# Don't interrupt publishing job
310
336
interruptible : false
311
- before_script :
312
- - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
313
337
script :
338
+ - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
314
339
- echo 'Publishing library'
315
340
- >
316
- nix-shell --run '
317
- npm publish --access public;
318
- '
341
+ nix-shell --arg ci true -- run $ '
342
+ npm publish --access public;
343
+ '
319
344
- >
320
345
for d in prebuilds/*; do
321
346
tar \
@@ -326,15 +351,15 @@ release:distribution:
326
351
"$(basename $d)";
327
352
done
328
353
- >
329
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
330
- gh release \
331
- create "$CI_COMMIT_TAG" \
332
- prebuilds/*.tar \
333
- --title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
334
- --notes "" \
335
- --target master \
336
- --repo "$GH_PROJECT_PATH";
337
- '
354
+ nix-shell --arg ci true --run $ '
355
+ gh release \
356
+ create "$CI_COMMIT_TAG" \
357
+ prebuilds/*.tar \
358
+ --title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
359
+ --notes "" \
360
+ --target master \
361
+ --repo "$GH_PROJECT_PATH";
362
+ '
338
363
after_script :
339
364
- rm -f ./.npmrc
340
365
rules :
0 commit comments