Skip to content

Commit

Permalink
Add build, lint, testing, CI support (#283)
Browse files Browse the repository at this point in the history
* Add build, lint, CI support

* PR comment

* PR fix

* Whitespace change

* Whitespace change

* Fix build
  • Loading branch information
StephenWeatherford authored Jun 30, 2018
1 parent 7f62ef9 commit e4c8ea6
Show file tree
Hide file tree
Showing 9 changed files with 447 additions and 3,206 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
out
node_modules
*.vsix
*.vsix
package-lock.json

# Artifacts from running vscode extension tests
.vscode-test
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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
2 changes: 1 addition & 1 deletion dockerHubApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function tagsForImage(image: IHubSearchResponseResult): string {

export function searchImageInRegistryHub(imageName: string, cache: boolean): Promise<IHubSearchResponseResult> {
return invokeHubSearch(imageName, 1, cache).then((data) => {
if (data.results.length === 0) {
if ((<IHubSearchResponseResult[]>data.results).length === 0) {
return;
}
return data.results[0];
Expand Down
46 changes: 46 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

const gulp = require('gulp');
const path = require('path');
const azureStorage = require('azure-storage');
const vsce = require('vsce');
const packageJson = require('./package.json');

gulp.task('package', async () => {
await vsce.createVSIX();
});

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();
}
});
}
});
}
});
Loading

0 comments on commit e4c8ea6

Please sign in to comment.