Skip to content

Commit ceaebe6

Browse files
authored
Merge pull request #394 from MatrixAI/feature-test-load-balancing
Test load balancing (migrating changes from TypeScript-Demo-Lib)
2 parents a5010c0 + 2dd3fa3 commit ceaebe6

11 files changed

Lines changed: 1324 additions & 2004 deletions

.gitlab-ci.yml

Lines changed: 44 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ default:
2929
# Cached directories shared between jobs & pipelines per-branch per-runner
3030
cache:
3131
key: $CI_COMMIT_REF_SLUG
32+
# Preserve cache even if job fails
33+
when: 'always'
3234
paths:
3335
- ./tmp/npm/
3436
- ./tmp/ts-node-cache/
3537
# Homebrew cache is only used by the macos runner
3638
- ./tmp/Homebrew
39+
# Chocolatey cache is only used by the windows runner
40+
- ./tmp/chocolatey/
3741
# `jest` cache is configured in jest.config.js
3842
- ./tmp/jest/
3943

@@ -79,23 +83,21 @@ check:nix-dry:
7983

8084
check:test-generate:
8185
stage: check
82-
interruptible: true
86+
needs: []
8387
script:
8488
- >
8589
nix-shell --run '
86-
./scripts/test-pipelines.sh > ./tmp/test-pipelines.yml
90+
./scripts/check-test-generate.sh > ./tmp/check-test.yml
8791
'
8892
artifacts:
8993
when: always
9094
paths:
91-
- ./tmp/test-pipelines.yml
95+
- ./tmp/check-test.yml
9296
rules:
93-
# Runs on feature and staging commits and ignores version commits
94-
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
95-
# Runs on tag pipeline where the tag is a prerelease or release version
96-
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
97-
# Manually run on commits other than master and ignore version commits
98-
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
97+
# Runs on staging commits and ignores version commits
98+
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
99+
# Manually run on commits other than master and staging and ignore version commits
100+
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
99101
when: manual
100102

101103
check:test:
@@ -106,16 +108,14 @@ check:test:
106108
variables: false
107109
trigger:
108110
include:
109-
- artifact: tmp/test-pipelines.yml
111+
- artifact: tmp/check-test.yml
110112
job: check:test-generate
111113
strategy: depend
112114
rules:
113-
# Runs on feature and staging commits and ignores version commits
114-
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
115-
# Runs on tag pipeline where the tag is a prerelease or release version
116-
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
117-
# Manually run on commits other than master and ignore version commits
118-
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
115+
# Runs on staging commits and ignores version commits
116+
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
117+
# Manually run on commits other than master and staging and ignore version commits
118+
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
119119
when: manual
120120

121121
build:merge:
@@ -146,7 +146,7 @@ build:merge:
146146
# Runs on tag pipeline where the tag is a prerelease or release version
147147
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
148148

149-
build:linux:
149+
build:dist:
150150
stage: build
151151
needs: []
152152
script:
@@ -157,63 +157,42 @@ build:linux:
157157
artifacts:
158158
when: always
159159
paths:
160-
# Only the build:linux preserves the dist
161160
- ./dist
162161
rules:
163162
# Runs on staging commits and ignores version commits
164163
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
165164
# Runs on tag pipeline where the tag is a prerelease or release version
166165
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
167166

168-
build:windows:
167+
build:platforms-generate:
169168
stage: build
170169
needs: []
171-
tags:
172-
- windows
173-
before_script:
174-
- mkdir -Force "$CI_PROJECT_DIR/tmp"
175-
- choco install nodejs --version=16.14.2 -y
176-
- refreshenv
177170
script:
178-
- npm config set msvs_version 2019
179-
- npm install --ignore-scripts
180-
- $env:Path = "$(npm bin);" + $env:Path
181-
- npm run build --verbose
182-
# - npm test -- --ci
183-
# artifacts:
184-
# when: always
185-
# reports:
186-
# junit:
187-
# - ./tmp/junit/junit.xml
171+
- >
172+
nix-shell --run '
173+
./scripts/build-platforms-generate.sh > ./tmp/build-platforms.yml
174+
'
175+
artifacts:
176+
when: always
177+
paths:
178+
- ./tmp/build-platforms.yml
188179
rules:
189180
# Runs on staging commits and ignores version commits
190181
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
191182
# Runs on tag pipeline where the tag is a prerelease or release version
192183
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
193184

194-
build:macos:
185+
build:platforms:
195186
stage: build
196-
needs: []
197-
tags:
198-
- shared-macos-amd64
199-
image: macos-11-xcode-12
200-
variables:
201-
HOMEBREW_NO_INSTALL_UPGRADE: "true"
202-
HOMEBREW_NO_INSTALL_CLEANUP: "true"
203-
script:
204-
- eval "$(brew shellenv)"
205-
- brew install node@16
206-
- brew link --overwrite node@16
207-
- hash -r
208-
- npm install --ignore-scripts
209-
- export PATH="$(npm bin):$PATH"
210-
- npm run build --verbose
211-
# - npm test -- --ci
212-
# artifacts:
213-
# when: always
214-
# reports:
215-
# junit:
216-
# - ./tmp/junit/junit.xml
187+
needs:
188+
- build:platforms-generate
189+
inherit:
190+
variables: false
191+
trigger:
192+
include:
193+
- artifact: tmp/build-platforms.yml
194+
job: build:platforms-generate
195+
strategy: depend
217196
rules:
218197
# Runs on staging commits and ignores version commits
219198
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
@@ -223,9 +202,8 @@ build:macos:
223202
build:prerelease:
224203
stage: build
225204
needs:
226-
- build:linux
227-
- build:windows
228-
- build:macos
205+
- build:dist
206+
- build:platforms
229207
# Don't interrupt publishing job
230208
interruptible: false
231209
script:
@@ -247,9 +225,8 @@ build:prerelease:
247225
integration:builds:
248226
stage: integration
249227
needs:
250-
- build:linux
251-
- build:windows
252-
- build:macos
228+
- build:dist
229+
- build:platforms
253230
script:
254231
- mkdir -p ./builds
255232
- >
@@ -499,11 +476,9 @@ integration:merge:
499476
stage: integration
500477
needs:
501478
- build:merge
502-
- job: build:linux
503-
optional: true
504-
- job: build:windows
479+
- job: build:dist
505480
optional: true
506-
- job: build:macos
481+
- job: build:platforms
507482
optional: true
508483
- job: integration:nix
509484
optional: true
@@ -629,9 +604,8 @@ release:deployment:tag:
629604
release:distribution:
630605
stage: release
631606
needs:
632-
- build:linux
633-
- build:windows
634-
- build:macos
607+
- build:dist
608+
- build:platforms
635609
- integration:builds
636610
- integration:merge
637611
- release:deployment:tag

jest.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ module.exports = {
5353
},
5454
reporters: [
5555
'default',
56-
['jest-junit', { outputDirectory: '<rootDir>/tmp/junit' }],
56+
['jest-junit', {
57+
outputDirectory: '<rootDir>/tmp/junit',
58+
classNameTemplate: '{classname}',
59+
ancestorSeparator: ' > ',
60+
titleTemplate: '{title}',
61+
addFileAttribute: 'true',
62+
reportTestSuiteErrors: 'true',
63+
}],
5764
],
5865
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'],
5966
coverageReporters: ['text', 'cobertura'],

0 commit comments

Comments
 (0)