From 59f5f72215d3397f5854753f224e48a5a0344be0 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 17 May 2019 09:40:52 -0700 Subject: [PATCH] build: add new kokoro config for coverage and release-please (#713) * build: add new kokoro config for release-please and coverage * build: actually commit the config * fix: do not fail test if nyc did not run --- .kokoro/continuous/node10/common.cfg | 10 +++++++++ .kokoro/continuous/node10/test.cfg | 9 -------- .kokoro/presubmit/node10/common.cfg | 10 +++++++++ .kokoro/presubmit/node10/test.cfg | 9 -------- .kokoro/release-candidate-issue.sh | 25 +++++++++++++++++++++ .kokoro/release-requested.sh | 25 +++++++++++++++++++++ .kokoro/release/common.cfg | 8 +++++++ .kokoro/release/publish.cfg | 9 -------- .kokoro/release/release-candidate-issue.cfg | 22 ++++++++++++++++++ .kokoro/release/release-requested.cfg | 22 ++++++++++++++++++ .kokoro/samples-test.sh | 13 +++++++++++ .kokoro/system-test.sh | 13 +++++++++++ .kokoro/test.sh | 4 +++- synth.metadata | 4 ++-- 14 files changed, 153 insertions(+), 30 deletions(-) create mode 100755 .kokoro/release-candidate-issue.sh create mode 100755 .kokoro/release-requested.sh create mode 100644 .kokoro/release/common.cfg create mode 100644 .kokoro/release/release-candidate-issue.cfg create mode 100644 .kokoro/release/release-requested.cfg diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg index 9eca1bec5..8ce0e4f12 100644 --- a/.kokoro/continuous/node10/common.cfg +++ b/.kokoro/continuous/node10/common.cfg @@ -7,6 +7,16 @@ action { } } +# 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" diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg index 468b8c719..e69de29bb 100644 --- a/.kokoro/continuous/node10/test.cfg +++ b/.kokoro/continuous/node10/test.cfg @@ -1,9 +0,0 @@ -# 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" - } - } -} diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg index 9eca1bec5..8ce0e4f12 100644 --- a/.kokoro/presubmit/node10/common.cfg +++ b/.kokoro/presubmit/node10/common.cfg @@ -7,6 +7,16 @@ action { } } +# 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" diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg index 468b8c719..e69de29bb 100644 --- a/.kokoro/presubmit/node10/test.cfg +++ b/.kokoro/presubmit/node10/test.cfg @@ -1,9 +0,0 @@ -# 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" - } - } -} diff --git a/.kokoro/release-candidate-issue.sh b/.kokoro/release-candidate-issue.sh new file mode 100755 index 000000000..fd8f093ed --- /dev/null +++ b/.kokoro/release-candidate-issue.sh @@ -0,0 +1,25 @@ +#!/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 + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +GITHUB_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_yoshi-automation-github-key) + +npx release-please candidate-issue --token=$GITHUB_TOKEN \ + --repo-url=googleapis/nodejs-storage \ + --package-name=@google-cloud/storage diff --git a/.kokoro/release-requested.sh b/.kokoro/release-requested.sh new file mode 100755 index 000000000..669e0c463 --- /dev/null +++ b/.kokoro/release-requested.sh @@ -0,0 +1,25 @@ +#!/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 + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +GITHUB_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_yoshi-automation-github-key) + +npx release-please detect-checked --token=$GITHUB_TOKEN \ + --repo-url=googleapis/nodejs-storage \ + --package-name=@google-cloud/storage diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 000000000..3ba2eb095 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,8 @@ +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + } + } +} diff --git a/.kokoro/release/publish.cfg b/.kokoro/release/publish.cfg index a28b328d4..6579a86c9 100644 --- a/.kokoro/release/publish.cfg +++ b/.kokoro/release/publish.cfg @@ -9,15 +9,6 @@ before_action { } } -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - before_action { fetch_keystore { keystore_resource { diff --git a/.kokoro/release/release-candidate-issue.cfg b/.kokoro/release/release-candidate-issue.cfg new file mode 100644 index 000000000..eac025804 --- /dev/null +++ b/.kokoro/release/release-candidate-issue.cfg @@ -0,0 +1,22 @@ +# 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: "nodejs-storage/.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/nodejs-storage/.kokoro/release-candidate-issue.sh" +} diff --git a/.kokoro/release/release-requested.cfg b/.kokoro/release/release-requested.cfg new file mode 100644 index 000000000..a566c92ef --- /dev/null +++ b/.kokoro/release/release-requested.cfg @@ -0,0 +1,22 @@ +# 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: "nodejs-storage/.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/nodejs-storage/.kokoro/release-requested.sh" +} diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index f83f712a8..07d31dccc 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -42,3 +42,16 @@ if [ -f samples/package.json ]; then 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 index fd8f0b638..b7374d0ad 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -34,3 +34,16 @@ 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.sh b/.kokoro/test.sh index f7e9fe781..bfc7b2615 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -23,11 +23,13 @@ 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 + $NYC_BIN report || true fi bash $KOKORO_GFILE_DIR/codecov.sh else diff --git a/synth.metadata b/synth.metadata index ddc7ba676..8cc81cb59 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,11 +1,11 @@ { - "updateTime": "2019-05-04T11:22:40.672305Z", + "updateTime": "2019-05-17T01:12:33.148151Z", "sources": [ { "template": { "name": "node_library", "origin": "synthtool.gcp", - "version": "2019.5.2" + "version": "2019.4.10" } } ]