Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
chore(build): add a synthfile, move to CircleCI (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Aug 28, 2018
1 parent a136e14 commit 9dec439
Show file tree
Hide file tree
Showing 25 changed files with 538 additions and 49 deletions.
167 changes: 167 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,167 @@
version: 2
workflows:
version: 2
tests:
jobs: &workflow_jobs
- node6:
filters: &all_commits
tags:
only: /.*/
- node8:
filters: *all_commits
- node10:
filters: *all_commits
- lint:
requires:
- node6
- node8
- node10
filters: *all_commits
- docs:
requires:
- node6
- node8
- node10
filters: *all_commits
- system_tests:
requires:
- lint
- docs
filters: &master_and_releases
branches:
only: master
tags: &releases
only: '/^v[\d.]+$/'
- sample_tests:
requires:
- lint
- docs
filters: *master_and_releases
- publish_npm:
requires:
- system_tests
- sample_tests
filters:
branches:
ignore: /.*/
tags: *releases
nightly:
triggers:
- schedule:
cron: 0 7 * * *
filters:
branches:
only: master
jobs: *workflow_jobs
jobs:
node6:
docker:
- image: 'node:6'
user: node
steps: &unit_tests_steps
- checkout
- run: &npm_install_and_link
name: Install and link the module
command: |-
mkdir -p /home/node/.npm-global
npm install
environment:
NPM_CONFIG_PREFIX: /home/node/.npm-global
- run: npm test
- run: node_modules/.bin/codecov

node8:
docker:
- image: 'node:8'
user: node
steps: *unit_tests_steps
node10:
docker:
- image: 'node:10'
user: node
steps: *unit_tests_steps
lint:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- run: *npm_install_and_link
- run: &samples_npm_install_and_link
name: Link the module being tested to the samples.
command: |
cd samples/
npm link ../
npm install
environment:
NPM_CONFIG_PREFIX: /home/node/.npm-global
- run:
name: Run linting.
command: npm run lint
environment:
NPM_CONFIG_PREFIX: /home/node/.npm-global
docs:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- run: *npm_install_and_link
- run: npm run docs
sample_tests:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- run:
name: Decrypt credentials.
command: |
openssl aes-256-cbc -d -in .circleci/key.json.enc \
-out .circleci/key.json \
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
- run: *npm_install_and_link
- run: *samples_npm_install_and_link
- run:
name: Run sample tests.
command: npm run samples-test
environment:
GCLOUD_PROJECT: long-door-651
GOOGLE_APPLICATION_CREDENTIALS: /home/node/samples/.circleci/key.json
NPM_CONFIG_PREFIX: /home/node/.npm-global
- run:
name: Remove unencrypted key.
command: rm .circleci/key.json
when: always
working_directory: /home/node/samples/
system_tests:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- run:
name: Decrypt credentials.
command: |
openssl aes-256-cbc -d -in .circleci/key.json.enc \
-out .circleci/key.json \
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
- run: *npm_install_and_link
- run:
name: Run system tests.
command: npm run system-test
environment:
GOOGLE_APPLICATION_CREDENTIALS: .circleci/key.json
- run:
name: Remove unencrypted key.
command: rm .circleci/key.json
when: always
publish_npm:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- npm install
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: npm publish --access=public
File renamed without changes.
53 changes: 53 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,53 @@
# How to become a contributor and submit your own code

**Table of contents**

* [Contributor License Agreements](#contributor-license-agreements)
* [Contributing a patch](#contributing-a-patch)
* [Running the tests](#running-the-tests)
* [Releasing the library](#releasing-the-library)

## Contributor License Agreements

We'd love to accept your sample apps and patches! Before we can take them, we
have to jump a couple of legal hurdles.

Please fill out either the individual or corporate Contributor License Agreement
(CLA).

* If you are an individual writing original source code and you're sure you
own the intellectual property, then you'll need to sign an [individual CLA]
(https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work,
then you'll need to sign a [corporate CLA]
(https://developers.google.com/open-source/cla/corporate).

Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.

## Contributing A Patch

1. Submit an issue describing your proposed change to the repo in question.
1. The repo owner will respond to your issue promptly.
1. If your proposed change is accepted, and you haven't already done so, sign a
Contributor License Agreement (see details above).
1. Fork the desired repo, develop and test your code changes.
1. Ensure that your code adheres to the existing style in the code to which
you are contributing.
1. Ensure that your code has an appropriate set of tests which all pass.
1. Submit a pull request.

## Running the tests

1. [Prepare your environment for Node.js setup][setup].

1. Install dependencies:

npm install

1. Run the tests:

npm test

[setup]: https://cloud.google.com/nodejs/docs/setup
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,27 @@
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/googlecloudplatform/cloud-debug-nodejs/issues
- Search the issues on our "catch-all" repository: https://github.com/GoogleCloudPlatform/google-cloud-node
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js

If you are still having issues, please be sure to include as much information as
possible:

#### Environment details

- OS:
- Node.js version:
- npm version:
- `@google-cloud/debug-agent` version:

#### Steps to reproduce

1. ???
2. ???

Following these steps will guarantee the quickest resolution possible.

Thanks!
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,5 @@
Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for discussion)

- [ ] Tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ npm-debug.log
yarn.lock
google-cloud-debug-agent-*.tgz
package-lock.json
.nyc_output
24 changes: 24 additions & 0 deletions .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-debug-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"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/cloud-debug-nodejs/.kokoro/test.sh"
}
23 changes: 23 additions & 0 deletions .kokoro/docs.sh
@@ -0,0 +1,23 @@
#!/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 -xeo pipefail

cd $(dirname $0)/..

npm install

npm run docs
29 changes: 29 additions & 0 deletions .kokoro/lint.sh
@@ -0,0 +1,29 @@
#!/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 -xeo pipefail

cd $(dirname $0)/..

npm install

# Install and link samples
cd samples/
npm link ../
npm install
cd ..

npm run lint
33 changes: 33 additions & 0 deletions .kokoro/samples-test.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 -xeo pipefail

# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export GCLOUD_PROJECT=long-door-651

cd $(dirname $0)/..

npm install

# Install and link samples
cd samples/
npm link ../
npm install
cd ..

npm run samples-test

0 comments on commit 9dec439

Please sign in to comment.