Skip to content

Commit

Permalink
Use synth templating and update CI (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Sep 5, 2018
1 parent 660f1b1 commit 206e1a2
Show file tree
Hide file tree
Showing 41 changed files with 573 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Expand Up @@ -4,9 +4,9 @@ environment:

install:
- ps: Install-Product node $env:nodejs_version
- ps: (new-object net.webclient).DownloadFile('https://github.com/mbuilov/gnumake-windows/raw/master/gnumake-4.2.1-x64.exe', 'C:\projects\google-api-nodejs-client\make.exe')
- npm install -g npm # Force using the latest npm to get dedupe during install
- set PATH=%APPDATA%\npm;%PATH%
- npm install
- npm install --force --ignore-scripts

test_script:
- node --version
Expand Down
11 changes: 7 additions & 4 deletions .circleci/config.yml
Expand Up @@ -149,21 +149,24 @@ jobs:
name: Decrypt credentials.
command: |
if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
openssl aes-256-cbc -d -in .circleci/key.json.enc \
-out .circleci/key.json \
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
for encrypted_key in .circleci/*.json.enc; do
openssl aes-256-cbc -d -in $encrypted_key \
-out $(echo $encrypted_key | sed 's/\.enc//') \
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
done
fi
- run: *npm_install_and_link
- run:
name: Run system tests.
command: npm run system-test
environment:
GCLOUD_PROJECT: long-door-651
GOOGLE_APPLICATION_CREDENTIALS: .circleci/key.json
- run:
name: Remove unencrypted key.
command: |
if ! [[ -z "${SYSTEM_TESTS_ENCRYPTION_KEY}" ]]; then
rm .circleci/key.json
rm .circleci/*.json
fi
when: always
publish_npm:
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
node_modules/*
samples/node_modules/*
src/**/doc/*
13 changes: 13 additions & 0 deletions .eslintrc.yml
@@ -0,0 +1,13 @@
---
extends:
- 'eslint:recommended'
- 'plugin:node/recommended'
- prettier
plugins:
- node
- prettier
rules:
prettier/prettier: error
block-scoped-var: error
eqeqeq: error
no-warning-comments: warn
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Expand Up @@ -7,10 +7,10 @@ Install all dependencies including development requirements by running:
$ npm install
```

Builds or tests require the installation of [`make`](https://www.gnu.org/software/make/), which is likely already installed if you develop on Linux or OSX. To perform the first build, go ahead and run it!
This library uses TypeScript. To compile the code, run:

``` sh
$ make
$ npm run compile
```

Next, go ahead and run the tests:
Expand All @@ -22,7 +22,7 @@ $ npm test
This looks for tests in the `test/` directory. In addition to running the tests, this also checks code formatting. Code formatting (and other issues) can be fixed automatically by running:

```sh
$ make fix
$ npm run fix
```

The repo owner reviews your request. They can approve and merge your change. If your change needs additional work, they follow up with comments.
Expand All @@ -31,7 +31,7 @@ The repo owner reviews your request. They can approve and merge your change. If
If you're a developer interested in contributing to this library, the following section will be useful for you. Each of the files in `src/apis/` is generated from the discovery docs available online. You can generate these files by running the following command:

``` sh
$ make generate
$ npm run generate
```

You can pass in custom Discovery URLs or paths to discovery docs:
Expand All @@ -44,7 +44,7 @@ $ node build/src/scripts/generate http://discoveryurl.example.com /path/to/disco
You can generate the documentation for the APIs by running:

``` sh
make docs
npm run docs
```

Documentation will be generated in `docs/`.
Expand Down
26 changes: 22 additions & 4 deletions .github/ISSUE_TEMPLATE.md
@@ -1,9 +1,27 @@
**** DELETE THIS BLOCK ****
Thanks for stopping by to let us know something could be better!

Thanks for filing an issue! Please keep keep issues limited to bug reports, feature requests, and other general issues. For support questions, please feel free to reach out on stack overflow: http://stackoverflow.com/questions/tagged/google-api-nodejs-client
Please run down the following list and make sure you've tried the usual "quick
fixes":

**** /DELETE THIS BLOCK ****
- Search the issues already opened: https://github.com/google/google-api-nodejs-client/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

<your detailed question and code samples go here>
If you are still having issues, please be sure to include as much information as
possible:

#### Environment details

- OS:
- Node.js version:
- npm version:
- `googleapis` version:

#### Steps to reproduce

1. ???
2. ???

Following these steps will guarantee the quickest resolution possible.

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

- [ ] `npm test` succeeds
- [ ] Pull request has been squashed into 1 commit
- [ ] I did NOT manually make changes to anything in `apis/`
- [ ] Tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate JSDoc comments were updated in source code (if applicable)
- [ ] Appropriate changes to readme/docs are included in PR
- [ ] Appropriate docs were updated (if necessary)
45 changes: 45 additions & 0 deletions .jsdoc.js
@@ -0,0 +1,45 @@
/*!
* 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/ink-docstrap/template',
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: 'googleapis',
theme: 'lumen'
}
};
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: "google-api-nodejs-client/.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/google-api-nodejs-client/.kokoro/test.sh"
}
24 changes: 24 additions & 0 deletions .kokoro/continuous/node10/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: "google-api-nodejs-client/.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/google-api-nodejs-client/.kokoro/test.sh"
}
Empty file.
24 changes: 24 additions & 0 deletions .kokoro/continuous/node6/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: "google-api-nodejs-client/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:6-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-api-nodejs-client/.kokoro/test.sh"
}
Empty file.
24 changes: 24 additions & 0 deletions .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: "google-api-nodejs-client/.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/google-api-nodejs-client/.kokoro/test.sh"
}
4 changes: 4 additions & 0 deletions .kokoro/continuous/node8/docs.cfg
@@ -0,0 +1,4 @@
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-api-nodejs-client/.kokoro/docs.sh"
}
4 changes: 4 additions & 0 deletions .kokoro/continuous/node8/lint.cfg
@@ -0,0 +1,4 @@
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-api-nodejs-client/.kokoro/lint.sh"
}
7 changes: 7 additions & 0 deletions .kokoro/continuous/node8/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/google-api-nodejs-client/.kokoro/samples-test.sh"
}
7 changes: 7 additions & 0 deletions .kokoro/continuous/node8/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/google-api-nodejs-client/.kokoro/system-test.sh"
}
Empty file.
25 changes: 25 additions & 0 deletions .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 -xeo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

cd $(dirname $0)/..

npm install

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

export NPM_CONFIG_PREFIX=/home/node/.npm-global

cd $(dirname $0)/..

npm install

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

npm run lint
24 changes: 24 additions & 0 deletions .kokoro/presubmit/node10/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: "google-api-nodejs-client/.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/google-api-nodejs-client/.kokoro/test.sh"
}
Empty file.

0 comments on commit 206e1a2

Please sign in to comment.