9
9
interruptible : true
10
10
11
11
variables :
12
+ GH_PROJECT_PATH : " MatrixAI/${CI_PROJECT_NAME}"
13
+ GH_PROJECT_URL : " https://${GITHUB_TOKEN}@github.com/${GH_PROJECT_PATH}.git"
12
14
GIT_SUBMODULE_STRATEGY : recursive
13
15
# Cache .npm
14
16
NPM_CONFIG_CACHE : " ${CI_PROJECT_DIR}/tmp/npm"
@@ -94,12 +96,10 @@ check:test:
94
96
build:merge :
95
97
stage : build
96
98
needs : []
97
- # Don't interrupt pr creation job
98
- interruptible : false
99
99
allow_failure : true
100
100
script :
101
101
# Required for `gh pr create`
102
- - git remote add upstream "https://${GITHUB_TOKEN}@github.com/MatrixAI/TypeScript-Demo-Lib-Native.git "
102
+ - git remote add upstream "$GH_PROJECT_URL "
103
103
- >
104
104
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
105
105
gh pr create \
@@ -109,10 +109,11 @@ build:merge:
109
109
--body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
110
110
--assignee "@me" \
111
111
--no-maintainer-edit \
112
- --repo MatrixAI/TypeScript-Demo-Lib-Native || true;
113
- gh pr comment staging \
114
- --body "Pipeline Attempt ${CI_PIPELINE_ID} - ${CI_PIPELINE_URL}" \
115
- --repo MatrixAI/TypeScript-Demo-Lib-Native;
112
+ --repo "$GH_PROJECT_PATH" || true;
113
+ printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
114
+ | gh pr comment staging \
115
+ --body-file - \
116
+ --repo "$GH_PROJECT_PATH";
116
117
'
117
118
rules :
118
119
# Runs on staging commits and ignores version commits
@@ -136,7 +137,6 @@ build:linux:
136
137
reports :
137
138
junit :
138
139
- ./tmp/junit.xml
139
- paths :
140
140
# Only the build:linux preserves the dist
141
141
- ./dist
142
142
rules :
@@ -214,7 +214,6 @@ build:prerelease:
214
214
- build:macos
215
215
# Don't interrupt publishing job
216
216
interruptible : false
217
- allow_failure : true
218
217
before_script :
219
218
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
220
219
script :
@@ -276,6 +275,8 @@ integration:deployment:
276
275
- integration:builds
277
276
# Don't interrupt deploying job
278
277
interruptible : false
278
+ # Requires mutual exclusion
279
+ resource_group : integration:deployment
279
280
script :
280
281
- echo 'Perform service deployment for integration testing'
281
282
rules :
@@ -390,12 +391,11 @@ integration:prerelease:
390
391
optional : true
391
392
# Don't interrupt publishing job
392
393
interruptible : false
393
- allow_failure : true
394
394
script :
395
395
- echo 'Publishing application prerelease'
396
396
- >
397
397
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
398
- if gh release view "$CI_COMMIT_TAG" --repo MatrixAI/TypeScript-Demo-Lib-Native >/dev/null; then \
398
+ if gh release view "$CI_COMMIT_TAG" --repo "$GH_PROJECT_PATH" >/dev/null; then \
399
399
gh release \
400
400
upload "$CI_COMMIT_TAG" \
401
401
builds/*.closure.gz \
@@ -404,7 +404,7 @@ integration:prerelease:
404
404
builds/*-win-* \
405
405
builds/*-macos-* \
406
406
--clobber \
407
- --repo MatrixAI/TypeScript-Demo-Lib-Native ; \
407
+ --repo "$GH_PROJECT_PATH" ; \
408
408
else \
409
409
gh release \
410
410
create "$CI_COMMIT_TAG" \
@@ -417,11 +417,11 @@ integration:prerelease:
417
417
--notes "" \
418
418
--prerelease \
419
419
--target staging \
420
- --repo MatrixAI/TypeScript-Demo-Lib-Native ; \
420
+ --repo "$GH_PROJECT_PATH" ; \
421
421
fi;
422
422
'
423
423
rules :
424
- # Only runs on tag pipeline where the tag is a release version
424
+ # Only runs on tag pipeline where the tag is a prerelease version
425
425
# This requires dependencies to also run on tag pipeline
426
426
# However version tag comes with a version commit
427
427
# Dependencies must not run on the version commit
@@ -447,8 +447,8 @@ integration:merge:
447
447
- job : integration:macos
448
448
artifacts : false
449
449
optional : true
450
- # Don't interrupt pr merging job
451
- interruptible : false
450
+ # Requires mutual exclusion
451
+ resource_group : integration:merge
452
452
allow_failure : true
453
453
variables :
454
454
# Ensure that CI/CD is fetching all commits
@@ -458,13 +458,15 @@ integration:merge:
458
458
script :
459
459
- >
460
460
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
461
- gh pr comment staging \
462
- --body "Pipeline Succeeded ${CI_PIPELINE_ID} - ${CI_PIPELINE_URL}" \
463
- --repo MatrixAI/TypeScript-Demo-Lib-Native;
461
+ printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
462
+ | gh pr comment staging \
463
+ --body-file - \
464
+ --repo "$GH_PROJECT_PATH";
464
465
'
465
- - git remote add upstream "https://${GITHUB_TOKEN}@github.com/MatrixAI/TypeScript-Demo-Lib-Native.git "
466
+ - git remote add upstream "$GH_PROJECT_URL "
466
467
- git checkout origin/master
467
- - git merge --ff-only origin/staging
468
+ # Merge up to the current commit (not the latest commit)
469
+ - git merge --ff-only "$CI_COMMIT_SHA"
468
470
- git push upstream HEAD:master
469
471
rules :
470
472
# Runs on staging commits and ignores version commits
@@ -483,6 +485,8 @@ release:deployment:
483
485
artifacts : true
484
486
# Don't interrupt deploying job
485
487
interruptible : false
488
+ # Requires mutual exclusion
489
+ resource_group : release:deployment
486
490
script :
487
491
- echo 'Perform service deployment for production'
488
492
rules :
@@ -516,7 +520,6 @@ release:distribution:
516
520
artifacts : true
517
521
# Don't interrupt publishing job
518
522
interruptible : false
519
- allow_failure : true
520
523
before_script :
521
524
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
522
525
script :
@@ -537,7 +540,7 @@ release:distribution:
537
540
--title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
538
541
--notes "" \
539
542
--target master \
540
- --repo MatrixAI/TypeScript-Demo-Lib-Native ;
543
+ --repo "$GH_PROJECT_PATH" ;
541
544
'
542
545
after_script :
543
546
- rm -f ./.npmrc
0 commit comments