From 64dcb4b827f23ee8d3a9df1d64abf48d352dcb6b Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Mon, 1 Jul 2019 11:11:22 -0700 Subject: [PATCH] build: run synthtool --- .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .jsdoc.js | 48 ++++++++++++++ .kokoro/common.cfg | 24 +++++++ .kokoro/continuous/node10/common.cfg | 34 ++++++++++ .kokoro/continuous/node10/docs.cfg | 4 ++ .kokoro/continuous/node10/lint.cfg | 4 ++ .kokoro/continuous/node10/samples-test.cfg | 7 ++ .kokoro/continuous/node10/system-test.cfg | 7 ++ .kokoro/continuous/node10/test.cfg | 37 +++++++++++ .kokoro/continuous/node11/common.cfg | 24 +++++++ .kokoro/continuous/node11/test.cfg | 0 .kokoro/continuous/node8/common.cfg | 24 +++++++ .kokoro/continuous/node8/test.cfg | 0 .kokoro/docs.sh | 25 ++++++++ .kokoro/lint.sh | 33 ++++++++++ .kokoro/presubmit/node10/common.cfg | 34 ++++++++++ .kokoro/presubmit/node10/docs.cfg | 4 ++ .kokoro/presubmit/node10/lint.cfg | 4 ++ .kokoro/presubmit/node10/samples-test.cfg | 7 ++ .kokoro/presubmit/node10/system-test.cfg | 7 ++ .kokoro/presubmit/node10/test.cfg | 0 .kokoro/presubmit/node11/common.cfg | 24 +++++++ .kokoro/presubmit/node11/test.cfg | 0 .kokoro/presubmit/node8/common.cfg | 24 +++++++ .kokoro/presubmit/node8/test.cfg | 0 .kokoro/presubmit/windows/common.cfg | 2 + .kokoro/presubmit/windows/test.cfg | 2 + .kokoro/publish.sh | 31 +++++++++ .kokoro/release/docs.cfg | 26 ++++++++ .kokoro/release/docs.sh | 50 +++++++++++++++ .kokoro/release/publish.cfg | 74 ++++++++++++++++++++++ .kokoro/samples-test.sh | 57 +++++++++++++++++ .kokoro/system-test.sh | 49 ++++++++++++++ .kokoro/test.bat | 40 ++++++++++++ .kokoro/test.sh | 46 ++++++++++++++ .kokoro/trampoline.sh | 41 ++++++++++++ .nycrc | 23 +++++++ codecov.yaml | 4 ++ renovate.json | 10 ++- synth.metadata | 12 ++++ 40 files changed, 838 insertions(+), 8 deletions(-) create mode 100644 .jsdoc.js create mode 100644 .kokoro/common.cfg create mode 100644 .kokoro/continuous/node10/common.cfg create mode 100644 .kokoro/continuous/node10/docs.cfg create mode 100644 .kokoro/continuous/node10/lint.cfg create mode 100644 .kokoro/continuous/node10/samples-test.cfg create mode 100644 .kokoro/continuous/node10/system-test.cfg create mode 100644 .kokoro/continuous/node10/test.cfg create mode 100644 .kokoro/continuous/node11/common.cfg create mode 100644 .kokoro/continuous/node11/test.cfg create mode 100644 .kokoro/continuous/node8/common.cfg create mode 100644 .kokoro/continuous/node8/test.cfg create mode 100755 .kokoro/docs.sh create mode 100755 .kokoro/lint.sh create mode 100644 .kokoro/presubmit/node10/common.cfg create mode 100644 .kokoro/presubmit/node10/docs.cfg create mode 100644 .kokoro/presubmit/node10/lint.cfg create mode 100644 .kokoro/presubmit/node10/samples-test.cfg create mode 100644 .kokoro/presubmit/node10/system-test.cfg create mode 100644 .kokoro/presubmit/node10/test.cfg create mode 100644 .kokoro/presubmit/node11/common.cfg create mode 100644 .kokoro/presubmit/node11/test.cfg create mode 100644 .kokoro/presubmit/node8/common.cfg create mode 100644 .kokoro/presubmit/node8/test.cfg create mode 100644 .kokoro/presubmit/windows/common.cfg create mode 100644 .kokoro/presubmit/windows/test.cfg create mode 100755 .kokoro/publish.sh create mode 100644 .kokoro/release/docs.cfg create mode 100755 .kokoro/release/docs.sh create mode 100644 .kokoro/release/publish.cfg create mode 100755 .kokoro/samples-test.sh create mode 100755 .kokoro/system-test.sh create mode 100644 .kokoro/test.bat create mode 100755 .kokoro/test.sh create mode 100755 .kokoro/trampoline.sh create mode 100644 .nycrc create mode 100644 codecov.yaml create mode 100644 synth.metadata diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 44b9b278b..d3f90fdb7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,7 +10,7 @@ Thanks for stopping by to let us know something could be better! Please run down the following list and make sure you've tried the usual "quick fixes": - - Search the issues already opened: https://github.com/googleapis/cloud-debug-nodejs/issues + - Search the issues already opened: https://github.com/googleapis/cloud-trace-nodejs/issues - Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-node - Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js @@ -21,7 +21,7 @@ If you are still having issues, please be sure to include as much information as - OS: - Node.js version: - npm version: - - `@google-cloud/debug-agent` version: + - `@google-cloud/trace-agent` version: #### Steps to reproduce diff --git a/.jsdoc.js b/.jsdoc.js new file mode 100644 index 000000000..0a3594be8 --- /dev/null +++ b/.jsdoc.js @@ -0,0 +1,48 @@ +/*! + * Copyright 2018 Google LLC. All Rights Reserved. + * + * 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-baseline', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'src' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2018 Google, LLC.', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/trace-agent', + theme: 'lumen' + }, + markdown: { + idInHeadings: true + } +}; diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 000000000..d2cd0f0c4 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,24 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg new file mode 100644 index 000000000..3cfaa6648 --- /dev/null +++ b/.kokoro/continuous/node10/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Bring in codecov.io master token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/continuous/node10/docs.cfg b/.kokoro/continuous/node10/docs.cfg new file mode 100644 index 000000000..66d3208f4 --- /dev/null +++ b/.kokoro/continuous/node10/docs.cfg @@ -0,0 +1,4 @@ +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/docs.sh" +} diff --git a/.kokoro/continuous/node10/lint.cfg b/.kokoro/continuous/node10/lint.cfg new file mode 100644 index 000000000..1737af43c --- /dev/null +++ b/.kokoro/continuous/node10/lint.cfg @@ -0,0 +1,4 @@ +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/lint.sh" +} diff --git a/.kokoro/continuous/node10/samples-test.cfg b/.kokoro/continuous/node10/samples-test.cfg new file mode 100644 index 000000000..12ec086eb --- /dev/null +++ b/.kokoro/continuous/node10/samples-test.cfg @@ -0,0 +1,7 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/samples-test.sh" +} diff --git a/.kokoro/continuous/node10/system-test.cfg b/.kokoro/continuous/node10/system-test.cfg new file mode 100644 index 000000000..1bd01ab9b --- /dev/null +++ b/.kokoro/continuous/node10/system-test.cfg @@ -0,0 +1,7 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/system-test.sh" +} diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg new file mode 100644 index 000000000..fefee48ba --- /dev/null +++ b/.kokoro/continuous/node10/test.cfg @@ -0,0 +1,37 @@ +# Bring in codecov.io master token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/continuous/node11/common.cfg b/.kokoro/continuous/node11/common.cfg new file mode 100644 index 000000000..1e646ad80 --- /dev/null +++ b/.kokoro/continuous/node11/common.cfg @@ -0,0 +1,24 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:11-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/continuous/node11/test.cfg b/.kokoro/continuous/node11/test.cfg new file mode 100644 index 000000000..e69de29bb diff --git a/.kokoro/continuous/node8/common.cfg b/.kokoro/continuous/node8/common.cfg new file mode 100644 index 000000000..7d9d31bbe --- /dev/null +++ b/.kokoro/continuous/node8/common.cfg @@ -0,0 +1,24 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/continuous/node8/test.cfg b/.kokoro/continuous/node8/test.cfg new file mode 100644 index 000000000..e69de29bb diff --git a/.kokoro/docs.sh b/.kokoro/docs.sh new file mode 100755 index 000000000..952403fae --- /dev/null +++ b/.kokoro/docs.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +cd $(dirname $0)/.. + +npm install + +npm run docs-test diff --git a/.kokoro/lint.sh b/.kokoro/lint.sh new file mode 100755 index 000000000..b03cb0439 --- /dev/null +++ b/.kokoro/lint.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +cd $(dirname $0)/.. + +npm install + +# Install and link samples +if [ -f samples/package.json ]; then + cd samples/ + npm link ../ + npm install + cd .. +fi + +npm run lint diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg new file mode 100644 index 000000000..3cfaa6648 --- /dev/null +++ b/.kokoro/presubmit/node10/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Bring in codecov.io master token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/presubmit/node10/docs.cfg b/.kokoro/presubmit/node10/docs.cfg new file mode 100644 index 000000000..66d3208f4 --- /dev/null +++ b/.kokoro/presubmit/node10/docs.cfg @@ -0,0 +1,4 @@ +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/docs.sh" +} diff --git a/.kokoro/presubmit/node10/lint.cfg b/.kokoro/presubmit/node10/lint.cfg new file mode 100644 index 000000000..1737af43c --- /dev/null +++ b/.kokoro/presubmit/node10/lint.cfg @@ -0,0 +1,4 @@ +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/lint.sh" +} diff --git a/.kokoro/presubmit/node10/samples-test.cfg b/.kokoro/presubmit/node10/samples-test.cfg new file mode 100644 index 000000000..12ec086eb --- /dev/null +++ b/.kokoro/presubmit/node10/samples-test.cfg @@ -0,0 +1,7 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/samples-test.sh" +} diff --git a/.kokoro/presubmit/node10/system-test.cfg b/.kokoro/presubmit/node10/system-test.cfg new file mode 100644 index 000000000..1bd01ab9b --- /dev/null +++ b/.kokoro/presubmit/node10/system-test.cfg @@ -0,0 +1,7 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/system-test.sh" +} diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg new file mode 100644 index 000000000..e69de29bb diff --git a/.kokoro/presubmit/node11/common.cfg b/.kokoro/presubmit/node11/common.cfg new file mode 100644 index 000000000..1e646ad80 --- /dev/null +++ b/.kokoro/presubmit/node11/common.cfg @@ -0,0 +1,24 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:11-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/presubmit/node11/test.cfg b/.kokoro/presubmit/node11/test.cfg new file mode 100644 index 000000000..e69de29bb diff --git a/.kokoro/presubmit/node8/common.cfg b/.kokoro/presubmit/node8/common.cfg new file mode 100644 index 000000000..7d9d31bbe --- /dev/null +++ b/.kokoro/presubmit/node8/common.cfg @@ -0,0 +1,24 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/test.sh" +} diff --git a/.kokoro/presubmit/node8/test.cfg b/.kokoro/presubmit/node8/test.cfg new file mode 100644 index 000000000..e69de29bb diff --git a/.kokoro/presubmit/windows/common.cfg b/.kokoro/presubmit/windows/common.cfg new file mode 100644 index 000000000..d6e25e0b1 --- /dev/null +++ b/.kokoro/presubmit/windows/common.cfg @@ -0,0 +1,2 @@ +# Format: //devtools/kokoro/config/proto/build.proto + diff --git a/.kokoro/presubmit/windows/test.cfg b/.kokoro/presubmit/windows/test.cfg new file mode 100644 index 000000000..29a329b50 --- /dev/null +++ b/.kokoro/presubmit/windows/test.cfg @@ -0,0 +1,2 @@ +# Use the test file directly +build_file: "cloud-trace-nodejs/.kokoro/test.bat" diff --git a/.kokoro/publish.sh b/.kokoro/publish.sh new file mode 100755 index 000000000..ae0be6e9c --- /dev/null +++ b/.kokoro/publish.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +cd $(dirname $0)/.. + +NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-trace-agent-npm-token) +echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc + +npm install +npm publish --access=public --registry=https://wombat-dressing-room.appspot.com diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg new file mode 100644 index 000000000..a16875169 --- /dev/null +++ b/.kokoro/release/docs.cfg @@ -0,0 +1,26 @@ +# service account used to publish up-to-date docs. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# doc publications use a Python image. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/release/docs.sh" +} diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh new file mode 100755 index 000000000..4d3a08685 --- /dev/null +++ b/.kokoro/release/docs.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Copyright 2019 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +# build jsdocs (Python is installed on the Node 10 docker image). +if [[ -z "$CREDENTIALS" ]]; then + # if CREDENTIALS are explicitly set, assume we're testing locally + # and don't set NPM_CONFIG_PREFIX. + export NPM_CONFIG_PREFIX=/home/node/.npm-global + export PATH="$PATH:/home/node/.npm-global/bin" + cd $(dirname $0)/../.. +fi +npm install +npm run docs + +# create docs.metadata, based on package.json and .repo-metadata.json. +npm i json@9.0.6 -g +python3 -m pip install --user gcp-docuploader +python3 -m docuploader create-metadata \ + --name=$(cat .repo-metadata.json | json name) \ + --version=$(cat package.json | json version) \ + --language=$(cat .repo-metadata.json | json language) \ + --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ + --product-page=$(cat .repo-metadata.json | json product_documentation) \ + --github-repository=$(cat .repo-metadata.json | json repo) \ + --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) +cp docs.metadata ./docs/docs.metadata + +# deploy the docs. +if [[ -z "$CREDENTIALS" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi +if [[ -z "$BUCKET" ]]; then + BUCKET=docs-staging +fi +python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/.kokoro/release/publish.cfg b/.kokoro/release/publish.cfg new file mode 100644 index 000000000..bb50b0d50 --- /dev/null +++ b/.kokoro/release/publish.cfg @@ -0,0 +1,74 @@ +# Get npm token from Keystore +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google_cloud_npm_token" + backend_type: FASTCONFIGPUSH + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Fetch magictoken to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "releasetool-magictoken" + } + } +} + +# Fetch api key to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "magic-github-proxy-api-key" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-trace-agent-npm-token" + } + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "cloud-trace-nodejs/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/cloud-trace-nodejs/.kokoro/publish.sh" +} diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh new file mode 100755 index 000000000..20e3241c9 --- /dev/null +++ b/.kokoro/samples-test.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +# Setup service account credentials. +export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json +export GCLOUD_PROJECT=long-door-651 + +cd $(dirname $0)/.. + +# Run a pre-test hook, if a pre-samples-test.sh is in the project +if [ -f .kokoro/pre-samples-test.sh ]; then + set +x + . .kokoro/pre-samples-test.sh + set -x +fi + +if [ -f samples/package.json ]; then + npm install + + # Install and link samples + cd samples/ + npm link ../ + npm install + cd .. + + npm run samples-test +fi + +# codecov combines coverage across integration and unit tests. Include +# the logic below for any environment you wish to collect coverage for: +COVERAGE_NODE=10 +if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then + NYC_BIN=./node_modules/nyc/bin/nyc.js + if [ -f "$NYC_BIN" ]; then + $NYC_BIN report || true + fi + bash $KOKORO_GFILE_DIR/codecov.sh +else + echo "coverage is only reported for Node $COVERAGE_NODE" +fi diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh new file mode 100755 index 000000000..fc5824e66 --- /dev/null +++ b/.kokoro/system-test.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +# Setup service account credentials. +export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json +export GCLOUD_PROJECT=long-door-651 + +cd $(dirname $0)/.. + +# Run a pre-test hook, if a pre-system-test.sh is in the project +if [ -f .kokoro/pre-system-test.sh ]; then + set +x + . .kokoro/pre-system-test.sh + set -x +fi + +npm install + +npm run system-test + +# codecov combines coverage across integration and unit tests. Include +# the logic below for any environment you wish to collect coverage for: +COVERAGE_NODE=10 +if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then + NYC_BIN=./node_modules/nyc/bin/nyc.js + if [ -f "$NYC_BIN" ]; then + $NYC_BIN report || true + fi + bash $KOKORO_GFILE_DIR/codecov.sh +else + echo "coverage is only reported for Node $COVERAGE_NODE" +fi diff --git a/.kokoro/test.bat b/.kokoro/test.bat new file mode 100644 index 000000000..ee32638e3 --- /dev/null +++ b/.kokoro/test.bat @@ -0,0 +1,40 @@ +@rem Copyright 2018 Google LLC. All rights reserved. +@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 build" + +cd /d %~dp0 +cd .. + +@rem The image we're currently running has a broken version of Node.js enabled +@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional +@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to +@rem install npm for v10.15.3. +call nvm use v8.9.1 || goto :error +call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error +call nvm use v10.15.3 || goto :error +call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error + + +@rem Plugin integration tests on Windows are skipped, because there is no known +@rem procedure to start up database docker containers for the Kokoro Windows CI. +set TRACE_TEST_EXCLUDE_INTEGRATION=1 + +call npm install || goto :error +call npm run test || goto :error + +goto :EOF + +:error +exit /b 1 diff --git a/.kokoro/test.sh b/.kokoro/test.sh new file mode 100755 index 000000000..2115eb3ff --- /dev/null +++ b/.kokoro/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright 2018 Google LLC +# +# 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 +# +# https://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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +cd $(dirname $0)/.. + +npm install +npm test + +# codecov combines coverage across integration and unit tests. Include +# the logic below for any environment you wish to collect coverage for: +COVERAGE_NODE=10 +if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then + NYC_BIN=./node_modules/nyc/bin/nyc.js + if [ -f "$NYC_BIN" ]; then + $NYC_BIN report || true + fi + bash $KOKORO_GFILE_DIR/codecov.sh +else + echo "coverage is only reported for Node $COVERAGE_NODE" +fi + +# if release-please keys set, we kick off a task to update the release-PR. +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ + --repo-url=googleapis/cloud-trace-nodejs \ + --package-name=@google-cloud/trace-agent \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please +fi diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100755 index 000000000..26388ff29 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright 2017 Google Inc. +# +# 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. + +set -eo pipefail + +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +# From bin/docker-trace.sh +# Start up database docker containers for plugin integration tests. +docker run --name trace-test-mongo -p 127.0.0.1:27017:27017 -d mongo +docker run --name trace-test-redis -p 127.0.0.1:6379:6379 -d redis +docker run --name trace-test-mysql -p 127.0.0.1:3306:3306\ + -e MYSQL_ROOT_PASSWORD='Password12!'\ + -e MYSQL_DATABASE=test\ + -d mysql:5 +docker run --name trace-test-postgres -p 127.0.0.1:5432:5432\ + -e POSTGRES_USER=postgres\ + -e POSTGRES_PASSWORD='Password12!'\ + -e POSTGRES_DB=test\ + -d postgres + +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.nycrc b/.nycrc new file mode 100644 index 000000000..83a421a06 --- /dev/null +++ b/.nycrc @@ -0,0 +1,23 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/docs", + "**/samples", + "**/scripts", + "**/src/**/v*/**/*.js", + "**/protos", + "**/test", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 000000000..5724ea947 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/renovate.json b/renovate.json index 1e22b3fe2..61f31b77a 100644 --- a/renovate.json +++ b/renovate.json @@ -5,16 +5,14 @@ ], "pinVersions": false, "rebaseStalePrs": true, - "lockFileMaintenance": { - "enabled": true, - "recreateClosed": true - }, + "schedule": [ + "after 9am and before 3pm" + ], "gitAuthor": null, "packageRules": [ { "extends": "packages:linters", "groupName": "linters" } - ], - "ignoreDeps": ["@types/protobufjs"] + ] } diff --git a/synth.metadata b/synth.metadata new file mode 100644 index 000000000..540d49c16 --- /dev/null +++ b/synth.metadata @@ -0,0 +1,12 @@ +{ + "updateTime": "2019-07-01T18:10:58.529748Z", + "sources": [ + { + "template": { + "name": "node_library", + "origin": "synthtool.gcp", + "version": "2019.5.2" + } + } + ] +} \ No newline at end of file