forked from zwave-js/zwave-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5ed34df
Showing
15 changed files
with
915 additions
and
0 deletions.
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,233 @@ | ||
# Javascript Node CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details | ||
# | ||
|
||
# Define the used images | ||
node4: &node4 | ||
working_directory: &workdir_node4 ~/node-zwave-js/node4 | ||
docker: | ||
- image: circleci/node:4 | ||
|
||
node6: &node6 | ||
working_directory: &workdir_node6 ~/node-zwave-js/node6 | ||
docker: | ||
- image: circleci/node:6 | ||
|
||
# use "latest" for lint and publish | ||
latest: &latest | ||
working_directory: &workdir_latest ~/node-zwave-js/latest | ||
docker: | ||
- image: circleci/node:8 | ||
|
||
# some job filters | ||
tags_and_branches: &tags_and_branches | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
|
||
only_tags: &only_tags | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
# Which files to preserve between jobs | ||
whitelist: &whitelist | ||
paths: | ||
- build/* | ||
- node_modules/* | ||
- src/* | ||
- test/* | ||
- coverage/* | ||
- .npmignore | ||
- package.json | ||
- README.md | ||
- tsconfig.json | ||
- tslint.json | ||
|
||
version: 2 | ||
jobs: | ||
# ---------------------------------------------------- | ||
test_node4: | ||
<<: *node4 | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-node4-{{ checksum "package.json" }} | ||
|
||
- run: | ||
name: Install Dependencies | ||
command: npm install | ||
- run: | ||
name: Remove unnecessary Dependencies | ||
command: npm ls || true ; npm prune | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-node4-{{ checksum "package.json" }} | ||
|
||
- run: | ||
name: Run component tests | ||
command: npm run test | ||
|
||
# ---------------------------------------------------- | ||
test_node6: | ||
<<: *node6 | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-node6-{{ checksum "package.json" }} | ||
|
||
- run: | ||
name: Install Dependencies | ||
command: npm install | ||
- run: | ||
name: Remove unnecessary Dependencies | ||
command: npm ls || true ; npm prune | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-node6-{{ checksum "package.json" }} | ||
|
||
- run: | ||
name: Run component tests | ||
command: npm run test | ||
|
||
# ---------------------------------------------------- | ||
test_latest: | ||
<<: *latest | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-latest-{{ checksum "package.json" }} | ||
|
||
- run: | ||
name: Install Dependencies | ||
command: npm install | ||
- run: | ||
name: Remove unnecessary Dependencies | ||
command: npm ls || true ; npm prune | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-latest-{{ checksum "package.json" }} | ||
|
||
# on latest also lint the code | ||
- run: | ||
name: Lint TypeScript code | ||
command: npm run lint | ||
|
||
- run: | ||
name: Run component tests | ||
command: npm run test | ||
|
||
# persist the build files, so we can pick them up in the deploy job | ||
- persist_to_workspace: | ||
root: *workdir_latest | ||
<<: *whitelist | ||
|
||
# ---------------------------------------------------- | ||
# generates a clean build of the TypeScript sources | ||
# to make sure there were no leftover build files | ||
coverage: | ||
<<: *latest | ||
|
||
steps: | ||
- attach_workspace: | ||
at: *workdir_latest | ||
|
||
- run: | ||
name: Generate coverage report | ||
command: npm run coverage | ||
|
||
- run: | ||
name: Upload it to coveralls.io | ||
command: COVERALLS_SERVICE_NAME="CircleCI" COVERALLS_SERVICE_JOB_ID="$CIRCLE_BUILD_NUM" npm run coveralls | ||
|
||
# ---------------------------------------------------- | ||
# generates a clean build of the TypeScript sources | ||
# to make sure there were no leftover build files | ||
build: | ||
<<: *latest | ||
|
||
steps: | ||
- attach_workspace: | ||
at: *workdir_latest | ||
|
||
- run: | ||
name: Clean previous builds | ||
command: npm run prebuild | ||
|
||
- run: | ||
name: Build the source files | ||
command: npm run build | ||
|
||
- persist_to_workspace: | ||
root: *workdir_latest | ||
<<: *whitelist | ||
|
||
# ---------------------------------------------------- | ||
# Deploys the final package to NPM | ||
deploy: | ||
<<: *latest | ||
|
||
steps: | ||
- attach_workspace: | ||
at: *workdir_latest | ||
|
||
- run: | ||
name: Login to npm | ||
command: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN | ||
- run: | ||
name: Publish package to npm | ||
command: npm publish | ||
|
||
# ---------------------------------------------------- | ||
# Fit it all together | ||
workflows: | ||
version: 2 | ||
|
||
test-and-deploy: | ||
jobs: | ||
- test_node4: | ||
<<: *tags_and_branches | ||
- test_node6: | ||
<<: *tags_and_branches | ||
- test_latest: | ||
<<: *tags_and_branches | ||
|
||
- coverage: | ||
requires: | ||
- test_latest | ||
<<: *tags_and_branches | ||
|
||
# build only on tagged builds and if all tests succeeded | ||
- build: | ||
requires: | ||
- test_node4 | ||
- test_node6 | ||
- test_latest | ||
<<: *only_tags | ||
|
||
# deploy only on tagged builds and if all tests succeeded | ||
- deploy: | ||
requires: | ||
- build | ||
<<: *only_tags |
Oops, something went wrong.