mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Merge branch 'master' into native_package_included_directories
This commit is contained in:
commit
38e2a60ddc
31
gulpfile.js
31
gulpfile.js
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
|
||||
@ -12,7 +29,10 @@ require('./test/gulpfile');
|
||||
const root = __dirname;
|
||||
|
||||
gulp.task('install.all', 'Install dependencies for all subdirectory packages',
|
||||
['js.core.install', 'native.core.install', 'health-check.install']);
|
||||
['js.core.install', 'native.core.install', 'health-check.install', 'internal.test.install']);
|
||||
|
||||
gulp.task('install.all.windows', 'Install dependencies for all subdirectory packages for MS Windows',
|
||||
['js.core.install', 'native.core.install.windows', 'health-check.install', 'internal.test.install']);
|
||||
|
||||
gulp.task('lint', 'Emit linting errors in source and test files',
|
||||
['js.core.lint', 'native.core.lint']);
|
||||
@ -30,7 +50,12 @@ gulp.task('link', 'Link local packages together after building',
|
||||
gulp.start('link.only');
|
||||
});
|
||||
|
||||
gulp.task('setup', 'One-time setup for a clean repository', ['install.all', 'link']);
|
||||
gulp.task('setup', 'One-time setup for a clean repository', ['install.all'], () => {
|
||||
gulp.start('link');
|
||||
});
|
||||
gulp.task('setup.windows', 'One-time setup for a clean repository for MS Windows', ['install.all.windows'], () => {
|
||||
gulp.start('link');
|
||||
});
|
||||
|
||||
gulp.task('clean', 'Delete generated files', ['js.core.clean', 'native.core.clean']);
|
||||
|
||||
@ -52,4 +77,6 @@ gulp.task('test', 'Run all tests', ['build'], () => {
|
||||
gulp.start('test.only');
|
||||
});
|
||||
|
||||
gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']);
|
||||
|
||||
gulp.task('default', ['help']);
|
||||
|
||||
26
install-nvm-windows.ps1
Normal file
26
install-nvm-windows.ps1
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright 2017 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# We're going to store nvm-windows in the .\nvm directory.
|
||||
$env:NVM_HOME = (Get-Item -Path ".\" -Verbose).FullName + "\nvm"
|
||||
|
||||
# Downloading and unpacking nvm-windows
|
||||
Invoke-WebRequest -Uri https://github.com/coreybutler/nvm-windows/releases/download/1.1.5/nvm-noinstall.zip -OutFile nvm-noinstall.zip
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("nvm-noinstall.zip", "nvm")
|
||||
|
||||
$env:Path = $env:NVM_HOME + ";" + $env:Path
|
||||
Out-File -Encoding "OEM" nvm\settings.txt
|
||||
nvm root $env:NVM_HOME
|
||||
"%*" | Out-File -Encoding "OEM" nvm\elevate.cmd
|
||||
22
kokoro.bat
Normal file
22
kokoro.bat
Normal file
@ -0,0 +1,22 @@
|
||||
@rem Copyright 2017 gRPC authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
|
||||
@echo "Starting Windows test"
|
||||
|
||||
cd /d %~dp0
|
||||
|
||||
git submodule update --init
|
||||
git submodule foreach --recursive git submodule update --init
|
||||
|
||||
.\run-tests.bat
|
||||
55
merge_kokoro_logs.js
Normal file
55
merge_kokoro_logs.js
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const xml2js = require('xml2js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
const writeFile = util.promisify(fs.writeFile);
|
||||
const readDir = util.promisify(fs.readdir);
|
||||
|
||||
const rootDir = __dirname;
|
||||
|
||||
readDir(rootDir + '/reports')
|
||||
.then((dirNames) =>
|
||||
Promise.all(dirNames.map((dirName) =>
|
||||
readDir(path.resolve(rootDir, 'reports', dirName))
|
||||
.then((fileNames) =>
|
||||
Promise.all(fileNames.map((name) =>
|
||||
readFile(path.resolve(rootDir, 'reports', dirName, name))
|
||||
.then((content) => {
|
||||
let parser = new xml2js.Parser();
|
||||
const parseString = util.promisify(parser.parseString.bind(parser));
|
||||
return parseString(content);
|
||||
})
|
||||
))
|
||||
)
|
||||
.then((objects) => {
|
||||
let merged = objects[0];
|
||||
merged.testsuites.testsuite = Array.prototype.concat.apply([], objects.map((obj) => obj.testsuites.testsuite));
|
||||
let builder = new xml2js.Builder();
|
||||
let xml = builder.buildObject(merged);
|
||||
let resultName = path.resolve(rootDir, 'reports', dirName, 'sponge_log.xml');
|
||||
console.log(`Writing ${resultName}`);
|
||||
return writeFile(resultName, xml);
|
||||
})
|
||||
))
|
||||
)
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
17
package.json
17
package.json
@ -8,32 +8,27 @@
|
||||
"name": "Google Inc."
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"async": "^2.5.0",
|
||||
"body-parser": "^1.18.0",
|
||||
"execa": "^0.8.0",
|
||||
"express": "^4.15.4",
|
||||
"google-auth-library": "^0.11.0",
|
||||
"lodash": "^4.17.4",
|
||||
"mocha-jenkins-reporter": "^0.3.9",
|
||||
"poisson-process": "^0.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"del": "^3.0.0",
|
||||
"execa": "^0.8.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-help": "^1.6.1",
|
||||
"gulp-jsdoc3": "^1.0.1",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"gulp-mocha": "^4.3.1",
|
||||
"gulp-sourcemaps": "^2.6.1",
|
||||
"gulp-tslint": "^8.1.1",
|
||||
"gulp-typescript": "^3.2.2",
|
||||
"gulp-util": "^3.0.8",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.9.5",
|
||||
"merge2": "^1.1.0",
|
||||
"mocha": "^3.5.3",
|
||||
"mocha-jenkins-reporter": "^0.3.9",
|
||||
"through2": "^2.0.3",
|
||||
"tslint": "^5.5.0",
|
||||
"typescript": "^2.5.1"
|
||||
"typescript": "^2.5.1",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const _gulp = require('gulp');
|
||||
|
||||
@ -207,6 +207,9 @@
|
||||
'target_name': 'boringssl',
|
||||
'product_prefix': 'lib',
|
||||
'type': 'static_library',
|
||||
'cflags': [
|
||||
'-Wimplicit-fallthrough=0'
|
||||
],
|
||||
'dependencies': [
|
||||
],
|
||||
'sources': [
|
||||
|
||||
@ -35,7 +35,7 @@ grpc_completion_queue *queue;
|
||||
uv_prepare_t prepare;
|
||||
int pending_batches;
|
||||
|
||||
void drain_completion_queue(uv_prepare_t *handle) {
|
||||
static void drain_completion_queue(uv_prepare_t *handle) {
|
||||
Nan::HandleScope scope;
|
||||
grpc_event event;
|
||||
(void)handle;
|
||||
@ -53,9 +53,9 @@ void drain_completion_queue(uv_prepare_t *handle) {
|
||||
CompleteTag(event.tag, error_message);
|
||||
grpc::node::DestroyTag(event.tag);
|
||||
pending_batches--;
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_stop(&prepare);
|
||||
}
|
||||
}
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_stop(&prepare);
|
||||
}
|
||||
} while (event.type != GRPC_QUEUE_TIMEOUT);
|
||||
}
|
||||
@ -76,5 +76,15 @@ void CompletionQueueInit(Local<Object> exports) {
|
||||
pending_batches = 0;
|
||||
}
|
||||
|
||||
void CompletionQueueForcePoll() {
|
||||
/* This sets the prepare object to poll on the completion queue the next time
|
||||
* Node polls for IO. But it doesn't increment the number of pending batches,
|
||||
* so it will immediately stop polling after that unless there is an
|
||||
* intervening CompletionQueueNext call */
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_start(&prepare, drain_completion_queue);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
} // namespace grpc
|
||||
|
||||
@ -28,5 +28,7 @@ void CompletionQueueNext();
|
||||
|
||||
void CompletionQueueInit(v8::Local<v8::Object> exports);
|
||||
|
||||
void CompletionQueueForcePoll();
|
||||
|
||||
} // namespace node
|
||||
} // namespace grpc
|
||||
|
||||
@ -265,6 +265,10 @@ NAN_METHOD(SetLogVerbosity) {
|
||||
gpr_set_log_verbosity(severity);
|
||||
}
|
||||
|
||||
NAN_METHOD(ForcePoll) {
|
||||
grpc::node::CompletionQueueForcePoll();
|
||||
}
|
||||
|
||||
void init(Local<Object> exports) {
|
||||
Nan::HandleScope scope;
|
||||
grpc_init();
|
||||
@ -306,6 +310,9 @@ void init(Local<Object> exports) {
|
||||
Nan::Set(exports, Nan::New("setLogVerbosity").ToLocalChecked(),
|
||||
Nan::GetFunction(Nan::New<FunctionTemplate>(SetLogVerbosity))
|
||||
.ToLocalChecked());
|
||||
Nan::Set(exports, Nan::New("forcePoll").ToLocalChecked(),
|
||||
Nan::GetFunction(Nan::New<FunctionTemplate>(ForcePoll))
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
NODE_MODULE(grpc_node, init)
|
||||
|
||||
@ -1,9 +1,27 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
|
||||
// gulp-help monkeypatches tasks to have an additional description parameter
|
||||
const gulp = help(_gulp);
|
||||
|
||||
const jsdoc = require('gulp-jsdoc3');
|
||||
const jshint = require('gulp-jshint');
|
||||
const mocha = require('gulp-mocha');
|
||||
const execa = require('execa');
|
||||
@ -30,7 +48,16 @@ gulp.task('native.core.install', 'Install native core dependencies', () => {
|
||||
{cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('native.core.link.create', 'Create npm link', ['native.core.install'], () => {
|
||||
gulp.task('native.core.install.windows', 'Install native core dependencies for MS Windows', () => {
|
||||
return execa('npm', ['install', '--build-from-source'],
|
||||
{cwd: nativeCoreDir, stdio: 'inherit'}).catch(() =>
|
||||
del(path.resolve(process.env.USERPROFILE, '.node-gyp', process.versions.node, 'include/node/openssl'), { force: true }).then(() =>
|
||||
execa('npm', ['install', '--build-from-source'],
|
||||
{cwd: nativeCoreDir, stdio: 'inherit'})
|
||||
))
|
||||
});
|
||||
|
||||
gulp.task('native.core.link.create', 'Create npm link', () => {
|
||||
return execa('npm', ['link'], {cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
@ -41,9 +68,15 @@ gulp.task('native.core.lint', 'Emits linting errors', () => {
|
||||
});
|
||||
|
||||
gulp.task('native.core.build', 'Build native package', () => {
|
||||
return execa('node-pre-gyp', ['build'], {cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
return execa('npm', ['run', 'build'], {cwd: nativeCoreDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => {
|
||||
return gulp.src(`${testDir}/*.js`).pipe(mocha({reporter: 'mocha-jenkins-reporter'}));
|
||||
});
|
||||
|
||||
gulp.task('native.core.doc.gen', 'Generate docs', (cb) => {
|
||||
var config = require('./jsdoc_conf.json');
|
||||
gulp.src([`${nativeCoreDir}/README.md`, `${nativeCoreDir}/index.js`, `${srcDir}/*.js`], {read: false})
|
||||
.pipe(jsdoc(config, cb));
|
||||
});
|
||||
|
||||
@ -2,14 +2,8 @@
|
||||
"tags": {
|
||||
"allowUnknownTags": true
|
||||
},
|
||||
"source": {
|
||||
"include": [ "src/node/index.js", "src/node/src" ],
|
||||
"includePattern": "src/node/.+\\.js(doc)?$",
|
||||
"excludePattern": "(^|\\/|\\\\)_"
|
||||
},
|
||||
"opts": {
|
||||
"package": "package.json",
|
||||
"readme": "src/node/README.md"
|
||||
"destination": "docs/gen/native/core"
|
||||
},
|
||||
"plugins": ["plugins/markdown"],
|
||||
"templates": {
|
||||
|
||||
@ -19,10 +19,8 @@
|
||||
"lib": "src/node/src"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore",
|
||||
"test": "./node_modules/.bin/mocha test && npm run-script lint",
|
||||
"build": "./node_modules/.bin/node-pre-gyp build",
|
||||
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json",
|
||||
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library"
|
||||
},
|
||||
@ -37,17 +35,9 @@
|
||||
"protobufjs": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "^2.0.1",
|
||||
"body-parser": "^1.15.2",
|
||||
"electron-mocha": "^3.1.1",
|
||||
"express": "^4.14.0",
|
||||
"google-auth-library": "^0.9.2",
|
||||
"google-protobuf": "^3.0.0",
|
||||
"istanbul": "^0.4.4",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.5.0",
|
||||
"minimist": "^1.1.0",
|
||||
"poisson-process": "^0.2.1"
|
||||
"istanbul": "^0.4.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
||||
@ -800,7 +800,10 @@ Client.prototype.waitForReady = function(deadline, callback) {
|
||||
self.$channel.watchConnectivityState(new_state, deadline, checkState);
|
||||
}
|
||||
};
|
||||
checkState();
|
||||
/* Force a single round of polling to ensure that the channel state is up
|
||||
* to date */
|
||||
grpc.forcePoll();
|
||||
setImmediate(checkState);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -194,6 +194,9 @@
|
||||
'target_name': '${lib.name}',
|
||||
'product_prefix': 'lib',
|
||||
'type': 'static_library',
|
||||
'cflags': [
|
||||
'-Wimplicit-fallthrough=0'
|
||||
],
|
||||
'dependencies': [
|
||||
% for dep in getattr(lib, 'deps', []):
|
||||
'${dep}',
|
||||
|
||||
@ -21,10 +21,8 @@
|
||||
"lib": "src/node/src"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore",
|
||||
"test": "./node_modules/.bin/mocha test && npm run-script lint",
|
||||
"build": "./node_modules/.bin/node-pre-gyp build",
|
||||
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json",
|
||||
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library"
|
||||
},
|
||||
@ -39,19 +37,9 @@
|
||||
"protobufjs": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "^2.0.1",
|
||||
"body-parser": "^1.15.2",
|
||||
"electron-mocha": "^3.1.1",
|
||||
"express": "^4.14.0",
|
||||
"google-auth-library": "^0.9.2",
|
||||
"google-protobuf": "^3.0.0",
|
||||
"istanbul": "^0.4.4",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.5.0",
|
||||
"minimist": "^1.1.0",
|
||||
"mocha": "^3.0.2",
|
||||
"mocha-jenkins-reporter": "^0.2.3",
|
||||
"poisson-process": "^0.2.1"
|
||||
"istanbul": "^0.4.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
||||
46
run-tests.bat
Normal file
46
run-tests.bat
Normal file
@ -0,0 +1,46 @@
|
||||
@rem Copyright 2017 gRPC authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
|
||||
SET ROOT=%~dp0
|
||||
cd /d %~dp0
|
||||
|
||||
PowerShell -Command .\install-nvm-windows.ps1
|
||||
|
||||
SET NVM_HOME=%ROOT%nvm
|
||||
SET NVM_SYMLINK=%ROOT%nvm\nodejs
|
||||
SET PATH=%NVM_HOME%;%NVM_SYMLINK%;%PATH%
|
||||
|
||||
nvm version
|
||||
|
||||
nvm install 8.5.0
|
||||
nvm use 8.5.0
|
||||
|
||||
call npm install || goto :error
|
||||
|
||||
for %%v in (4.8.4 6.11.3 7.9.0 8.5.0) do (
|
||||
nvm install %%v
|
||||
nvm use %%v
|
||||
node -e "console.log(process.versions)"
|
||||
|
||||
call .\node_modules\.bin\gulp clean.all || goto :error
|
||||
call .\node_modules\.bin\gulp setup.windows || goto :error
|
||||
call .\node_modules\.bin\gulp native.test || goto :error
|
||||
)
|
||||
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
exit /b 1
|
||||
15
run-tests.sh
15
run-tests.sh
@ -30,12 +30,12 @@ if [ ! -n "$node_versions" ] ; then
|
||||
fi
|
||||
|
||||
set +ex
|
||||
nvm install 8
|
||||
nvm install lts/*
|
||||
nvm use lts/*
|
||||
set -ex
|
||||
|
||||
npm install --unsafe-perm
|
||||
./node_modules/.bin/gulp setup
|
||||
|
||||
mkdir -p reports
|
||||
|
||||
@ -43,7 +43,6 @@ mkdir -p reports
|
||||
|
||||
for version in ${node_versions}
|
||||
do
|
||||
cd $ROOT
|
||||
# Install and setup node for the version we want.
|
||||
set +ex
|
||||
echo "Switching to node version $version"
|
||||
@ -55,16 +54,18 @@ do
|
||||
|
||||
# Install dependencies and link packages together.
|
||||
./node_modules/.bin/gulp clean.all
|
||||
./node_modules/.bin/gulp link
|
||||
./node_modules/.bin/gulp setup
|
||||
|
||||
# Rebuild libraries and run tests.
|
||||
JUNIT_REPORT_PATH="reports/node$version/" JUNIT_REPORT_STACK=1 ./node_modules/.bin/gulp native.test || FAILED="true"
|
||||
cd "reports/node$version"
|
||||
for file in * ; do
|
||||
mv $file $(echo $file | sed 's/\(.*\)\.xml/\1_sponge_log.xml/')
|
||||
done
|
||||
done
|
||||
|
||||
set +ex
|
||||
nvm use 8
|
||||
set -ex
|
||||
|
||||
node merge_kokoro_logs.js
|
||||
|
||||
if [ "$FAILED" != "" ]
|
||||
then
|
||||
exit 1
|
||||
|
||||
15
setup.sh
15
setup.sh
@ -1,3 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2017 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if [ -z $NODE_H2 ]; then
|
||||
echo "\$NODE_H2 must point to a node binary"
|
||||
exit 1
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
@ -15,6 +32,10 @@ gulp.task('internal.test.clean.links', 'Delete npm links', () => {
|
||||
return del(path.resolve(testDir, 'node_modules/grpc'));
|
||||
});
|
||||
|
||||
gulp.task('internal.test.install', 'Install test dependencies', () => {
|
||||
return execa('npm', ['install'], {cwd: testDir, stdio: 'inherit'});
|
||||
});
|
||||
|
||||
gulp.task('internal.test.clean.all', 'Delete all files created by tasks',
|
||||
['internal.test.clean.links']);
|
||||
|
||||
|
||||
@ -19,6 +19,6 @@ build_file: "grpc-node/kokoro.sh"
|
||||
timeout_mins: 60
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: "github/grpc-node/reports/**"
|
||||
regex: "github/grpc-node/reports/**/sponge_log.xml"
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,6 @@ build_file: "grpc-node/kokoro.sh"
|
||||
timeout_mins: 60
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: "github/grpc-node/reports/**"
|
||||
regex: "github/grpc-node/reports/**/sponge_log.xml"
|
||||
}
|
||||
}
|
||||
|
||||
19
test/kokoro/windows.cfg
Normal file
19
test/kokoro/windows.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright 2017 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Config file for Kokoro (in protobuf text format)
|
||||
|
||||
# Location of the continuous shell script in repository.
|
||||
build_file: "grpc-node/kokoro.bat"
|
||||
timeout_mins: 60
|
||||
25
test/package.json
Normal file
25
test/package.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "grpc-node-test",
|
||||
"version": "0.1.0",
|
||||
"description": "Dummy package for the grpc-node repository tests",
|
||||
"private": true,
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Google Inc."
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Google Inc."
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"async": "^2.0.1",
|
||||
"body-parser": "^1.15.2",
|
||||
"express": "^4.14.0",
|
||||
"google-auth-library": "^0.9.2",
|
||||
"lodash": "^4.17.4",
|
||||
"minimist": "^1.1.0",
|
||||
"poisson-process": "^0.2.1"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user