Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test load balancing (migrating changes from TypeScript-Demo-Lib) #394

Merged
merged 9 commits into from
Jul 12, 2022
112 changes: 42 additions & 70 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ cache:
- ./tmp/ts-node-cache/
# Homebrew cache is only used by the macos runner
- ./tmp/Homebrew
# Chocolatey cache is only used by the windows runner
- ./tmp/chocolatey/
# `jest` cache is configured in jest.config.js
- ./tmp/jest/

Expand Down Expand Up @@ -79,23 +81,21 @@ check:nix-dry:

check:test-generate:
stage: check
interruptible: true
needs: []
script:
- >
nix-shell --run '
./scripts/test-pipelines.sh > ./tmp/test-pipelines.yml
./scripts/check-test-generate.sh > ./tmp/check-test.yml
'
artifacts:
when: always
paths:
- ./tmp/test-pipelines.yml
- ./tmp/check-test.yml
rules:
# Runs on feature and staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on tag pipeline where the tag is a prerelease or release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Manually run on commits other than master and ignore version commits
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Manually run on commits other than master and staging and ignore version commits
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual

check:test:
Expand All @@ -106,16 +106,14 @@ check:test:
variables: false
trigger:
include:
- artifact: tmp/test-pipelines.yml
- artifact: tmp/check-test.yml
job: check:test-generate
strategy: depend
rules:
# Runs on feature and staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on tag pipeline where the tag is a prerelease or release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Manually run on commits other than master and ignore version commits
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Manually run on commits other than master and staging and ignore version commits
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual

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

build:linux:
build:dist:
stage: build
needs: []
script:
Expand All @@ -157,63 +155,42 @@ build:linux:
artifacts:
when: always
paths:
# Only the build:linux preserves the dist
- ./dist
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on tag pipeline where the tag is a prerelease or release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

build:windows:
build:platforms-generate:
stage: build
needs: []
tags:
- windows
before_script:
- mkdir -Force "$CI_PROJECT_DIR/tmp"
- choco install nodejs --version=16.14.2 -y
- refreshenv
script:
- npm config set msvs_version 2019
- npm install --ignore-scripts
- $env:Path = "$(npm bin);" + $env:Path
- npm run build --verbose
# - npm test -- --ci
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit/junit.xml
- >
nix-shell --run '
./scripts/build-platforms-generate.sh > ./tmp/build-platforms.yml
'
artifacts:
when: always
paths:
- ./tmp/build-platforms.yml
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Runs on tag pipeline where the tag is a prerelease or release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

build:macos:
build:platforms:
stage: build
needs: []
tags:
- shared-macos-amd64
image: macos-11-xcode-12
variables:
HOMEBREW_NO_INSTALL_UPGRADE: "true"
HOMEBREW_NO_INSTALL_CLEANUP: "true"
script:
- eval "$(brew shellenv)"
- brew install node@16
- brew link --overwrite node@16
- hash -r
- npm install --ignore-scripts
- export PATH="$(npm bin):$PATH"
- npm run build --verbose
# - npm test -- --ci
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit/junit.xml
needs:
- build:platforms-generate
inherit:
variables: false
trigger:
include:
- artifact: tmp/build-platforms.yml
job: build:platforms-generate
strategy: depend
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
Expand All @@ -223,9 +200,8 @@ build:macos:
build:prerelease:
stage: build
needs:
- build:linux
- build:windows
- build:macos
- build:dist
- build:platforms
# Don't interrupt publishing job
interruptible: false
script:
Expand All @@ -247,9 +223,8 @@ build:prerelease:
integration:builds:
stage: integration
needs:
- build:linux
- build:windows
- build:macos
- build:dist
- build:platforms
script:
- mkdir -p ./builds
- >
Expand Down Expand Up @@ -499,11 +474,9 @@ integration:merge:
stage: integration
needs:
- build:merge
- job: build:linux
optional: true
- job: build:windows
- job: build:dist
optional: true
- job: build:macos
- job: build:platforms
optional: true
- job: integration:nix
optional: true
Expand Down Expand Up @@ -629,9 +602,8 @@ release:deployment:tag:
release:distribution:
stage: release
needs:
- build:linux
- build:windows
- build:macos
- build:dist
- build:platforms
- integration:builds
- integration:merge
- release:deployment:tag
Expand Down
9 changes: 8 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ module.exports = {
},
reporters: [
'default',
['jest-junit', { outputDirectory: '<rootDir>/tmp/junit' }],
['jest-junit', {
outputDirectory: '<rootDir>/tmp/junit',
classNameTemplate: '{classname}',
ancestorSeparator: ' > ',
titleTemplate: '{title}',
addFileAttribute: 'true',
reportTestSuiteErrors: 'true',
}],
],
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'],
coverageReporters: ['text', 'cobertura'],
Expand Down
Loading