@@ -5,27 +5,33 @@ workflow:
5
5
when : never
6
6
- when : always
7
7
8
- default :
9
- interruptible : true
10
-
11
8
variables :
9
+ GIT_SUBMODULE_STRATEGY : recursive
12
10
GH_PROJECT_PATH : " MatrixAI/${CI_PROJECT_NAME}"
13
11
GH_PROJECT_URL : " https://${GITHUB_TOKEN}@github.com/${GH_PROJECT_PATH}.git"
14
- GIT_SUBMODULE_STRATEGY : recursive
15
12
# Cache .npm
16
13
NPM_CONFIG_CACHE : " ${CI_PROJECT_DIR}/tmp/npm"
17
14
# Prefer offline node module installation
18
15
NPM_CONFIG_PREFER_OFFLINE : " true"
19
16
# Homebrew cache only used by macos runner
20
17
HOMEBREW_CACHE : " ${CI_PROJECT_DIR}/tmp/Homebrew"
21
18
19
+ default :
20
+ interruptible : true
21
+ before_script :
22
+ # Replace this in windows runners that use powershell
23
+ # with `mkdir -Force "$CI_PROJECT_DIR/tmp"`
24
+ - mkdir -p "$CI_PROJECT_DIR/tmp"
25
+
22
26
# Cached directories shared between jobs & pipelines per-branch per-runner
23
27
cache :
24
28
key : $CI_COMMIT_REF_SLUG
25
29
paths :
26
30
- ./tmp/npm/
27
31
# Homebrew cache is only used by the macos runner
28
32
- ./tmp/Homebrew
33
+ # Chocolatey cache is only used by the windows runner
34
+ - ./tmp/chocolatey/
29
35
# `jest` cache is configured in jest.config.js
30
36
- ./tmp/jest/
31
37
@@ -87,20 +93,20 @@ build:merge:
87
93
# Required for `gh pr create`
88
94
- git remote add upstream "$GH_PROJECT_URL"
89
95
- >
90
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
91
- gh pr create \
92
- --head staging \
93
- --base master \
94
- --title "ci: merge staging to master" \
95
- --body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
96
- --assignee "@me" \
97
- --no-maintainer-edit \
98
- --repo "$GH_PROJECT_PATH" || true;
99
- printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
100
- | gh pr comment staging \
101
- --body-file - \
102
- --repo "$GH_PROJECT_PATH";
103
- '
96
+ nix-shell --run '
97
+ gh pr create \
98
+ --head staging \
99
+ --base master \
100
+ --title "ci: merge staging to master" \
101
+ --body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
102
+ --assignee "@me" \
103
+ --no-maintainer-edit \
104
+ --repo "$GH_PROJECT_PATH" || true;
105
+ printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
106
+ | gh pr comment staging \
107
+ --body-file - \
108
+ --repo "$GH_PROJECT_PATH";
109
+ '
104
110
rules :
105
111
# Runs on staging commits and ignores version commits
106
112
- if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
@@ -112,10 +118,10 @@ build:linux:
112
118
needs : []
113
119
script :
114
120
- >
115
- nix-shell --run '
116
- npm run build --verbose;
117
- npm test -- --ci --coverage;
118
- '
121
+ nix-shell --run '
122
+ npm run build --verbose;
123
+ npm test -- --ci --coverage;
124
+ '
119
125
artifacts :
120
126
when : always
121
127
reports :
@@ -140,10 +146,10 @@ build:windows:
140
146
tags :
141
147
- windows
142
148
before_script :
143
- - choco install nodejs --version=16.14.2 -y
144
- - refreshenv
149
+ - mkdir -Force "$CI_PROJECT_DIR/tmp"
145
150
script :
146
- - npm config set msvs_version 2019
151
+ - .\scripts\choco-install.ps1
152
+ - refreshenv
147
153
- npm install --ignore-scripts
148
154
- $env:Path = "$(npm bin);" + $env:Path
149
155
- npm run build --verbose
@@ -165,15 +171,10 @@ build:macos:
165
171
tags :
166
172
- shared-macos-amd64
167
173
image : macos-11-xcode-12
168
- variables :
169
- HOMEBREW_NO_INSTALL_UPGRADE : " true"
170
- HOMEBREW_NO_INSTALL_CLEANUP : " true"
171
- before_script :
174
+ script :
172
175
- eval "$(brew shellenv)"
173
- - brew install node@16
174
- - brew link --overwrite node@16
176
+ - ./scripts/brew-install.sh
175
177
- hash -r
176
- script :
177
178
- npm install --ignore-scripts
178
179
- export PATH="$(npm bin):$PATH"
179
180
- npm run build --verbose
@@ -197,14 +198,13 @@ build:prerelease:
197
198
- build:macos
198
199
# Don't interrupt publishing job
199
200
interruptible : false
200
- before_script :
201
- - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
202
201
script :
202
+ - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
203
203
- echo 'Publishing library prerelease'
204
204
- >
205
- nix-shell --run '
206
- npm publish --tag prerelease --access public;
207
- '
205
+ nix-shell --run '
206
+ npm publish --tag prerelease --access public;
207
+ '
208
208
after_script :
209
209
- rm -f ./.npmrc
210
210
rules :
@@ -234,12 +234,12 @@ integration:merge:
234
234
GIT_DEPTH : 0
235
235
script :
236
236
- >
237
- nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
238
- printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
239
- | gh pr comment staging \
240
- --body-file - \
241
- --repo "$GH_PROJECT_PATH";
242
- '
237
+ nix-shell --run '
238
+ printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
239
+ | gh pr comment staging \
240
+ --body-file - \
241
+ --repo "$GH_PROJECT_PATH";
242
+ '
243
243
- git remote add upstream "$GH_PROJECT_URL"
244
244
- git checkout origin/master
245
245
# Merge up to the current commit (not the latest commit)
@@ -260,14 +260,13 @@ release:distribution:
260
260
- integration:merge
261
261
# Don't interrupt publishing job
262
262
interruptible : false
263
- before_script :
264
- - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
265
263
script :
264
+ - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
266
265
- echo 'Publishing library'
267
266
- >
268
- nix-shell --run '
269
- npm publish --access public;
270
- '
267
+ nix-shell --run '
268
+ npm publish --access public;
269
+ '
271
270
after_script :
272
271
- rm -f ./.npmrc
273
272
rules :
0 commit comments