Switch from travis ci to azure pipelines (#912)
This commit is contained in:
Родитель
a0fafcab00
Коммит
002b1b5a93
|
@ -0,0 +1,9 @@
|
|||
steps:
|
||||
- task: Npm@1
|
||||
displayName: 'npm install'
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'Build'
|
||||
inputs:
|
||||
command: custom
|
||||
customCommand: run build
|
|
@ -0,0 +1,9 @@
|
|||
steps:
|
||||
- task: Npm@1
|
||||
displayName: 'Lint'
|
||||
inputs:
|
||||
command: custom
|
||||
customCommand: run lint
|
||||
|
||||
- task: ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
|
@ -0,0 +1,7 @@
|
|||
steps:
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
inputs:
|
||||
testResultsFiles: '*-results.xml'
|
||||
testRunTitle: '$(Agent.OS)'
|
||||
condition: succeededOrFailed()
|
|
@ -0,0 +1,18 @@
|
|||
steps:
|
||||
- task: Npm@1
|
||||
displayName: 'Package'
|
||||
inputs:
|
||||
command: custom
|
||||
customCommand: run package
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy vsix to staging directory'
|
||||
inputs:
|
||||
Contents: '**/*.vsix'
|
||||
TargetFolder: '$(build.artifactstagingdirectory)'
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish artifacts: vsix'
|
||||
inputs:
|
||||
PathtoPublish: '$(build.artifactstagingdirectory)'
|
||||
ArtifactName: vsix
|
|
@ -0,0 +1,11 @@
|
|||
steps:
|
||||
- task: Gulp@0
|
||||
displayName: 'Test'
|
||||
inputs:
|
||||
targets: 'test'
|
||||
env:
|
||||
SERVICE_PRINCIPAL_CLIENT_ID: $(SERVICE_PRINCIPAL_CLIENT_ID)
|
||||
SERVICE_PRINCIPAL_SECRET: $(SERVICE_PRINCIPAL_SECRET)
|
||||
SERVICE_PRINCIPAL_DOMAIN: $(SERVICE_PRINCIPAL_DOMAIN)
|
||||
|
||||
- template: publish-test-results.yml
|
|
@ -0,0 +1,18 @@
|
|||
steps:
|
||||
- script: |
|
||||
sudo cp .azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
|
||||
sudo chmod +x /etc/init.d/xvfb
|
||||
sudo update-rc.d xvfb defaults
|
||||
sudo service xvfb start
|
||||
displayName: 'Start X Virtual Frame Buffer'
|
||||
|
||||
- script: |
|
||||
export DISPLAY=:10
|
||||
gulp test
|
||||
displayName: 'Test'
|
||||
env:
|
||||
SERVICE_PRINCIPAL_CLIENT_ID: $(SERVICE_PRINCIPAL_CLIENT_ID)
|
||||
SERVICE_PRINCIPAL_SECRET: $(SERVICE_PRINCIPAL_SECRET)
|
||||
SERVICE_PRINCIPAL_DOMAIN: $(SERVICE_PRINCIPAL_DOMAIN)
|
||||
|
||||
- template: ../common/publish-test-results.yml
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# COPIED FROM https://github.com/Microsoft/vscode/blob/e29c517386fe6f3a40e2f0ff00effae4919406aa/build/tfs/linux/x64/xvfb.init
|
||||
#
|
||||
#
|
||||
# /etc/rc.d/init.d/xvfbd
|
||||
#
|
||||
# chkconfig: 345 95 28
|
||||
# description: Starts/Stops X Virtual Framebuffer server
|
||||
# processname: Xvfb
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: xvfb
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start xvfb at boot time
|
||||
# Description: Enable xvfb provided by daemon.
|
||||
### END INIT INFO
|
||||
|
||||
[ "${NETWORKING}" = "no" ] && exit 0
|
||||
|
||||
PROG="/usr/bin/Xvfb"
|
||||
PROG_OPTIONS=":10 -ac"
|
||||
PROG_OUTPUT="/tmp/Xvfb.out"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting : X Virtual Frame Buffer "
|
||||
$PROG $PROG_OPTIONS>>$PROG_OUTPUT 2>&1 &
|
||||
disown -ar
|
||||
;;
|
||||
stop)
|
||||
echo "Shutting down : X Virtual Frame Buffer"
|
||||
killproc $PROG
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && /bin/rm -f /var/lock/subsys/Xvfb
|
||||
/var/run/Xvfb.pid
|
||||
echo
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
status Xvfb
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 (start|stop|restart|reload|status)"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
|
@ -0,0 +1,25 @@
|
|||
jobs:
|
||||
- job: Windows
|
||||
pool:
|
||||
vmImage: VS2017-Win2016
|
||||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/lint.yml
|
||||
- template: common/test.yml
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/publish-vsix.yml # Only publish vsix from linux build since we use this to release and want to stay consistent
|
||||
- template: common/lint.yml
|
||||
- template: linux/test-linux.yml
|
||||
|
||||
- job: macOS
|
||||
pool:
|
||||
vmImage: macOS 10.13
|
||||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/lint.yml
|
||||
- template: common/test.yml
|
|
@ -260,6 +260,7 @@ package-lock.json
|
|||
|
||||
# Artifacts from running vscode extension tests
|
||||
.vscode-test
|
||||
test-results.xml
|
||||
|
||||
# Artifacts from ANTLR4 extension
|
||||
grammar/.antlr
|
||||
|
|
28
.travis.yml
28
.travis.yml
|
@ -1,28 +0,0 @@
|
|||
language: node_js
|
||||
|
||||
sudo: false
|
||||
|
||||
node_js:
|
||||
- 'stable'
|
||||
|
||||
before_install:
|
||||
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
||||
sh -e /etc/init.d/xvfb start;
|
||||
sleep 3;
|
||||
fi
|
||||
|
||||
install:
|
||||
- npm install
|
||||
|
||||
script:
|
||||
- npm run build
|
||||
- gulp package
|
||||
- gulp upload-vsix
|
||||
- npm run lint
|
||||
- npm test
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: always
|
|
@ -15,7 +15,7 @@
|
|||
"outFiles": [
|
||||
"${workspaceRoot}/out/src/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "Compile"
|
||||
"preLaunchTask": "npm: compile"
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
|
@ -31,7 +31,13 @@
|
|||
"outFiles": [
|
||||
"${workspaceRoot}/out/test"
|
||||
],
|
||||
"preLaunchTask": "Compile"
|
||||
"preLaunchTask": "npm: compile",
|
||||
"env": {
|
||||
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
|
||||
"MOCHA_enableTimeouts": "0", // Disable time-outs
|
||||
"DEBUGTELEMETRY": "1",
|
||||
"NODE_DEBUG": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
|
|
|
@ -1,33 +1,23 @@
|
|||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
// A task runner that calls a custom npm script that compiles the extension.
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"args": [
|
||||
"run",
|
||||
"compile",
|
||||
"--loglevel",
|
||||
"silent"
|
||||
],
|
||||
"type": "npm",
|
||||
"script": "compile",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "silent"
|
||||
},
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "lint",
|
||||
"problemMatcher": "$tslint5"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,3 +10,5 @@ package-lock.json
|
|||
tsconfig.json
|
||||
tslint.json
|
||||
.github/**
|
||||
test-results.xml
|
||||
.azure-pipelines/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
# Cosmos DB Support for VS Code (Preview)
|
||||
|
||||
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Build Status](https://travis-ci.org/Microsoft/vscode-cosmosdb.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-cosmosdb)
|
||||
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-cosmosdb.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-cosmosdb) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-cosmosdb)](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=7)
|
||||
|
||||
Browse and query your MongoDB databases both locally and in the cloud using [_scrapbooks_](#mongo-scrapbooks) with rich Intellisense then connect to Azure to manage your Cosmos DB databases with support for MongoDB, Graph (Gremlin), and SQL (previously known as DocumentDB).
|
||||
|
||||
|
|
67
gulpfile.js
67
gulpfile.js
|
@ -4,43 +4,44 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const gulp = require('gulp');
|
||||
const decompress = require('gulp-decompress');
|
||||
const download = require('gulp-download');
|
||||
const path = require('path');
|
||||
const azureStorage = require('azure-storage');
|
||||
const vsce = require('vsce');
|
||||
const packageJson = require('./package.json');
|
||||
const os = require('os');
|
||||
const cp = require('child_process');
|
||||
const glob = require('glob');
|
||||
|
||||
gulp.task('package', async () => {
|
||||
await vsce.createVSIX();
|
||||
gulp.task('test', ['install-azure-account'], (cb) => {
|
||||
const env = process.env;
|
||||
env.DEBUGTELEMETRY = 1;
|
||||
env.MOCHA_reporter = 'mocha-junit-reporter';
|
||||
env.MOCHA_FILE = path.join(__dirname, 'test-results.xml');
|
||||
const cmd = cp.spawn('node', ['./node_modules/vscode/bin/test'], { stdio: 'inherit', env });
|
||||
cmd.on('close', (code) => {
|
||||
cb(code);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('upload-vsix', (callback) => {
|
||||
if (process.env.TRAVIS_PULL_REQUEST_BRANCH) {
|
||||
console.log('Skipping upload-vsix for PR build.');
|
||||
} else {
|
||||
const containerName = packageJson.name;
|
||||
const vsixName = `${packageJson.name}-${packageJson.version}.vsix`;
|
||||
const blobPath = path.join(process.env.TRAVIS_BRANCH, process.env.TRAVIS_BUILD_NUMBER, vsixName);
|
||||
const blobService = azureStorage.createBlobService(process.env.STORAGE_NAME, process.env.STORAGE_KEY);
|
||||
blobService.createContainerIfNotExists(containerName, { publicAccessLevel: "blob" }, (err) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
blobService.createBlockBlobFromLocalFile(containerName, blobPath, vsixName, (err) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
const brightYellowFormatting = '\x1b[33m\x1b[1m%s\x1b[0m';
|
||||
const brightWhiteFormatting = '\x1b[1m%s\x1b[0m';
|
||||
console.log();
|
||||
console.log(brightYellowFormatting, '================================================ vsix url ================================================');
|
||||
console.log();
|
||||
console.log(brightWhiteFormatting, blobService.getUrl(containerName, blobPath));
|
||||
console.log();
|
||||
console.log(brightYellowFormatting, '==========================================================================================================');
|
||||
console.log();
|
||||
/**
|
||||
* Installs the azure account extension before running tests (otherwise our extension would fail to activate)
|
||||
* NOTE: The version isn't super important since we don't actually use the account extension in tests
|
||||
*/
|
||||
gulp.task('install-azure-account', () => {
|
||||
const version = '0.4.3';
|
||||
const extensionPath = path.join(os.homedir(), `.vscode/extensions/ms-vscode.azure-account-${version}`);
|
||||
const existingExtensions = glob.sync(extensionPath.replace(version, '*'));
|
||||
if (existingExtensions.length === 0) {
|
||||
return download(`http://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/azure-account/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage`)
|
||||
.pipe(decompress({
|
||||
filter: file => file.path.startsWith('extension/'),
|
||||
map: file => {
|
||||
file.path = file.path.slice(10);
|
||||
return file;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}))
|
||||
.pipe(gulp.dest(extensionPath));
|
||||
} else {
|
||||
console.log('Azure Account extension already installed.');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -885,13 +885,13 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "tsc -p ./",
|
||||
"build": "tsc -p ./",
|
||||
"compile": "tsc -watch -p ./",
|
||||
"package": "vsce package",
|
||||
"lint": "tslint --project tsconfig.json -t verbose",
|
||||
"lint-fix": "tslint --project tsconfig.json -t verbose --fix",
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"test": "npm run build && node ./node_modules/vscode/bin/test",
|
||||
"test": "gulp test",
|
||||
"update-grammar": "antlr4ts -visitor ./grammar/mongo.g4 -o ./src/mongo/grammar",
|
||||
"all": "npm i && npm run lint && npm test"
|
||||
},
|
||||
|
@ -907,9 +907,12 @@
|
|||
"@types/socket.io": "^1.4.32",
|
||||
"@types/socket.io-client": "^1.4.32",
|
||||
"antlr4ts-cli": "^0.4.0-alpha.4",
|
||||
"azure-storage": "^2.8.1",
|
||||
"glob": "^7.1.3",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-decompress": "^2.0.2",
|
||||
"gulp-download": "^0.0.1",
|
||||
"mocha": "^2.3.3",
|
||||
"mocha-junit-reporter": "^1.18.0",
|
||||
"@types/opn": "^5.1.0",
|
||||
"tslint": "^5.7.0",
|
||||
"tslint-microsoft-contrib": "5.0.1",
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IHookCallbackContext } from 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
// tslint:disable-next-line:strict-boolean-expressions export-name
|
||||
export let longRunningTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.ENABLE_LONG_RUNNING_TESTS || '');
|
||||
|
||||
// Runs before all tests
|
||||
suiteSetup(async function (this: IHookCallbackContext): Promise<void> {
|
||||
this.timeout(120 * 1000);
|
||||
await vscode.commands.executeCommand('cosmosDB.refresh'); // activate the extension before tests begin
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//
|
||||
|
@ -15,13 +15,41 @@
|
|||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
var testRunner = require('vscode/lib/testrunner');
|
||||
import testRunner = require('vscode/lib/testrunner');
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
const options: { [key: string]: string | boolean | number } = {
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: true // colored output from test results
|
||||
});
|
||||
};
|
||||
|
||||
// You can directly control Mocha options using environment variables beginning with MOCHA_.
|
||||
// For example:
|
||||
// {
|
||||
// "name": "Launch Tests",
|
||||
// "type": "extensionHost",
|
||||
// "request": "launch",
|
||||
// ...
|
||||
// "env": {
|
||||
// "MOCHA_enableTimeouts": "0",
|
||||
// "MOCHA_grep": "tests-to-run"
|
||||
// }
|
||||
//
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for all available options
|
||||
|
||||
for (const envVar of Object.keys(process.env)) {
|
||||
const match: RegExpMatchArray | null = envVar.match(/^mocha_(.+)/i);
|
||||
if (match) {
|
||||
const [, option] = match;
|
||||
// tslint:disable-next-line:strict-boolean-expressions
|
||||
let value: string | number = process.env[envVar] || '';
|
||||
if (!isNaN(parseInt(value))) {
|
||||
value = parseInt(value);
|
||||
}
|
||||
options[option] = value;
|
||||
}
|
||||
}
|
||||
console.warn(`Mocha options: ${JSON.stringify(options, null, 2)}`);
|
||||
|
||||
testRunner.configure(options);
|
||||
|
||||
module.exports = testRunner;
|
Загрузка…
Ссылка в новой задаче