@@ -32,10 +32,10 @@ cache:
32
32
- ./tmp/jest/
33
33
34
34
stages :
35
- - check # Linting, unit tests
36
- - build # Cross-platform library compilation, unit tests
37
- - integration # Cross-platform application bundling, integration tests, and pre-release
38
- - release # Cross-platform distribution and deployment
35
+ - check # Linting, unit tests
36
+ - build # Cross-platform library compilation, unit tests
37
+ - integration # Cross-platform application bundling, integration tests, and pre-release
38
+ - release # Cross-platform distribution and deployment
39
39
40
40
image : registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
41
41
@@ -79,8 +79,10 @@ check:test:
79
79
junit :
80
80
- ./tmp/junit.xml
81
81
rules :
82
+ # Run on feature branches, but not on version commits
82
83
- if : $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
83
- - if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_BRANCH != 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
84
+ # For branches other than master and staging, manually activate, but not on version commits
85
+ - if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
84
86
when : manual
85
87
86
88
build:linux :
@@ -169,8 +171,6 @@ build:macos:
169
171
- if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
170
172
- if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
171
173
172
- # TODO gh prelease with the native addon builds
173
- # TODO: THIS IS A LIBRARY PRERELEASE
174
174
build:prerelease :
175
175
stage : build
176
176
needs :
@@ -183,14 +183,38 @@ build:prerelease:
183
183
before_script :
184
184
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
185
185
script :
186
+ - echo 'Publishing library prerelease'
186
187
- >
187
188
nix-shell --run '
188
189
npm publish --tag prerelease --access public;
189
190
'
191
+ - >
192
+ for d in prebuilds/*; do
193
+ tar \
194
+ --create \
195
+ --verbose \
196
+ --file="prebuilds/$(basename $d).tar" \
197
+ --directory=prebuilds \
198
+ "$(basename $d)";
199
+ done;
200
+ - >
201
+ nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
202
+ gh release \
203
+ create "$CI_COMMIT_TAG" \
204
+ prebuilds/*.tar \
205
+ --title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
206
+ --notes '' \
207
+ --prerelease \
208
+ --target staging \
209
+ --repo MatrixAI/TypeScript-Demo-Lib-Native;
210
+ '
190
211
after_script :
191
212
- rm -f ./.npmrc
192
213
rules :
193
- # Only npm prerelease tags
214
+ # Only runs on tag pipeline, and only where the tag is a prerelease version
215
+ # This requires dependencies to also run on tag pipeline
216
+ # However release tagging comes with a release commit
217
+ # Dependencies must not run on the release commit
194
218
- if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
195
219
196
220
integration:builds :
@@ -227,6 +251,7 @@ integration:builds:
227
251
- ./builds/
228
252
rules :
229
253
- if : $CI_COMMIT_BRANCH == 'staging'
254
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
230
255
231
256
integration:deployment :
232
257
stage : integration
@@ -236,6 +261,7 @@ integration:deployment:
236
261
- echo 'Perform service deployment for integration testing'
237
262
rules :
238
263
- if : $CI_COMMIT_BRANCH == 'staging'
264
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
239
265
240
266
integration:nix :
241
267
stage : integration
@@ -251,6 +277,7 @@ integration:nix:
251
277
- $build_application/bin/typescript-demo-lib
252
278
rules :
253
279
- if : $CI_COMMIT_BRANCH == 'staging'
280
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
254
281
255
282
integration:docker :
256
283
stage : integration
@@ -268,6 +295,7 @@ integration:docker:
268
295
- docker run "$image"
269
296
rules :
270
297
- if : $CI_COMMIT_BRANCH == 'staging'
298
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
271
299
272
300
integration:linux :
273
301
stage : integration
@@ -278,6 +306,7 @@ integration:linux:
278
306
- for f in ./builds/*-linux-*; do "$f"; done
279
307
rules :
280
308
- if : $CI_COMMIT_BRANCH == 'staging'
309
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
281
310
282
311
integration:windows :
283
312
stage : integration
@@ -289,6 +318,7 @@ integration:windows:
289
318
- Get-ChildItem -File ./builds/*-win-* | ForEach {& $_.FullName}
290
319
rules :
291
320
- if : $CI_COMMIT_BRANCH == 'staging'
321
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
292
322
293
323
integration:macos :
294
324
stage : integration
@@ -301,34 +331,70 @@ integration:macos:
301
331
- for f in ./builds/*-macos-x64*; do "$f"; done
302
332
rules :
303
333
- if : $CI_COMMIT_BRANCH == 'staging'
334
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
304
335
305
- # This produces the GH release page with the application builds
306
- # MERGE with the LIBRARY prerelease, since it's all together now
307
336
integration:prerelease :
308
337
stage : integration
309
338
needs :
310
339
- integration:builds
311
- - integration:nix
312
- - integration:docker
313
- - integration:linux
314
- - integration:windows
315
- - integration:macos
340
+ - job : integration:nix
341
+ optional : true
342
+ - job : integration:docker
343
+ optional : true
344
+ - job : integration:linux
345
+ optional : true
346
+ - job : integration:windows
347
+ optional : true
348
+ - job : integration:macos
349
+ optional : true
316
350
# Don't interrupt publishing job
317
351
interruptible : false
318
352
allow_failure : true
319
353
script :
320
- - echo "Use gh to add application binaries to the GH release"
354
+ - echo 'Publishing application prerelease'
355
+ - >
356
+ nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
357
+ if [ gh release view "$CI_COMMIT_TAG" >/dev/null 2>&1 ]; then
358
+ gh release \
359
+ upload "$CI_COMMIT_TAG" \
360
+ builds/*.closure.gz \
361
+ builds/*-docker-* \
362
+ builds/*-linux-* \
363
+ builds/*-win-* \
364
+ builds/*-macos-* \
365
+ --clobber \
366
+ --repo MatrixAI/TypeScript-Demo-Lib-Native;
367
+ else
368
+ gh release \
369
+ create "$CI_COMMIT_TAG" \
370
+ builds/*.closure.gz \
371
+ builds/*-docker-* \
372
+ builds/*-linux-* \
373
+ builds/*-win-* \
374
+ builds/*-macos-* \
375
+ --title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
376
+ --notes '' \
377
+ --prerelease \
378
+ --target staging \
379
+ --repo MatrixAI/TypeScript-Demo-Lib-Native;
380
+ fi;
381
+ '
321
382
rules :
322
- - if : $CI_COMMIT_BRANCH == 'staging'
383
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
323
384
324
385
integration:merge :
325
386
stage : integration
326
387
needs :
327
- - integration:nix
328
- - integration:docker
329
- - integration:linux
330
- - integration:windows
331
- - integration:macos
388
+ - job : integration:nix
389
+ optional : true
390
+ - job : integration:docker
391
+ optional : true
392
+ - job : integration:linux
393
+ optional : true
394
+ - job : integration:windows
395
+ optional : true
396
+ - job : integration:macos
397
+ optional : true
332
398
script :
333
399
- echo 'use gh to create and merge PR from staging to master'
334
400
rules :
@@ -388,26 +454,3 @@ release:distribution:
388
454
rules :
389
455
# Only npm release tags
390
456
- if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/
391
-
392
- # packages:
393
- # stage: release
394
- # image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
395
- # dependencies:
396
- # - nix
397
- # script:
398
- # - >
399
- # nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
400
- # commit="$(git rev-parse --short HEAD)";
401
- # gh release \
402
- # create "$commit" \
403
- # builds/*.closure.gz \
404
- # builds/*-linux-* \
405
- # builds/*-win-* \
406
- # builds/*-macos-* \
407
- # --title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
408
- # --prerelease \
409
- # --notes "" \
410
- # --repo MatrixAI/TypeScript-Demo-Lib;
411
- # '
412
- # only:
413
- # - master
0 commit comments