@@ -5,14 +5,9 @@ shopt -s nullglob
55
66# Quote the heredoc to prevent shell expansion
77cat << "EOF "
8- workflow:
9- rules:
10- # Disable merge request pipelines
11- - if: $CI_MERGE_REQUEST_ID
12- when: never
13- - when: always
148default:
159 interruptible: true
10+
1611variables:
1712 GH_PROJECT_PATH: "MatrixAI/${CI_PROJECT_NAME}"
1813 GH_PROJECT_URL: "https://${GITHUB_TOKEN}@github.com/${GH_PROJECT_PATH}.git"
@@ -27,6 +22,7 @@ variables:
2722 TS_CACHED_TRANSPILE_PORTABLE: "true"
2823 # Homebrew cache only used by macos runner
2924 HOMEBREW_CACHE: "${CI_PROJECT_DIR}/tmp/Homebrew"
25+
3026# Cached directories shared between jobs & pipelines per-branch per-runner
3127cache:
3228 key: $CI_COMMIT_REF_SLUG
@@ -37,8 +33,10 @@ cache:
3733 - ./tmp/Homebrew
3834 # `jest` cache is configured in jest.config.js
3935 - ./tmp/jest/
36+
4037stages:
4138 - build # Cross-platform library compilation, unit tests
39+
4240image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
4341EOF
4442
@@ -48,16 +46,20 @@ printf "\n"
4846# In the future we can incorporate test durations rather than using
4947# a static value for the parallel keyword
5048
49+ # Number of parallel shards to split the test suite into
50+ CI_PARALLEL=2
51+
52+
5153cat << "EOF "
5254build:linux:
5355 stage: build
5456 needs: []
55- parallel: 2
57+ parallel: $CI_PARALLEL
5658 script:
5759 - >
5860 nix-shell --run '
59- npm run build --verbose;
60- npm test -- --ci --runInBand -- coverage --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL;
61+ npm run build --verbose
62+ npm test -- --ci --coverage --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL;
6163 '
6264 artifacts:
6365 when: always
@@ -67,15 +69,7 @@ build:linux:
6769 coverage_report:
6870 coverage_format: cobertura
6971 path: ./tmp/coverage/cobertura-coverage.xml
70- paths:
71- # Only the build:linux preserves the dist
72- - ./dist
7372 coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
74- rules:
75- # Runs on staging commits and ignores version commits
76- - if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
77- # Runs on tag pipeline where the tag is a prerelease or release version
78- - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
7973EOF
8074
8175printf " \n"
@@ -84,7 +78,7 @@ cat << "EOF"
8478build:windows:
8579 stage: build
8680 needs: []
87- parallel: 2
81+ parallel: $CI_PARALLEL
8882 tags:
8983 - windows
9084 before_script:
@@ -95,17 +89,12 @@ build:windows:
9589 - npm install --ignore-scripts
9690 - $env:Path = "$(npm bin);" + $env:Path
9791 - npm run build --verbose
98- - npm test -- --ci --runInBand -- shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
92+ - npm test -- --ci --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
9993 artifacts:
10094 when: always
10195 reports:
10296 junit:
10397 - ./tmp/junit/junit.xml
104- rules:
105- # Runs on staging commits and ignores version commits
106- - if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
107- # Runs on tag pipeline where the tag is a prerelease or release version
108- - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
10998EOF
11099
111100printf " \n"
@@ -114,7 +103,7 @@ cat << "EOF"
114103build:macos:
115104 stage: build
116105 needs: []
117- parallel: 2
106+ parallel: $CI_PARALLEL
118107 tags:
119108 - shared-macos-amd64
120109 image: macos-11-xcode-12
@@ -130,17 +119,12 @@ build:macos:
130119 - npm install --ignore-scripts
131120 - export PATH="$(npm bin):$PATH"
132121 - npm run build --verbose
133- - npm test -- --ci --runInBand -- shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
122+ - npm test -- --ci --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
134123 artifacts:
135124 when: always
136125 reports:
137126 junit:
138127 - ./tmp/junit/junit.xml
139- rules:
140- # Runs on staging commits and ignores version commits
141- - if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
142- # Runs on tag pipeline where the tag is a prerelease or release version
143- - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
144128EOF
145129
146130printf " \n"
0 commit comments