Skip to content

Commit 74ec45f

Browse files
committed
Merge remote-tracking branch 'origin/master' into ds/custom_editor
2 parents 4a3e57f + 92ee74e commit 74ec45f

File tree

202 files changed

+10201
-6719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+10201
-6719
lines changed

.vscodeignore

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
!out/client/**/*.map
21
**/*.map
3-
!out/datascience-ui/**/*.map
2+
**/*.analyzer.html
3+
!out/datascience-ui/notebook/commons.initial.bundle.js.map
4+
!out/datascience-ui/notebook/interactiveWindow.js.map
5+
!out/datascience-ui/notebook/nativeEditor.js.map
6+
!out/datascience-ui/viewers/commons.initial.bundle.js.map
7+
!out/datascience-ui/viewers/dataExplorer.js.map
8+
!out/datascience-ui/viewers/plotViewer.js.map
49
*.vsix
510
.appveyor.yml
611
.editorconfig
@@ -25,7 +30,9 @@ package.datascience-ui.dependencies.json
2530
package-lock.json
2631
packageExtension.cmd
2732
pvsc-dev-ext.py
33+
pvsc.code-workspace
2834
PYTHON_INTERACTIVE_TROUBLESHOOTING.md
35+
requirements.in
2936
test.ipynb
3037
travis*.log
3138
tsconfig*.json
@@ -42,6 +49,8 @@ webpack.datascience-*.config.js
4249
.mocha-reporter/**
4350
.nvm/**
4451
.nyc_output
52+
.prettierrc.js
53+
.sonarcloud.properties
4554
.venv/**
4655
.vscode/**
4756
.vscode-test/**
@@ -59,8 +68,26 @@ images/**/*.png
5968
news/**
6069
node_modules/**
6170
obj/**
62-
out/client/**/*analyzer.html
71+
out/**/*.stats.json
72+
out/client/**/*.analyzer.html
6373
out/coverconfig.json
74+
out/datascience-ui/**/*.analyzer.html
75+
out/datascience-ui/common/**
76+
out/datascience-ui/**/*.js.LICENSE
77+
out/datascience-ui/data-explorer/**
78+
out/datascience-ui/datascience-ui/**
79+
out/datascience-ui/history-react/**
80+
out/datascience-ui/interactive-common/**
81+
out/datascience-ui/ipywidgets/**
82+
out/datascience-ui/native-editor/**
83+
out/datascience-ui/notebook/datascience-ui/**
84+
out/datascience-ui/notebook/ipywidgets/**
85+
out/datascience-ui/notebook/index.*.html
86+
out/datascience-ui/plot/**
87+
out/datascience-ui/react-common/**
88+
out/datascience-ui/viewers/datascience-ui/**
89+
out/datascience-ui/viewers/ipywidgets/**
90+
out/datascience-ui/viewers/index.*.html
6491
out/pythonFiles/**
6592
out/src/**
6693
out/test/**

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ npm ci
3838
python3 -m venv .venv
3939
# Activate the virtual environment as appropriate for your shell, For example ...
4040
source .venv/bin/activate
41+
# The Python code in the extension is formatted using Black.
42+
python3 -m pip install black
4143
# Install Python dependencies using `python3`.
4244
# If you want to use a different interpreter then specify it in the
4345
# CI_PYTHON_PATH environment variable.

build/.mocha.performance.opts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
./out/test/**/*.functional.test.js
2+
--require=out/test/unittests.js
3+
--ui=tdd
4+
--recursive
5+
--colors
6+
--exit
7+
--timeout=180000
8+
--reporter mocha-multi-reporters
9+
--reporter-options configFile=build/.mocha-multi-reporters.config
10+
--grep DataScience
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
'use strict';
4+
const fastXmlParser = require('fast-xml-parser');
5+
const fs = require('fs');
6+
const path = require('path');
7+
const constants = require('../../constants');
8+
9+
const xmlFile = path.join(constants.ExtensionRootDir, 'test-results.xml');
10+
const performanceResultsFile = path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'performance-results.json');
11+
const errorMargin = 0.01;
12+
let failedTests = '';
13+
14+
fs.readFile(xmlFile, 'utf8', (xmlFileError, xmlData) => {
15+
if (xmlFileError) {
16+
throw xmlFileError;
17+
}
18+
19+
if (fastXmlParser.validate(xmlData)) {
20+
const defaultOptions = {
21+
attributeNamePrefix: '',
22+
ignoreAttributes: false
23+
};
24+
25+
fs.readFile(performanceResultsFile, 'utf8', (performanceResultsFileError, performanceData) => {
26+
if (performanceResultsFileError) {
27+
throw performanceResultsFileError;
28+
}
29+
30+
const resultsJson = fastXmlParser.parse(xmlData, defaultOptions);
31+
const performanceJson = JSON.parse(performanceData);
32+
33+
performanceJson.forEach(result => {
34+
const avg = result.times.reduce((a, b) => parseFloat(a) + parseFloat(b)) / result.times.length;
35+
36+
resultsJson.testsuites.testsuite.forEach(suite => {
37+
if (parseInt(suite.tests, 10) > 0) {
38+
if (Array.isArray(suite.testcase)) {
39+
const testcase = suite.testcase.find(x => x.name === result.name);
40+
41+
// compare the average result to the base JSON
42+
if (testcase && avg > parseFloat(testcase.time) + errorMargin) {
43+
failedTests += 'Performance is slow in: ' + testcase.name + ', Benchmark time: ' + testcase.time + ', Average test time: ' + avg + '\n';
44+
}
45+
} else {
46+
// compare the average result to the base JSON
47+
if (suite.testcase.name === result.name && avg > parseFloat(suite.testcase.time) + errorMargin) {
48+
failedTests += 'Performance is slow in: ' + testcase.name + ', Benchmark time: ' + testcase.time + ', Average test time: ' + avg + '\n';
49+
}
50+
}
51+
}
52+
});
53+
});
54+
55+
if (failedTests.length > 0) {
56+
throw new Error(failedTests);
57+
}
58+
59+
// Delete performance-results.json
60+
fs.unlink(performanceResultsFile, deleteError => {
61+
if (deleteError) {
62+
throw deleteError;
63+
}
64+
});
65+
});
66+
}
67+
});
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
'use strict';
4+
const fastXmlParser = require('fast-xml-parser');
5+
const fs = require('fs');
6+
const path = require('path');
7+
const constants = require('../../constants');
8+
9+
const xmlFile = path.join(constants.ExtensionRootDir, 'test-results.xml');
10+
const jsonFile = path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'performance-results.json');
11+
let performanceData = [];
12+
13+
fs.readFile(xmlFile, 'utf8', (xmlReadError, xmlData) => {
14+
if (xmlReadError) {
15+
throw xmlReadError;
16+
}
17+
18+
if (fastXmlParser.validate(xmlData)) {
19+
const defaultOptions = {
20+
attributeNamePrefix: '',
21+
ignoreAttributes: false
22+
};
23+
const jsonObj = fastXmlParser.parse(xmlData, defaultOptions);
24+
25+
fs.readFile(jsonFile, 'utf8', (jsonReadError, data) => {
26+
if (jsonReadError) {
27+
// File doesn't exist, so we create it
28+
jsonObj.testsuites.testsuite.forEach(suite => {
29+
if (parseInt(suite.tests, 10) > 0) {
30+
if (Array.isArray(suite.testcase)) {
31+
suite.testcase.forEach(testcase => {
32+
const test = {
33+
name: testcase.name,
34+
times: [parseFloat(testcase.time)]
35+
};
36+
performanceData.push(test);
37+
});
38+
} else {
39+
const test = {
40+
name: suite.testcase.name,
41+
times: [parseFloat(suite.testcase.time)]
42+
};
43+
performanceData.push(test);
44+
}
45+
}
46+
});
47+
} else {
48+
performanceData = JSON.parse(data);
49+
50+
jsonObj.testsuites.testsuite.forEach(suite => {
51+
if (parseInt(suite.tests, 10) > 0) {
52+
if (Array.isArray(suite.testcase)) {
53+
suite.testcase.forEach(testcase => {
54+
let test = performanceData.find(x => x.name === testcase.name);
55+
if (test) {
56+
// if the test name is already there, we add the new time
57+
test.times.push(parseFloat(testcase.time));
58+
} else {
59+
// if its not there, we add the whole thing
60+
const test = {
61+
name: testcase.name,
62+
times: [parseFloat(testcase.time)]
63+
};
64+
65+
performanceData.push(test);
66+
}
67+
});
68+
} else {
69+
let test = performanceData.find(x => x.name === suite.testcase.name);
70+
if (test) {
71+
// if the test name is already there, we add the new time
72+
test.times.push(parseFloat(suite.testcase.time));
73+
} else {
74+
// if its not there, we add the whole thing
75+
test = {
76+
name: suite.testcase.name,
77+
times: [parseFloat(suite.testcase.time)]
78+
};
79+
80+
performanceData.push(test);
81+
}
82+
}
83+
}
84+
});
85+
}
86+
87+
fs.writeFile(
88+
path.join(constants.ExtensionRootDir, 'build', 'ci', 'performance', 'performance-results.json'),
89+
JSON.stringify(performanceData, null, 2),
90+
writeResultsError => {
91+
if (writeResultsError) {
92+
throw writeResultsError;
93+
}
94+
// tslint:disable-next-line: no-console
95+
console.log('performance-results.json was saved!');
96+
}
97+
);
98+
});
99+
}
100+
});

