Skip to content

Commit

Permalink
fix(build): Add CI (#2)
Browse files Browse the repository at this point in the history
Automate deployment on master branch.
  • Loading branch information
adam-26 committed Feb 24, 2018
2 parents 57e3d33 + cf7df9f commit 5d9a5bf
Show file tree
Hide file tree
Showing 19 changed files with 12,065 additions and 934 deletions.
95 changes: 95 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,95 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
environment:
CC_TEST_REPORTER_ID: e124bacf0493b1f396545259279fd0a85656ad5441e862cd9630c4652a42af5b
docker:
- image: node:8.4
working_directory: ~/react-chunk
steps:
- checkout
- run:
name: "~/.npmrc"
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run:
name: "Checking Versions"
command: |
node --version
npm --version
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: "npm install"
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
command: |
mkdir -p ./.build
mkdir -p ./.build/lint
mkdir -p ./.build/coverage
mkdir -p ./.build/test
mkdir -p ./coverage
when: always
- run:
name: lint
command: npm run ci-lint
- run:
name: "install code climate"
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: test
command: |
# Prepare the test reporter
./cc-test-reporter before-build
# Run the tests
npm run ci-jest
COVERAGE_EXIT_CODE=$?
# Copy the coverage file for reporting purposes
cp ./.build/coverage/lcov.info ./coverage
# Prevent errors when re-building on the CI server (reports previously uploaded)
set +e
./cc-test-reporter after-build -t lcov --exit-code $COVERAGE_EXIT_CODE
REPORTER_EXIT_CODE=$?
set -e
if [ "$REPORTER_EXIT_CODE" != "0" ] && [ "$REPORTER_EXIT_CODE" != "255" ]; then
exit $$REPORTER_EXIT_CODE
fi
- store_test_results:
path: ./.build/test/test-report.xml
- store_artifacts:
path: ./.build/test
prefix: "test"
- store_artifacts:
path: ./.build/lint
prefix: "lint"
- store_artifacts:
path: ./.build/coverage
prefix: "coverage"
- deploy:
name: Maybe Deploy
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
git config -l
git config user.email ci@circleci
git config user.name CircleCI
# Build for release
npm run build
# Tag the release, update package.json version and changelog, commit and push to github.
./node_modules/.bin/standard-version --no-verify -m "chore(release): %s. [skip ci]"
git push --follow-tags origin master
npm publish
fi
30 changes: 30 additions & 0 deletions .codeclimate.yml
@@ -0,0 +1,30 @@

engines:

fixme:
enabled: true

nodesecurity:
enabled: true

eslint:
enabled: true
channel: "eslint-3"

duplication:
enabled: true
config:
languages:
- javascript:

ratings:
paths:
- "src/*.js"

exclude_paths:
- "lib/**/*"
- "__tests__/**/*"
- "__fixtures__/**/*"
- "src/__tests__/*"
- "src/__tests__/**/*"
- "examples/**/*"
24 changes: 24 additions & 0 deletions .editorconfig
@@ -0,0 +1,24 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.js]
charset = utf-8

# Indentation override for all JS under src directory
[{src/**.js,example/*.js,example/components/*.js}]
indent_style = space
indent_size = 2

# Matches the exact files either package.json
[package.json]
indent_style = space
indent_size = 2
27 changes: 27 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,27 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"rules": {
"strict": 0,
"indent": ["error", 2]
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jest/recommended"
],
"plugins": ["jest"]
}
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
.idea
.build
node_modules
*.log
lib
Expand Down
19 changes: 19 additions & 0 deletions .npmignore
@@ -0,0 +1,19 @@
node_modules/
.babelrc
.eslintrc
.eslintrc.json
scripts
.idea
.circleci
docs/
src/
.build/
coverage/
examples/
jest_*/
.codeclimate.yml
npm-shrinkwrap.json
yarn.lock
cc-test-reporter
__tests__
__fixtures__
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

0 comments on commit 5d9a5bf

Please sign in to comment.