diff --git a/.circleci/config.yml b/.circleci/config.yml index acfd8cc83..5594a0402 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,16 +71,14 @@ jobs: steps: - *attach_workspace - *restore_from_workspace - - run: yarn run eslint - - run: yarn run flow - - run: yarn run stylelint + - run: ./tasks/lint.sh # For unit testing of all packages. test: <<: *docker_default steps: - *attach_workspace - *restore_from_workspace - - run: node_modules/.bin/lerna run test + - run: ./tasks/test.sh # For building demo page. test-page: <<: *docker_default diff --git a/.nvmrc b/.nvmrc index ac2895c59..2b0aa2121 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -8.1.4 +8.2.1 diff --git a/.travis.yml b/.travis.yml index e4e6912cb..90459ad3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,33 @@ sudo: false language: node_js -node_js: - - "8.2.1" -env: - global: - - YARN_VERSION=0.27.5 - -notifications: - email: evenchange4@gmail.com +services: + - docker before_install: - - export PATH="$HOME/.yarn/bin:$PATH" - - | - if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION - fi - -script: - - yarn run danger - - ./tasks/test.sh - - ./tasks/test-page.sh + - docker pull node:8.2.1 -after_success: - - ./node_modules/.bin/codecov +install: + - echo "[Skip] Use job stage to warm up cache" cache: yarn: true directories: - - ~/.yarn + - $HOME/.yarn - node_modules - - packages/mcs-lite-introduction/node_modules + +jobs: + include: + # Prepare npm and Warm up cache + - stage: Install Dependencies and Cache + script: yarn install --pure-lockfile + # Use cache + - stage: Test + script: yarn run danger + - script: yarn run postinstall && ./tasks/lint.sh + - script: yarn run postinstall && ./tasks/test-page.sh + - script: yarn run postinstall && ./tasks/test.sh + after_success: + - ./node_modules/.bin/codecov + +notifications: + email: evenchange4@gmail.com diff --git a/README.md b/README.md index 81beaef47..9ea7366c7 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,10 @@ $ ./tasks/build.sh ## Testing ``` +$ yarn run format +$ ./tasks/lint.sh $ ./tasks/test.sh +$ ./tasks/test-page.sh ``` ## mcs-lite-ui diff --git a/tasks/lint.sh b/tasks/lint.sh new file mode 100755 index 000000000..5524468ad --- /dev/null +++ b/tasks/lint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +echo -e '\n\n================================================='; +echo -e '| 1. 💪 💪 💪 Start global linting'; +echo -e '=================================================\n\n'; +yarn run eslint +yarn run stylelint +yarn run flow diff --git a/tasks/test.sh b/tasks/test.sh index d5e42e20e..e59ca869b 100755 --- a/tasks/test.sh +++ b/tasks/test.sh @@ -2,14 +2,6 @@ set -e -echo -e '\n\n================================================='; -echo -e '| 1. 💪 💪 💪 Start global linting'; -echo -e '=================================================\n\n'; -yarn run eslint -yarn run stylelint -yarn run flow - - echo -e '\n\n================================================='; echo -e '| 2. 🚐 🚐 🚐 Run test interface for each packages'; echo -e '=================================================\n\n';