This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
chore: enable CI and add a synth file #12
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
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: &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: &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: *remove_package_lock | ||
- 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: *remove_package_lock | ||
- run: *npm_install_and_link | ||
- run: | ||
name: Build documentation. | ||
command: npm run docs | ||
sample_tests: | ||
docker: | ||
- image: 'node:8' | ||
user: node | ||
steps: | ||
- checkout | ||
- run: *remove_package_lock | ||
- run: | ||
name: Decrypt credentials. | ||
command: | | ||
openssl aes-256-cbc -d -in .circleci/key.json.enc \ | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
-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: *remove_package_lock | ||
- run: | ||
name: Decrypt credentials. | ||
command: | | ||
openssl aes-256-cbc -d -in .circleci/key.json.enc \ | ||
This comment was marked as spam.
Sorry, something went wrong. |
||
-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 | ||
- run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc' | ||
- run: npm publish --access=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/* | ||
samples/node_modules/* | ||
src/**/doc/* | ||
samples/system-test/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: 'gce-images', | ||
theme: 'lumen' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/* | ||
samples/node_modules/* | ||
src/**/doc/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.