build/ci/performance/strategy.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
parameters:
2+
jobs: []
3+
pythonVersions: [
4+
# All scenarios tagged with `@noNeedToTestInAllPython`, will run in the latest version of Python.
5+
# When using other versions of Python, ignore `@noNeedToTestInAllPython`.
6+
{
7+
"version": "3.7",
8+
"displayName": "37",
9+
"excludeTags": "not @python3.6 and not @python3.5 and not @python2"
10+
},
11+
{
12+
"version": "3.6",
13+
"displayName": "36",
14+
"excludeTags": "not @python3.7 and not @python3.5 and not @python2 and not @noNeedToTestInAllPython"
15+
},
16+
{
17+
"version": "3.5",
18+
"displayName": "35",
19+
"excludeTags": "not @python3.7 and not @python3.6 and not @python2 and not @noNeedToTestInAllPython"
20+
},
21+
{
22+
"version": "2.7",
23+
"displayName": "27",
24+
"excludeTags": "not @python3.7 and not @python3.6 and not @python3.5 and not @python3 and not @noNeedToTestInAllPython"
25+
}
26+
]
27+
28+
matrix:
29+
${{ each job in parameters.jobs }}:
30+
${{ each py in parameters.pythonVersions }}:
31+
${{ if not(contains('mac')) }}:
32+
${{ format('Mac{2}{0}{1}', py.displayName, job.test) }}:
33+
PythonVersion: ${{ py.version }}
34+
VSCodeChannel: "stable"
35+
VMImageName: "macos-latest"
36+
37+
${{ if not(contains('win')) }}:
38+
${{ format('Win{2}{0}{1}', py.displayName, job.test) }}:
39+
PythonVersion: ${{ py.version }}
40+
VSCodeChannel: "stable"
41+
VMImageName: "vs2017-win2016"
42+
43+
${{ if not(contains('linux')) }}:
44+
${{ format('Linux{2}{0}{1}', py.displayName, job.test) }}:
45+
PythonVersion: ${{ py.version }}
46+
VSCodeChannel: "stable"
47+
VMImageName: "ubuntu-latest"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: '$(Year:yyyy).$(Month).0.$(BuildID)-weekly-performance-test'
2+
3+
trigger: none
4+
pr: none
5+
schedules:
6+
- cron: "0 0 * * sat"
7+
displayName: Weekly Performance Test
8+
branches:
9+
include:
10+
- master
11+
12+
- stage: Test performance
13+
jobs:
14+
- job: Testing Round 1
15+
timeoutInMinutes: 120
16+
strategy:
17+
- template: strategy.yaml
18+
steps:
19+
- bash: |
20+
mocha --require source-map-support/register --opts ./build/.mocha.performance.opts
21+
node .\savePerformanceResults.js
22+
23+
- job: Testing Round 2
24+
dependsOn:
25+
- Testing Round 1
26+
timeoutInMinutes: 120
27+
strategy:
28+
- template: strategy.yaml
29+
steps:
30+
- bash: |
31+
mocha --require source-map-support/register --opts ./build/.mocha.performance.opts
32+
node .\savePerformanceResults.js
33+
34+
- job: Testing Round 3
35+
dependsOn:
36+
- Testing Round 2
37+
timeoutInMinutes: 120
38+
strategy:
39+
- template: strategy.yaml
40+
steps:
41+
- bash: |
42+
mocha --require source-map-support/register --opts ./build/.mocha.performance.opts
43+
node .\savePerformanceResults.js
44+
45+
- job: Testing Round 4
46+
dependsOn:
47+
- Testing Round 3
48+
timeoutInMinutes: 120
49+
strategy:
50+
- template: strategy.yaml
51+
steps:
52+
- bash: |
53+
mocha --require source-map-support/register --opts ./build/.mocha.performance.opts
54+
node .\savePerformanceResults.js
55+
56+
- job: Testing Round 5
57+
dependsOn:
58+
- Testing Round 4
59+
timeoutInMinutes: 120
60+
strategy:
61+
- template: strategy.yaml
62+
steps:
63+
- bash: |
64+
mocha --require source-map-support/register --opts ./build/.mocha.performance.opts
65+
node .\savePerformanceResults.js
66+
67+
- stage: Results
68+
dependsOn:
69+
- Test performance
70+
jobs:
71+
- job: CheckResults
72+
timeoutInMinutes: 5
73+
steps:
74+
- bash: node .\checkPerformanceResults.js

build/ci/templates/jobs/build_compile.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ jobs:
3636
workingDirectory: $(Build.SourcesDirectory)
3737

3838
- bash: npx prettier "src/**/*.ts*" --check
39-
displayName: "Code Format"
39+
displayName: "Code Format (TypeScript)"
4040
workingDirectory: $(Build.SourcesDirectory)
4141

4242
- bash: npx prettier "build/**/*.js" --check
43-
displayName: "Code Format"
43+
displayName: "Code Format (JavaScript)"
4444
workingDirectory: $(Build.SourcesDirectory)
45+
46+
- bash: |
47+
python -m pip install -U black
48+
python -m black . --check
49+
displayName: "Code Format (Python)"
50+
workingDirectory: $(Build.SourcesDirectory)/pythonFiles

build/ci/templates/jobs/uitest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# 3. ignoreOperatingSystems
6262
# Comma delimited list of OS not to be tested against.
6363
# E.g. = win, linux
64-
# Possible values = mac, win linux
64+
# Possible values = mac, win, linux
6565
# 4. vscodeChannels
6666
# Comma delimited list of VSC Versions.
6767
# Defaults include = `stable`,`insider`

0 commit comments

Comments
 (0)