Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Add circle ci piplines #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Define common configurations
working_directory: &working_directory
working_directory: /tmp/app

# Filter template: only tags, release/* and hotfix/* branches
filter_only_tags_releases_hotfixes: &filter_only_tags_releases_hotfixes
filters:
tags:
only: /.*/
branches:
only:
- /release\/.*$/
- /hotfix\/.*$/

# Filter template: allow all
filter_all: &filter_all
filters:
tags:
only: /.*/
branches:
only: /.*/

# Filter template: only tags
filter_only_tags: &filter_only_tags
filters:
tags:
only: /.*/
branches:
ignore: /.*/


# Define node build configurations
node_config: &node_config
docker:
- image: circleci/node:8.5
<<: *working_directory
parallelism: 1

# Download cached dependencies
restore_npm_cache: &restore_npm_cache
restore_cache:
keys:
- node-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- node-dependencies-

# Save cache dependencies
save_npm_cache: &save_npm_cache
save_cache:
paths:
- node_modules
key: node-dependencies-{{ checksum "package.json" }}

# Download cached workspace
restore_workspace: &restore_workspace
attach_workspace:
# Must be absolute path or relative path from working_directory
at: .

# Save all actual files
save_workspace: &save_workspace
persist_to_workspace:
# Must be relative path from working_directory
root: .
# Must be relative path from root
paths:
- .

version: 2
jobs:
install_dependencies:
<<: *node_config
steps:
- checkout

- *restore_npm_cache

- run:
name: Install Node Dependencies
command: yarn install

- *save_npm_cache
- *save_workspace

unit_tests:
<<: *node_config
steps:
- *restore_workspace

- run:
name: Run Unit Tests and Generate lcov & html reports
command: yarn test-report

- store_artifacts:
path: coverage
destination: coverage

nsp_check:
<<: *node_config
steps:
- *restore_workspace

- run:
name: Security check
command: yarn security-check

check_npm_package_version:
<<: *node_config
steps:
- *restore_workspace

- run:
name: Check NPM Package Version
command: yarn check-version

publish_package:
<<: *node_config
steps:
- *restore_workspace

- run:
name: Build production bundle
command: yarn build

- run:
name: Deploy package to NPM Registry
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
npm publish --access public

workflows:
version: 2
build_and_test:
jobs:
- install_dependencies:
<<: *filter_all

- nsp_check:
<<: *filter_all
requires:
- install_dependencies

- unit_tests:
<<: *filter_all
requires:
- install_dependencies

- check_npm_package_version:
<<: *filter_only_tags_releases_hotfixes
requires:
- install_dependencies

- publish_package:
requires:
- check_npm_package_version
- unit_tests
<<: *filter_only_tags
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/node_modules/
/mix-manifest.json
/dist/
.idea
.idea
\.nyc_output/
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"main": "dist/pupper-react.cjs.js",
"module": "dist/pupper-react.es.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "nyc --reporter=text-summary mocha --colors --recursive",
"test-babel": "mocha --compilers js:babel-core/register --colors ./test/*.test.js",
"test-report": "nyc --reporter=text-summary --reporter=html --reporter=cobertura --reporter=lcov mocha --colors --recursive",
"security-check": "nsp check",
"check-version": "git-npm-version-checker -v",
"build": "rollup -c"
},
"files": [
Expand All @@ -18,7 +22,11 @@
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1"
"babel-preset-react": "^6.24.1",
"git-npm-version-checker": "^1.1.0",
"mocha": "^4.0.1",
"nsp": "^2.8.1",
"nyc": "^11.2.1"
},
"peerDependencies": {
"prop-types": "^15.6.0",
Expand Down
Loading