Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
- master

jobs:
Build:
TestPlugins:
runs-on: ubuntu-18.04
timeout-minutes: 30
strategy:
Expand Down Expand Up @@ -54,3 +54,16 @@ jobs:
npm i
npm run lint
npm run test

TestLib:
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Test Dist Lib
run: |
docker build . -f tests/build/Dockerfile -t skywalking-nodejs:${{ github.sha }}
docker run --rm skywalking-nodejs:${{ github.sha }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"prepare": "npm run generate-source",
"generate-source": "scripts/protoc.sh",
"build": "tsc --build src",
"build": "npm run clean && npm run prepare && tsc --build src && OUT_DIR=lib/proto/ scripts/protoc.sh",
"lint": "tslint -p src/tsconfig.json src/**/*.ts",
"test": "DEBUG=testcontainers* jest",
"format": "prettier --write \"src/**/*.ts\"",
Expand Down
17 changes: 9 additions & 8 deletions scripts/protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
# limitations under the License.
#

ROOT_DIR="$(dirname "$0")"/..
ROOT_DIR=$(cd "$(dirname "$0")"/..; pwd)
OUT_DIR="$ROOT_DIR"/${OUT_DIR:-src/proto/}

(rm -rf src/proto || true) && (mkdir -p src/proto || true) && (rm -rf src/proto || true) && (mkdir -p src/proto || true)
mkdir -p $OUT_DIR || true

cd "${ROOT_DIR}"/protocol || exit

PROTOC_GEN_TS_PATH="../${ROOT_DIR}/node_modules/.bin/protoc-gen-ts"
PROTOC_PLUGIN="../${ROOT_DIR}/node_modules/.bin/grpc_tools_node_protoc_plugin"
PROTOC="../${ROOT_DIR}/node_modules/.bin/grpc_tools_node_protoc"
PROTOC_GEN_TS_PATH="${ROOT_DIR}/node_modules/.bin/protoc-gen-ts"
PROTOC_PLUGIN="${ROOT_DIR}/node_modules/.bin/grpc_tools_node_protoc_plugin"
PROTOC="${ROOT_DIR}/node_modules/.bin/grpc_tools_node_protoc"

${PROTOC} \
--js_out=import_style=commonjs,binary:../src/proto/ \
--grpc_out=../src/proto/ \
--js_out=import_style=commonjs,binary:$OUT_DIR \
--grpc_out=$OUT_DIR \
--plugin=protoc-gen-grpc="${PROTOC_PLUGIN}" \
**/*.proto

${PROTOC} \
--plugin=protoc-gen-ts="${PROTOC_GEN_TS_PATH}" \
--ts_out=../src/proto/ \
--ts_out=$OUT_DIR \
**/*.proto

7 changes: 4 additions & 3 deletions src/trace/context/CarrierItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
*
*/

export class CarrierItem {
value!: string;
export abstract class CarrierItem {
abstract get value(): string;
abstract set value(val: string);

constructor(public key: string) {}
protected constructor(public key: string) {}
}
29 changes: 29 additions & 0 deletions tests/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

FROM node:12

WORKDIR /app

ADD . /app

RUN npm install request && npm install && npm run build

ADD tests/build/main.ts /test/main.ts
ADD tests/build/package.json /test/package.json

WORKDIR /test

RUN npm install && npm install /app && npm run build
25 changes: 25 additions & 0 deletions tests/build/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*!
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/

import agent from 'skywalking-backend-js';

agent.start({
serviceName: 'server',
maxBufferSize: 1000,
});
16 changes: 16 additions & 0 deletions tests/build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "test",
"version": "1.0.0",
"scripts": {
"build": "tsc main.ts"
},
"author": "",
"license": "ISC",
"dependencies": {
"tslib": "^2.1.0"
},
"devDependencies": {
"@types/node": "^14.14.21",
"typescript": "^4.1.3"
}
}
14 changes: 14 additions & 0 deletions tests/build/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"rootDir": ".",
"baseUrl": ".",
"outDir": ".",
"resolveJsonModule": true,
"composite": true,
"esModuleInterop": true
},
"files": [
"package.json"
]
}