Skip to content

Commit

Permalink
Add gRPC support
Browse files Browse the repository at this point in the history
* Use gRPC for execution
* Remove socket connection
* Migrate to pure gprc js
* Update protobuf library

Signed-off-by: BugDiver <vinaysh@thoughtworks.com>
  • Loading branch information
BugDiver committed Sep 24, 2020
1 parent 6f84150 commit 6fa1c56
Show file tree
Hide file tree
Showing 97 changed files with 35,878 additions and 47,882 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ gauge-proto
package.json
package-lock.json
.eslintrc.js
src/gen
src/gen
config.ts
13 changes: 7 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ module.exports = {
rules: {
'padding-line-between-statements': [
'error',
{blankLine: 'always', prev: '*', next: 'return'},
{blankLine: 'always', prev: ['const', 'let', 'var'], next: '*'},
{blankLine: 'always', prev: 'class', next: '*'},
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'always', prev: 'class', next: '*' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
}
],
'padded-blocks': ['error', { 'classes': 'always' }],
'no-multiple-empty-lines': ['error', {max: 1, maxBOF: 1, maxEOF: 0}],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 1, maxEOF: 0 }],
'@typescript-eslint/unbound-method': ['warn', { 'ignoreStatic': true }],
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'comma-spacing': ['error', { before: false, after: true}],
'comma-spacing': ['error', { before: false, after: true }],
'no-multi-spaces': 'error',
'curly': 'error'
'curly': 'error',
"semi": 'error',
},
};
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [12.x,13.x, 14.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -51,8 +51,8 @@ jobs:
needs: build-artifacts
strategy:
matrix:
node-version: [10.x, 12.x]
os: [ubuntu-latest, windows-latest]
node-version: [12.x, 14.x]
os: [macOS-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,12 @@ jobs:
state: 'failure'
token: '${{ secrets.GITHUB_TOKEN }}'

- name: Bump up version
env:
GITHUB_TOKEN: '${{ secrets.PERSONAL_GITHUB_TOKEN }}'
run: |
git clean -dfx
git checkout master git checkout . && git pull --rebase
version=$(python update_version.py)
git commit -am "Bumping up -> $version"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" master
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/zsh

function checkCommand() {
command -v $1 >/dev/null 2>&1 || { echo >&2 "$1 is not installed, aborting."; exit 1; }
Expand Down
1 change: 1 addition & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'jest-ts-auto-mock';
31 changes: 25 additions & 6 deletions genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
cd gauge-proto
pbjs -t static-module -w commonjs -o ../src/gen/messages.js *.proto
pbts -o ../src/gen/messages.d.ts ../src/gen/messages.js
cp *.proto ../src/gen
rm ../src/gen/api.proto
cd ..
export PATH=$PATH:"./node_modules/.bin"

OUTPUT_DIR="src/gen"
PROTO_DIR="gauge-proto"

rm -rf $OUTPUT_DIR
mkdir $OUTPUT_DIR

grpc_tools_node_protoc \
-I $PROTO_DIR \
--js_out=import_style=commonjs,binary:$OUTPUT_DIR \
./$PROTO_DIR/messages.proto ./$PROTO_DIR/spec.proto

grpc_tools_node_protoc \
-I $PROTO_DIR \
--js_out=import_style=commonjs,binary:$OUTPUT_DIR \
--grpc_out=grpc_js:$OUTPUT_DIR \
./$PROTO_DIR/services.proto

grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--ts_out=generate_package_definition:$OUTPUT_DIR \
-I $PROTO_DIR \
./$PROTO_DIR/spec.proto ./$PROTO_DIR/messages.proto ./$PROTO_DIR/services.proto

26 changes: 17 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
module.exports = {
transform: { '^.+\\.ts?$': 'ts-jest' },
testEnvironment: 'node',
testRegex: '/tests/.*(Test)?\\.(ts)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
coveragePathIgnorePatterns: [
"/node_modules/",
"src/gen/*",
"src/utils/*"
]
transform: { '^.+\\.ts?$': 'ts-jest' },
testEnvironment: 'node',
globals: {
"ts-jest": {
"compiler": "ttypescript"
}
},
testRegex: '/tests/.*(Test)?\\.(ts)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
coveragePathIgnorePatterns: [
"/node_modules/",
"src/gen/*",
"src/utils/*"
],
setupFiles: [
"<rootDir>config.ts"
]
};
Loading

0 comments on commit 6fa1c56

Please sign in to comment.