Skip to content

Commit ab25a9a

Browse files
committed
WIP
1 parent b89ac01 commit ab25a9a

File tree

2 files changed

+90
-47
lines changed

2 files changed

+90
-47
lines changed

.gitlab-ci.yml

+88-45
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ cache:
3232
- ./tmp/jest/
3333

3434
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
3939

4040
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
4141

@@ -79,8 +79,10 @@ check:test:
7979
junit:
8080
- ./tmp/junit.xml
8181
rules:
82+
# Run on feature branches, but not on version commits
8283
- 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]+)?$/
8486
when: manual
8587

8688
build:linux:
@@ -169,8 +171,6 @@ build:macos:
169171
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
170172
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
171173

172-
# TODO gh prelease with the native addon builds
173-
# TODO: THIS IS A LIBRARY PRERELEASE
174174
build:prerelease:
175175
stage: build
176176
needs:
@@ -183,14 +183,38 @@ build:prerelease:
183183
before_script:
184184
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
185185
script:
186+
- echo 'Publishing library prerelease'
186187
- >
187188
nix-shell --run '
188189
npm publish --tag prerelease --access public;
189190
'
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+
'
190211
after_script:
191212
- rm -f ./.npmrc
192213
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
194218
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
195219

196220
integration:builds:
@@ -227,6 +251,7 @@ integration:builds:
227251
- ./builds/
228252
rules:
229253
- if: $CI_COMMIT_BRANCH == 'staging'
254+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
230255

231256
integration:deployment:
232257
stage: integration
@@ -236,6 +261,7 @@ integration:deployment:
236261
- echo 'Perform service deployment for integration testing'
237262
rules:
238263
- if: $CI_COMMIT_BRANCH == 'staging'
264+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
239265

240266
integration:nix:
241267
stage: integration
@@ -251,6 +277,7 @@ integration:nix:
251277
- $build_application/bin/typescript-demo-lib
252278
rules:
253279
- if: $CI_COMMIT_BRANCH == 'staging'
280+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
254281

255282
integration:docker:
256283
stage: integration
@@ -268,6 +295,7 @@ integration:docker:
268295
- docker run "$image"
269296
rules:
270297
- if: $CI_COMMIT_BRANCH == 'staging'
298+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
271299

272300
integration:linux:
273301
stage: integration
@@ -278,6 +306,7 @@ integration:linux:
278306
- for f in ./builds/*-linux-*; do "$f"; done
279307
rules:
280308
- if: $CI_COMMIT_BRANCH == 'staging'
309+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
281310

282311
integration:windows:
283312
stage: integration
@@ -289,6 +318,7 @@ integration:windows:
289318
- Get-ChildItem -File ./builds/*-win-* | ForEach {& $_.FullName}
290319
rules:
291320
- if: $CI_COMMIT_BRANCH == 'staging'
321+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
292322

293323
integration:macos:
294324
stage: integration
@@ -301,34 +331,70 @@ integration:macos:
301331
- for f in ./builds/*-macos-x64*; do "$f"; done
302332
rules:
303333
- if: $CI_COMMIT_BRANCH == 'staging'
334+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
304335

305-
# This produces the GH release page with the application builds
306-
# MERGE with the LIBRARY prerelease, since it's all together now
307336
integration:prerelease:
308337
stage: integration
309338
needs:
310339
- 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
316350
# Don't interrupt publishing job
317351
interruptible: false
318352
allow_failure: true
319353
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+
'
321382
rules:
322-
- if: $CI_COMMIT_BRANCH == 'staging'
383+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
323384

324385
integration:merge:
325386
stage: integration
326387
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
332398
script:
333399
- echo 'use gh to create and merge PR from staging to master'
334400
rules:
@@ -388,26 +454,3 @@ release:distribution:
388454
rules:
389455
# Only npm release tags
390456
- 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

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)