Skip to content

Commit

Permalink
Publish from pipeline (#1115)
Browse files Browse the repository at this point in the history
* Merge into publish branch (#1112)

* Prepare to publish new packages

* Fix pipeline script

* Engineering - remove dependsOn properties (#1110)

* Add variables

* Initial attempt

* Remove unused parameters

* Change if clause

* Fix variables

* Add back parameters

* Comment out code

* Add Jsonrpc

* Fingers crossed

* Add test platform for types

* Remove variables

* Remove dependsOn fields

Co-authored-by: Dirk Baeumer <[email protected]>

Co-authored-by: Ladislau Szomoru <[email protected]>

* Avoid referencing client from tests

* Make test depend on client only

* Handle uncaught exceptions.

* export Display

* Use default display

* Use correct default display

* Only execute client

* Correct display setting in run test

* Another try to set display correctly

* Use find process to find the right display for tests

* Reenable all packages

Co-authored-by: Ladislau Szomoru <[email protected]>
  • Loading branch information
dbaeumer and lszomoru authored Nov 8, 2022
1 parent df9ea01 commit 3383f34
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 36 deletions.
16 changes: 6 additions & 10 deletions build/azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ extends:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: textDocument
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/textDocument

- name: types
dependsOn: textDocument
testPlatforms:
- name: Linux
nodeVersions:
Expand All @@ -100,15 +100,14 @@ extends:
package: types
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishTypes }}
publishDependsOn: ${{ parameters.publishTextDocument }}
postPublishSteps:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: types
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/types

- name: jsonrpc
dependsOn: types
testPlatforms:
- name: Linux
nodeVersions:
Expand All @@ -129,15 +128,14 @@ extends:
package: jsonrpc
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishJsonrpc }}
publishDependsOn: ${{ parameters.publishTypes }}
postPublishSteps:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: jsonrpc
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/jsonrpc

- name: protocol
dependsOn: jsonrpc
testPlatforms:
- name: Linux
nodeVersions:
Expand All @@ -158,15 +156,14 @@ extends:
package: protocol
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishProtocol }}
publishDependsOn: ${{ parameters.publishJsonrpc }}
postPublishSteps:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: protocol
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/protocol

- name: server
dependsOn: protocol
testPlatforms:
- name: Linux
nodeVersions:
Expand All @@ -187,15 +184,14 @@ extends:
package: server
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishServer }}
publishDependsOn: ${{ parameters.publishProtocol }}
postPublishSteps:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: server
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/server

- name: client
dependsOn: server
testPlatforms:
- name: Linux
nodeVersions:
Expand All @@ -217,9 +213,9 @@ extends:
package: client
tag: ${{ parameters.quality }}
publishPackage: ${{ parameters.publishClient }}
publishDependsOn: ${{ parameters.publishServer }}
postPublishSteps:
- template: /build/azure-pipelines/templates/postPublish-steps.yml@self
parameters:
package: client
quality: ${{ parameters.quality }}
workingDirectory: $(Build.SourcesDirectory)/client
3 changes: 3 additions & 0 deletions build/azure-pipelines/templates/postPublish-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
###############################################################################################
parameters:
- name: package
type: string
- name: quality
type: string

steps:
- ${{ if eq(parameters.quality, 'latest') }}:
Expand Down
6 changes: 3 additions & 3 deletions build/azure-pipelines/templates/test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
###############################################################################################
parameters:
- name: package
type: string
- name: script
type: string
default: 'all'

