Skip to content

Commit 69be47f

Browse files
authored
chore(ci): cache compiled TS result MONGOSH-870 (#1026)
1 parent 9bad6bb commit 69be47f

File tree

10 files changed

+232
-38
lines changed

10 files changed

+232
-38
lines changed

.evergreen.yml

Lines changed: 133 additions & 14 deletions
Large diffs are not rendered by default.

.evergreen/compile-artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
cd $(pwd)
55

6-
source .evergreen/.setup_env
6+
source .evergreen/setup-env.sh
77

88
if uname -a | grep -q 'Linux.*x86_64'; then
99
rm -rf "tmp/.sccache"

.evergreen/evergreen.yml.in

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ exec_timeout_secs: 3600
8888
#
8989
# Current functions:
9090
# checkout - Checks out the project from git.
91-
# install - Installs Node and all dependencies.
91+
# compile_ts - Installs Node and all dependencies, and run all prepublish scripts.
92+
# install - Installs Node and all dependencies, and download the result of running all prepublish scripts.
9293
# check - Performs linter and dependency checks.
9394
# test - Runs all tests.
9495
# test_vscode - Clones the vscode extension repository and runs its tests.
@@ -105,6 +106,30 @@ functions:
105106
- command: git.get_project
106107
params:
107108
directory: src
109+
compile_ts:
110+
- command: expansions.write
111+
params:
112+
file: tmp/expansions.yaml
113+
redacted: true
114+
- command: shell.exec
115+
params:
116+
working_dir: src
117+
shell: bash
118+
script: |
119+
export NODE_JS_VERSION=${node_js_version}
120+
source .evergreen/install-node.sh
121+
npm run evergreen-release bump
122+
npm run bootstrap-ci
123+
tar cvzf compiled-ts.tgz packages/*/{lib,dist}
124+
- command: s3.put
125+
params:
126+
aws_key: ${aws_key}
127+
aws_secret: ${aws_secret}
128+
local_file: src/compiled-ts.tgz
129+
remote_file: mongosh/binaries/${revision}/${revision_order_id}/compiled-ts.tgz
130+
bucket: mciuploads
131+
permissions: public-read
132+
content_type: application/x-gzip
108133
install:
109134
- command: expansions.write
110135
params:
@@ -116,8 +141,21 @@ functions:
116141
shell: bash
117142
script: |
118143
export NODE_JS_VERSION=${node_js_version}
119-
source .evergreen/.install_node
144+
source .evergreen/install-node.sh
120145
npm run evergreen-release bump
146+
- command: s3.get
147+
params:
148+
aws_key: ${aws_key}
149+
aws_secret: ${aws_secret}
150+
local_file: src/compiled-ts.tgz
151+
remote_file: mongosh/binaries/${revision}/${revision_order_id}/compiled-ts.tgz
152+
bucket: mciuploads
153+
- command: shell.exec
154+
params:
155+
working_dir: src
156+
shell: bash
157+
script: |
158+
tar xvzf compiled-ts.tgz
121159
check:
122160
- command: shell.exec
123161
params:
@@ -127,8 +165,8 @@ functions:
127165
set -e
128166
{
129167
export NODE_JS_VERSION=${node_js_version}
130-
source .evergreen/.setup_env
131-
npm --unsafe-perm=true run bootstrap-ci
168+
source .evergreen/setup-env.sh
169+
npm --unsafe-perm=true run bootstrap-ci -- --ignore-prepublish
132170
npm run check-ci
133171
}
134172
test:
@@ -144,8 +182,8 @@ functions:
144182
set -e
145183
{
146184
export NODE_JS_VERSION=${node_js_version}
147-
source .evergreen/.setup_env
148-
npm --unsafe-perm=true run bootstrap-ci
185+
source .evergreen/setup-env.sh
186+
npm --unsafe-perm=true run bootstrap-ci -- --ignore-prepublish
149187
npm run test-ci
150188
echo "Creating coverage tarball..."
151189
tar cvzf coverage.tgz coverage
@@ -171,8 +209,8 @@ functions:
171209
set -e
172210
{
173211
export NODE_JS_VERSION=${node_js_version}
174-
source .evergreen/.setup_env
175-
npm --unsafe-perm=true run bootstrap-ci
212+
source .evergreen/setup-env.sh
213+
npm --unsafe-perm=true run bootstrap-ci -- --ignore-prepublish
176214
(cd scripts/docker && docker build -t ubuntu18.04-xvfb -f ubuntu18.04-xvfb.Dockerfile .)
177215
docker run \
178216
--rm -v $PWD:/tmp/build ubuntu18.04-xvfb \
@@ -191,8 +229,8 @@ functions:
191229
set -e
192230
{
193231
export NODE_JS_VERSION=${node_js_version}
194-
source .evergreen/.setup_env
195-
npm --unsafe-perm=true run bootstrap-ci
232+
source .evergreen/setup-env.sh
233+
npm --unsafe-perm=true run bootstrap-ci -- --ignore-prepublish
196234
npm run test-connectivity
197235
}
198236
test_apistrict:
@@ -208,7 +246,7 @@ functions:
208246
set -e
209247
{
210248
export NODE_JS_VERSION=${node_js_version}
211-
source .evergreen/.setup_env
249+
source .evergreen/setup-env.sh
212250
npm run test-apistrict-ci
213251
}
214252

@@ -447,7 +485,7 @@ functions:
447485
set -e
448486
{
449487
export NODE_JS_VERSION=${node_js_version}
450-
source .evergreen/.setup_env
488+
source .evergreen/setup-env.sh
451489
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
452490
npm run evergreen-release draft
453491
}
@@ -465,18 +503,19 @@ functions:
465503
set -e
466504
{
467505
export NODE_JS_VERSION=${node_js_version}
468-
source .evergreen/.setup_env
506+
source .evergreen/setup-env.sh
469507
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
470508
echo "registry=https://registry.npmjs.org/" > .npmrc
471509
echo "//registry.npmjs.org/:_authToken=${devtoolsbot_npm_token}" >> .npmrc
472-
npm --unsafe-perm=true run bootstrap-ci
510+
npm --unsafe-perm=true run bootstrap-ci -- --ignore-prepublish
473511
npm run evergreen-release publish
474512
}
475513

476514
# Tasks will show up as the individual blocks in the Evergreen UI that can
477515
# pass or fail.
478516
#
479517
# Current tasks:
518+
# compile_ts - Do the initial compilation of TS sources.
480519
# check - Performs linter and dependency checks.
481520
# test_{version} - Runs all tests, against a specified mongod version.
482521
# test_vscode - Run the vscode extension integration tests.
@@ -488,7 +527,17 @@ functions:
488527
# release_publish - Publishes the npm packages and uploads the tarballs.
489528
# pkg_test_* - Run tests on the release packages
490529
tasks:
530+
- name: compile_ts
531+
commands:
532+
- func: checkout
533+
- func: compile_ts
534+
vars:
535+
node_js_version: "<% out(NODE_JS_VERSION_14) %>"
536+
491537
- name: check
538+
depends_on:
539+
- name: compile_ts
540+
variant: linux
492541
commands:
493542
- func: checkout
494543
- func: install
@@ -506,6 +555,9 @@ tasks:
506555
for (const { shortName: mShort, versionSpec: mVersion } of MONGODB_VERSIONS) { %>
507556
- name: test_<% const id = `m${mShort}_n${nShort}`; ALL_UNIT_TESTS.push(id); out(id) %>
508557
tags: <% out(["unit-test", ...(mShort === 'latest' ? ["mlatest"] : [])]) %>
558+
depends_on:
559+
- name: compile_ts
560+
variant: linux
509561
commands:
510562
- func: checkout
511563
- func: install
@@ -523,6 +575,9 @@ tasks:
523575
###
524576
- name: test_vscode
525577
tags: ["extra-integration-test"]
578+
depends_on:
579+
- name: compile_ts
580+
variant: linux
526581
commands:
527582
- func: checkout
528583
- func: install
@@ -533,6 +588,9 @@ tasks:
533588
node_js_version: "<% out(NODE_JS_VERSION_12) %>"
534589
- name: test_connectivity
535590
tags: ["extra-integration-test"]
591+
depends_on:
592+
- name: compile_ts
593+
variant: linux
536594
commands:
537595
- func: checkout
538596
- func: install
@@ -541,6 +599,9 @@ tasks:
541599
- func: test_connectivity
542600
- name: test_apistrict
543601
tags: ["extra-integration-test"]
602+
depends_on:
603+
- name: compile_ts
604+
variant: linux
544605
commands:
545606
- func: checkout
546607
- func: install
@@ -552,6 +613,9 @@ tasks:
552613
mongosh_server_test_version: "latest-alpha"
553614
mongosh_test_force_api_strict: "1"
554615
- name: compile_artifact
616+
depends_on:
617+
- name: compile_ts
618+
variant: linux
555619
commands:
556620
- func: checkout
557621
- func: install
@@ -677,6 +741,9 @@ tasks:
677741
tags: ["publish"]
678742
git_tag_only: true
679743
exec_timeout_secs: 7200
744+
depends_on:
745+
- name: compile_ts
746+
variant: linux
680747
commands:
681748
- func: checkout
682749
- func: install
@@ -720,6 +787,7 @@ buildvariants:
720787
display_name: "Ubuntu 18.04 x64"
721788
run_on: ubuntu1804-small
722789
tasks:
790+
- name: compile_ts
723791
- name: check
724792
<% for (const test of ALL_UNIT_TESTS) { %>
725793
- name: test_<% out(test) %>

.evergreen/.install_node renamed to .evergreen/install-node.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ else
2828
fi
2929
fi
3030

31-
. "$BASEDIR/.setup_env"
31+
. "$BASEDIR/setup-env.sh"
3232

3333
# We need the build package for various tasks, and can bootstrap the cli-repl
3434
# package on all hosts, including dependencies.
@@ -39,6 +39,8 @@ fi
3939
# to installing with --ignore-scripts (i.e. do not attempt to build addons)
4040
# and only do the TypeScript compilation step, which is sufficient for the
4141
# executable compilation step.
42-
npm --unsafe-perm=true run bootstrap-ci -- --scope @mongosh/build
43-
npm --unsafe-perm=true run bootstrap-ci -- --scope @mongosh/cli-repl --include-dependencies || \
44-
(npm --unsafe-perm=true run bootstrap-ci -- --scope @mongosh/cli-repl --include-dependencies --ignore-scripts && npm --unsafe-perm=true run compile-cli)
42+
npm ci --verbose
43+
44+
npm run bootstrap-ci -- --scope @mongosh/build --ignore-prepublish
45+
(npm run bootstrap-ci -- --scope @mongosh/cli-repl --include-dependencies --ignore-prepublish && test -e packages/service-provider-server/node_modules/mongodb-client-encryption) || \
46+
npm run bootstrap-ci -- --scope @mongosh/cli-repl --include-dependencies --ignore-prepublish --ignore-scripts

.evergreen/package-and-upload-artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cd $(pwd)
88
export NODE_JS_VERSION=${NODE_JS_VERSION}
99
export ARTIFACT_URL_FILE="$PWD/artifact-url.txt"
1010
11-
source .evergreen/.setup_env
11+
source .evergreen/setup-env.sh
1212
tar xvzf dist.tgz
1313
1414
if [ "$(uname)" == Linux ]; then

.evergreen/run-e2e-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33
export NODE_JS_VERSION=${NODE_JS_VERSION}
44

5-
source .evergreen/.setup_env
5+
source .evergreen/setup-env.sh
66
tar xvzf dist.tgz
77
dist/mongosh --version
88

.evergreen/.setup_env renamed to .evergreen/setup-env.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ if [ "$OS" == "Windows_NT" ]; then
3434
export EVERGREEN_EXPANSIONS_PATH="$(cygpath -w "$EVERGREEN_EXPANSIONS_PATH")"
3535
fi
3636

37+
# On RHEL hosts, we run as root for some reason
38+
if [ `uname` = Linux ]; then
39+
export npm_config_unsafe_perm=true
40+
fi
41+
3742
echo "Full path:"
3843
echo $PATH
3944

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ tmp/expansions.yaml
2121
.evergreen/mongodb
2222
tmp/
2323
dist.tgz
24+
compiled-ts.tgz
2425
mongocryptd.pid

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"bootstrap-with-chromium": "lerna bootstrap --concurrency=1",
1313
"prebootstrap": "npm install",
1414
"bootstrap": "cross-env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 lerna bootstrap --ignore-prepublish --concurrency=1",
15-
"prebootstrap-ci": "npm ci",
16-
"bootstrap-ci": "lerna bootstrap --ci --concurrency=1",
15+
"bootstrap-ci": "lerna bootstrap --ci",
1716
"clean": "lerna clean -y && rm -Rf node_modules",
1817
"check": "lerna run check --since HEAD --exclude-dependents",
1918
"check-ci": "lerna run check",

packages/java-shell/src/test/js/run-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { once } from 'events';
66
import { startTestServer } from '../../../../../testing/integration-testing-hooks';
77

88
describe('java-shell tests', function() {
9-
this.timeout(600_000);
9+
this.timeout(1_000_000);
1010
const testServer = startTestServer('shared');
1111
const packageRoot = path.resolve(__dirname, '..', '..', '..') + '/';
1212

0 commit comments

Comments
 (0)