Skip to content

Commit 9e3e6a2

Browse files
committed
Merge branch 'topic/npm' into 'master'
Use new npm dependency provisioning features See merge request eng/ide/ada_language_server!2018
2 parents 90fd3b1 + c1c0dd5 commit 9e3e6a2

File tree

5 files changed

+93
-6
lines changed

5 files changed

+93
-6
lines changed

.gitlab-ci.plan

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
vscode_qual = {
2+
"mono-plat": True,
3+
"npm-online": True,
4+
"npm-package": True,
5+
}
6+
7+
18
def build_(qualifier={}):
29
with defaults(qualifier=qualifier):
310
anod_build("als")
4-
anod_build("vscode-extension", qualifier={"mono-plat": True} | qualifier)
11+
anod_build("vscode-extension", qualifier=vscode_qual | qualifier)
512

613

714
def test_als_(qualifier={}):
@@ -19,7 +26,7 @@ def test_als_cov_(qualifier={}):
1926

2027

2128
def test_vscode_extension_(qualifier={}):
22-
component_qual = qualifier | {"mono-plat": True}
29+
component_qual = qualifier | vscode_qual
2330
# Install the component built in the preceding CI build job
2431
anod_install("vscode-extension", qualifier=component_qual)
2532
anod_test("vscode-extension", qualifier=component_qual | {"coverage": True})
@@ -61,11 +68,18 @@ def build_test_gs_edge():
6168
# Integration testsuite (no edge version)
6269

6370

64-
def test_integration_testsuite():
71+
def test_integration_testsuite(local_vscode_qual=None):
72+
if local_vscode_qual is None:
73+
local_vscode_qual = vscode_qual
74+
6575
# These two components have been built by the build job of the CI, install them.
6676
anod_install("als")
67-
anod_install("vscode-extension", qualifier={"mono-plat": True})
77+
anod_install("vscode-extension", qualifier=local_vscode_qual)
6878

79+
test_int_ts(local_vscode_qual)
80+
81+
82+
def test_int_ts(local_vscode_qual):
6983
# For the following components, we'd like to install with latest=True to be
7084
# resilient to failures in nightly builds.
7185
#
@@ -86,5 +100,24 @@ def test_integration_testsuite():
86100
# Run the subset of integration-testsuite that uses VS Code
87101
anod_test(
88102
"integration-testsuite",
89-
qualifier={"run-tools": "vscode", "cleanup-mode": "none", "mono-plat": True},
103+
qualifier={
104+
"run-tools": "vscode",
105+
"cleanup-mode": "none",
106+
}
107+
| local_vscode_qual,
90108
)
109+
110+
111+
# Offline sentinel
112+
113+
114+
def offline_sentinel():
115+
offline_qual = vscode_qual | {
116+
"npm-online": False,
117+
"npm-package": False,
118+
}
119+
120+
anod_install("als")
121+
anod_build("vscode-extension", qualifier=offline_qual)
122+
anod_test("vscode-extension", qualifier=offline_qual)
123+
test_int_ts(offline_qual)

.gitlab-ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include:
1818
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
1919
inputs:
2020
anod-args: run build_$ACI_TRACK
21+
artifacts: [vscode-extension-npm-deps-*-*.tar.gz]
2122
cpus: 16
2223
disk: 80
2324
image: systemgtk
@@ -26,6 +27,18 @@ include:
2627
# 8GB of memory leads to heap exhaustion during compilation. We need more.
2728
windows-mem: 16
2829
save-component: true
30+
save-anod-logs: true
31+
32+
# Offline sentinel build/test of vscode-extension
33+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
34+
inputs:
35+
job-name: offline-sentinel
36+
anod-args: run offline_sentinel
37+
needs: [build:linux]
38+
cpus: 4
39+
disk: 80
40+
image: systemgtk
41+
save-anod-logs: true
2942

3043
# Testing of the ALS
3144
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
@@ -68,6 +81,7 @@ include:
6881
# components, but we can't because it breaks the transfer of built
6982
# components between jobs using anod-copy-components.
7083
anod-args: run test_integration_testsuite
84+
artifacts: [integration-testsuite-npm-deps-*-*.tar.gz]
7185
image: systemgtk
7286
cpus: 4
7387
disk: 80
@@ -93,6 +107,22 @@ include:
93107
when: manual
94108
allow_failure: true
95109

110+
.build:common:
111+
after_script:
112+
- . /tmp/ci_env.sh
113+
# Copy the NPM artifacts archive
114+
- bs=$(anod info vscode-extension --show working_dir -Q mono-plat,npm-online,npm-package)
115+
- |
116+
cp "$bs/tmp"/vscode-extension-npm-deps-*-*.tar.gz "$CI_PROJECT_DIR"
117+
118+
.integration-testsuite:common:
119+
after_script:
120+
- . /tmp/ci_env.sh
121+
# Copy the NPM artifacts archive
122+
- bs=$(anod info test integration-testsuite --show working_dir -Q run-tools=vscode,cleanup-mode=none,mono-plat,npm-online,npm-package)
123+
- |
124+
cp "$bs/tmp"/integration-testsuite-npm-deps-*-*.tar.gz "$CI_PROJECT_DIR"
125+
96126
als-cov:linux:
97127
variables:
98128
RUNNER_AFTER_SCRIPT_TIMEOUT: 10m

integration/vscode/ada/.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ tsconfig.json
1717
xfail.yaml
1818
vscode-test-win-workaround.py
1919
convert-mocha-junit-report.py
20+
unresolve.js

integration/vscode/ada/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,8 @@
14221422
"cilint": "eslint \"./src/**/*.{js,ts,tsx}\" \"./test/**/*.{js,ts,tsx}\"",
14231423
"test": "vscode-test",
14241424
"resolve-backtrace": "npx stacktracify",
1425-
"clean": "node -e \"fs.rmSync('out',{force:true,recursive:true})\""
1425+
"clean": "node -e \"fs.rmSync('out',{force:true,recursive:true})\"",
1426+
"unresolve": "node unresolve.js"
14261427
},
14271428
"dependencies": {
14281429
"command-exists": "1.2.9",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* This tool processes the nearby 'package-lock.json' file by removing the
3+
* "resolved" field of packages so that it becomes possible to resolve them in
4+
* a different registry than the one they were first resolved.
5+
*/
6+
const { writeFileSync } = require('fs');
7+
const { join } = require('path');
8+
9+
lockPath = join(__dirname, 'package-lock.json');
10+
11+
lockData = require(lockPath);
12+
const packages = lockData['packages'];
13+
const keys = Object.keys(packages);
14+
for (let index = 0; index < keys.length; index++) {
15+
const key = keys[index];
16+
const object = packages[key];
17+
if ('resolved' in object) {
18+
delete object['resolved'];
19+
}
20+
}
21+
22+
writeFileSync(lockPath, JSON.stringify(lockData, null, 4) + '\n');

0 commit comments

Comments
 (0)