steps:
Expand All @@ -18,6 +20,4 @@ steps:
condition: eq(variables['Agent.OS'], 'Linux')
- script: npm run ${{ parameters.script }}
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.package }}
displayName: Verify package
env:
DISPLAY: ':99.0'
displayName: Verify package
4 changes: 2 additions & 2 deletions client-node-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
},
"dependencies": {
"minimatch": "^3.0.4",
"vscode-languageclient": "8.1.0-next.1",
"vscode-languageserver": "8.1.0-next.1",
"vscode-languageserver": "8.1.0-next.2",
"vscode-uri": "3.0.3"
},
"devDependencies": {
Expand All @@ -42,6 +41,7 @@
"@types/sinon": "^10.0.2",
"@types/uuid": "^8.3.1",
"@types/vscode": "1.67.0",
"find-process": "^1.4.7",
"glob": "^7.1.7",
"sinon": "^11.1.2",
"uuid": "^8.3.2",
Expand Down
19 changes: 9 additions & 10 deletions client-node-tests/src/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import * as Is from 'vscode-languageclient/lib/common/utils/is';
import * as async from 'vscode-languageclient/lib/common/utils/async';

import * as vscode from 'vscode';
import { CompletionItemTag, InsertTextMode, SymbolTag } from 'vscode-languageserver-protocol';

const c2p: codeConverter.Converter = codeConverter.createConverter();
const p2c: protocolConverter.Converter = protocolConverter.createConverter(undefined, false, false);
Expand Down Expand Up @@ -413,7 +412,7 @@ suite('Protocol Converter', () => {

const result = p2c.asCompletionItem(completionItem);
strictEqual(result.label, completionItem.label);
strictEqual(result.tags![0], CompletionItemTag.Deprecated);
strictEqual(result.tags![0], proto.CompletionItemTag.Deprecated);
});

test('Completion Item - Deprecated tag', () => {
Expand All @@ -424,7 +423,7 @@ suite('Protocol Converter', () => {

const result = p2c.asCompletionItem(completionItem);
strictEqual(result.label, completionItem.label);
strictEqual(result.tags![0], CompletionItemTag.Deprecated);
strictEqual(result.tags![0], proto.CompletionItemTag.Deprecated);
});

test('Completion Item - Full', async () => {
Expand Down Expand Up @@ -460,7 +459,7 @@ suite('Protocol Converter', () => {
strictEqual(result.command!.title, command.title);
strictEqual(result.command!.command, command.command);
strictEqual(result.command!.arguments, command.arguments);
strictEqual(result.tags![0], CompletionItemTag.Deprecated);
strictEqual(result.tags![0], proto.CompletionItemTag.Deprecated);
strictEqual(result.commitCharacters!.length, 1);
strictEqual(result.commitCharacters![0], '.');
ok(result.additionalTextEdits![0] instanceof vscode.TextEdit);
Expand Down Expand Up @@ -683,30 +682,30 @@ suite('Protocol Converter', () => {
const completionItem: proto.CompletionItem = {
label: 'item',
kind: Number.MAX_VALUE as any,
insertTextMode: InsertTextMode.asIs
insertTextMode: proto.InsertTextMode.asIs
};
const result = p2c.asCompletionItem(completionItem);
strictEqual(result.kind, vscode.CompletionItemKind.Text);
strictEqual(result.keepWhitespace, true);

const back = c2p.asCompletionItem(result);
strictEqual(back.kind, Number.MAX_VALUE);
strictEqual(back.insertTextMode, InsertTextMode.asIs);
strictEqual(back.insertTextMode, proto.InsertTextMode.asIs);
});

test('Completion Item - InsertTextMode.adjustIndentation', () => {
const completionItem: proto.CompletionItem = {
label: 'item',
kind: Number.MAX_VALUE as any,
insertTextMode: InsertTextMode.adjustIndentation
insertTextMode: proto.InsertTextMode.adjustIndentation
};
const result = p2c.asCompletionItem(completionItem);
strictEqual(result.kind, vscode.CompletionItemKind.Text);
strictEqual(result.keepWhitespace, undefined);

const back = c2p.asCompletionItem(result);
strictEqual(back.kind, Number.MAX_VALUE);
strictEqual(back.insertTextMode, InsertTextMode.adjustIndentation);
strictEqual(back.insertTextMode, proto.InsertTextMode.adjustIndentation);
});

test('Completion Item - Label Details', () => {
Expand Down Expand Up @@ -1072,7 +1071,7 @@ suite('Protocol Converter', () => {
const symbolInformation: proto.SymbolInformation = {
name: 'name',
kind: proto.SymbolKind.Array,
tags: [Number.MAX_VALUE as SymbolTag],
tags: [Number.MAX_VALUE as proto.SymbolTag],
location: location
};
const result = p2c.asSymbolInformation(symbolInformation);
Expand Down Expand Up @@ -1429,7 +1428,7 @@ suite('Code Converter', () => {
assertTextEdit(result.textEdit);
rangeEqual(result.textEdit.range, item.textEdit.range);
strictEqual(result.textEdit.newText, item.textEdit.newText);
strictEqual(result.insertTextMode, InsertTextMode.adjustIndentation);
strictEqual(result.insertTextMode, proto.InsertTextMode.adjustIndentation);
});

test('DiagnosticSeverity', () => {
Expand Down
26 changes: 24 additions & 2 deletions client-node-tests/src/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as fs from 'fs';
import * as os from 'os';
import * as uuid from 'uuid';

import find = require('find-process');
import { runTests } from 'vscode-test';

function rimraf(location: string) {
Expand All @@ -27,7 +28,6 @@ function rimraf(location: string) {
}
}


async function go() {
try {
const extensionDevelopmentPath = path.resolve(__dirname, '..');
Expand All @@ -42,6 +42,24 @@ async function go() {
const workspaceFolder = path.join(testDir, 'workspace');
fs.mkdirSync(workspaceFolder);

// Under Linux we quite often run the tests using Xvfb.
// In case we have no display set and Xvfb is running use
// the Xvfb display port as a DISPLAY setting
let extensionTestsEnv: NodeJS.ProcessEnv | undefined = undefined;
if (process.platform === 'linux' && !process.env['DISPLAY']) {
let display: string | undefined;
const processes = await find('name', '/usr/bin/Xvfb');
for (const item of processes) {
if (item.name !== 'Xvfb') {
continue;
}
if (item.cmd !== undefined && item.cmd.length > 0) {
display = item.cmd.split(' ')[1];
}
}
extensionTestsEnv = { 'DISPLAY': display };
}

/**
* Basic usage
*/
Expand All @@ -54,13 +72,17 @@ async function go() {
'--extensions-dir', extensionDir,
'--enable-proposed-api', 'ms-vscode.test-extension',
workspaceFolder
]
],
extensionTestsEnv
});
rimraf(testDir);
} catch (err) {
console.error('Failed to run tests');
process.exitCode = 1;
}
}
process.on('uncaughtException', (error: any) => {
console.error(error);
});

go().catch(console.error);
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageclient",
"description": "VSCode Language client implementation",
"version": "8.1.0-next.1",
"version": "8.1.0-next.2",
"author": "Microsoft Corporation",
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"minimatch": "^5.1.0",
"semver": "^7.3.7",
"vscode-languageserver-protocol": "3.17.3-next.1"
"vscode-languageserver-protocol": "3.17.3-next.2"
},
"scripts": {
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"audit:all": "node ./build/bin/all.js audit",
"audit:all:fix": "node ./build/bin/all.js audit fix",
"generate:metaModel": "cd protocol && npm run generate:metaModel && cd ..",
"generate:metaModelSchema": "cd protocol && npm run generate:metaModelSchema && cd .."
"generate:metaModelSchema": "cd protocol && npm run generate:metaModelSchema && cd ..",
"validate:version": "node ./tools/lib/validate-main.js"
}
}
6 changes: 3 additions & 3 deletions protocol/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver-protocol",
"description": "VSCode Language Server Protocol implementation",
"version": "3.17.3-next.1",
"version": "3.17.3-next.2",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand All @@ -18,7 +18,7 @@
},
"typings": "./lib/common/api.d.ts",
"dependencies": {
"vscode-jsonrpc": "8.1.0-next.1",
"vscode-jsonrpc": "8.1.0-next.3",
"vscode-languageserver-types": "3.17.2"
},
"scripts": {
Expand All @@ -36,7 +36,7 @@
"webpack:test": "cd ../types && npm run compile:esm && cd ../protocol && node ../build/bin/webpack --mode none --config ./src/browser/test/webpack.config.js",
"webpack:test:silent": "cd ../types && npm run compile:esm && cd ../protocol && node ../build/bin/webpack --no-stats --mode none --config ./src/browser/test/webpack.config.js",
"compile:metaModelTool": "cd ../tools && npm run compile && cd ../protocol",
"generate:metaModel": "node ../tools/lib/main.js -p ./src/common/tsconfig.json > ./metaModel.json",
"generate:metaModel": "node ../tools/lib/generator-main.js -p ./src/common/tsconfig.json > ./metaModel.json",
"generate:metaModelSchema": "ts-json-schema-generator --path ../tools/src/metaModel.ts > ./metaModel.schema.json",
"all": "npm run clean && npm run compile && npm run lint && npm run test && npm run compile:metaModelTool && npm run generate:metaModel && npm run generate:metaModelSchema"
}
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver",
"description": "Language server implementation for node",
"version": "8.1.0-next.1",
"version": "8.1.0-next.2",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand All @@ -24,7 +24,7 @@
"vscode-languageserver-textdocument": "1.0.7"
},
"dependencies": {
"vscode-languageserver-protocol": "3.17.3-next.1"
"vscode-languageserver-protocol": "3.17.3-next.2"
},
"scripts": {
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
Expand Down
2 changes: 1 addition & 1 deletion textDocument/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-languageserver-textdocument",
"description": "A simple text document implementation for Node LSP servers",
"version": "1.0.8-next.1",
"version": "1.0.7",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
Expand Down
File renamed without changes.
Loading

0 comments on commit 3383f34

Please sign in to comment.