Skip to content

Commit

Permalink
Merge repository setup
Browse files Browse the repository at this point in the history
repository setup, dependency updates, prettier
  • Loading branch information
crwilcox authored May 9, 2018
2 parents 80748f0 + d83c83b commit a6bfaf6
Show file tree
Hide file tree
Showing 23 changed files with 13,075 additions and 1,757 deletions.
20 changes: 20 additions & 0 deletions packages/google-cloud-redis/.appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
environment:
matrix:
- nodejs_version: 8

install:
- ps: Install-Product node $env:nodejs_version
- npm install -g npm # Force using the latest npm to get dedupe during install
- set PATH=%APPDATA%\npm;%PATH%
- npm install --force --ignore-scripts

test_script:
- node --version
- npm --version
- npm rebuild
- npm test

build: off

matrix:
fast_finish: true
158 changes: 158 additions & 0 deletions packages/google-cloud-redis/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
version: 2
workflows:
version: 2
tests:
jobs: &workflow_jobs
- node6:
filters:
tags:
only: /.*/
- node8:
filters:
tags:
only: /.*/
- node9:
filters:
tags:
only: /.*/
- node10:
filters:
tags:
only: /.*/
- lint:
requires:
- node6
- node8
- node9
- node10
filters:
tags:
only: /.*/
- docs:
requires:
- node6
- node8
- node9
- node10
filters:
tags:
only: /.*/
- publish_npm:
requires:
- lint
- docs
filters:
branches:
ignore: /.*/
tags:
only: '/^v[\d.]+$/'
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: &remove_package_lock
name: Remove package-lock.json if needed.
command: |
WORKFLOW_NAME=`python .circleci/get_workflow_name.py`
echo "Workflow name: $WORKFLOW_NAME"
if [ "$WORKFLOW_NAME" = "nightly" ]; then
echo "Nightly build detected, removing package-lock.json"
rm -f package-lock.json samples/package-lock.json
else
echo "Not a nightly build, skipping this step."
fi
- run:
name: Install modules and dependencies.
command: |-
npm install
repo_tools="node_modules/@google-cloud/nodejs-repo-tools/bin/tools"
if ! test -x "$repo_tools"; then
chmod +x "$repo_tools"
fi
- run:
name: Run unit tests.
command: npm test
- run:
name: Submit coverage data to codecov.
command: node_modules/.bin/codecov
when: always
node8:
docker:
- image: 'node:8'
user: node
steps: *unit_tests_steps
node9:
docker:
- image: 'node:9'
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: *remove_package_lock
- run:
name: Install modules and dependencies.
command: |
mkdir -p /home/node/.npm-global
npm install
repo_tools="node_modules/@google-cloud/nodejs-repo-tools/bin/tools"
if ! test -x "$repo_tools"; then
chmod +x "$repo_tools"
fi
npm link
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: *remove_package_lock
- run:
name: Install modules and dependencies.
command: |-
npm install
repo_tools="node_modules/@google-cloud/nodejs-repo-tools/bin/tools"
if ! test -x "$repo_tools"; then
chmod +x "$repo_tools"
fi
- run:
name: Build documentation.
command: npm run docs
publish_npm:
docker:
- image: 'node:8'
user: node
steps:
- checkout
- run:
name: Set NPM authentication.
command: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- run:
name: Publish the module to npm.
command: npm publish --access=public
67 changes: 67 additions & 0 deletions packages/google-cloud-redis/.circleci/get_workflow_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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
#
# 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.

"""
Get workflow name for the current build using CircleCI API.
Would be great if this information is available in one of
CircleCI environment variables, but it's not there.
https://circleci.ideas.aha.io/ideas/CCI-I-295
"""

import json
import os
import sys
import urllib2


def main():
try:
username = os.environ['CIRCLE_PROJECT_USERNAME']
reponame = os.environ['CIRCLE_PROJECT_REPONAME']
build_num = os.environ['CIRCLE_BUILD_NUM']
except:
sys.stderr.write(
'Looks like we are not inside CircleCI container. Exiting...\n')
return 1

try:
request = urllib2.Request(
"https://circleci.com/api/v1.1/project/github/%s/%s/%s" %
(username, reponame, build_num),
headers={"Accept": "application/json"})
contents = urllib2.urlopen(request).read()
except:
sys.stderr.write('Cannot query CircleCI API. Exiting...\n')
return 1

try:
build_info = json.loads(contents)
except:
sys.stderr.write(
'Cannot parse JSON received from CircleCI API. Exiting...\n')
return 1

try:
workflow_name = build_info['workflows']['workflow_name']
except:
sys.stderr.write(
'Cannot get workflow name from CircleCI build info. Exiting...\n')
return 1

print workflow_name
return 0


retval = main()
exit(retval)
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/google-cloud-redis/.cloud-repo-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"_product": "redis",
"id": "redis",
"name": "Cloud Redis",
"short_name": "Cloud Redis",
"docs_url": "TBD",
"description": "Client for Google Cloud Redis",
"requiresKeyFile": true,
"requiresProjectId": true,
"client_reference_url": "https://cloud.google.com/nodejs/docs/reference/redis/latest/",
"release_quality": "alpha"
}
3 changes: 3 additions & 0 deletions packages/google-cloud-redis/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/*
samples/node_modules/*
src/**/doc/*
13 changes: 13 additions & 0 deletions packages/google-cloud-redis/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions packages/google-cloud-redis/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
45 changes: 45 additions & 0 deletions packages/google-cloud-redis/.jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*!
* Copyright 2017 Google Inc. 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 2017 Google, Inc.',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/redis',
theme: 'lumen'
}
};
26 changes: 26 additions & 0 deletions packages/google-cloud-redis/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"report-dir": "./.coverage",
"exclude": [
"src/*{/*,/**/*}.js",
"src/*/v*/*.js",
"test/**/*.js"
],
"watermarks": {
"branches": [
95,
100
],
"functions": [
95,
100
],
"lines": [
95,
100
],
"statements": [
95,
100
]
}
}
3 changes: 3 additions & 0 deletions packages/google-cloud-redis/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/*
samples/node_modules/*
src/**/doc/*
8 changes: 8 additions & 0 deletions packages/google-cloud-redis/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
bracketSpacing: false
printWidth: 80
semi: true
singleQuote: true
tabWidth: 2
trailingComma: es5
useTabs: false
6 changes: 6 additions & 0 deletions packages/google-cloud-redis/CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The names of individuals who have contributed to this project.
#
# Names are formatted as:
# name <email>
#
Chris Wilcox <[email protected]>
Loading

0 comments on commit a6bfaf6

Please sign in to comment.