提交 e3af6c86 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

Update travis ci to use stage & deploy on branch (#956)

上级 6b778685
sudo: false
language: node_js
node_js:
- "8"
......@@ -19,22 +17,46 @@ cache:
directories:
- node_modules
before_install:
install:
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew update; brew cleanup; brew cask cleanup; fi
# - if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew uninstall --force brew-cask; brew update; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew cleanup; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew cask cleanup; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew install jq; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew install moreutils; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew install shellcheck; fi
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then brew install jq; fi
- npm install
script:
- echo $TRAVIS_OS_NAME
- node --version
- npm --version
- npm run test
- npm run test:npm && echo 'Npm packing test is passed'
- npm test
after_success:
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then npm run coverage; fi
stages:
- test
- pack
- name: deploy
if: branch = /^(master|v\d+\.\d+)/
jobs:
include:
- stage: pack
script:
- npm run test:pack && echo 'Npm packing test is passed'
- stage: deploy
script:
- echo "Deploying to NPM ..."
- npm version
- npm run dist
deploy:
provider: npm
email: zixia@zixia.net
api_key: "$NPM_TOKEN"
notifications:
webhooks:
......@@ -46,16 +68,3 @@ notifications:
email:
on_success: change
on_failure: change
after_success:
- if [ "$TRAVIS_OS_NAME" == 'osx' ]; then npm run coverage; fi
before_deploy:
- npm version
- npm run dist
deploy:
provider: npm
email: zixia@zixia.net
api_key: "$NPM_TOKEN"
skip_cleanup: true
......@@ -29,7 +29,7 @@
"sloc": "sloc bin example src test index.ts --details --format cli-table --keys total,source,comment && sloc bin example src test index.ts",
"test": "npm run clean && npm run lint && npm run test:unit && npm run test:shell && npm run sloc",
"test:linux": "npm run pretest && parallel ts-node -- ./src/**/*.spec.ts ./test/**/*.spec.ts && npm run posttest",
"test:npm": "npm run dist && export TMPDIR=/tmp/wechaty.$$ && npm pack && mkdir $TMPDIR && mv wechaty-*.*.*.tgz $TMPDIR && cp test/fixture/smoke-testing.js $TMPDIR && cd $TMPDIR && npm init -y && npm i wechaty-*.*.*.tgz && node smoke-testing.js",
"test:pack": "npm run dist && export TMPDIR=/tmp/wechaty.$$ && npm pack && mkdir $TMPDIR && mv wechaty-*.*.*.tgz $TMPDIR && cp test/fixture/smoke-testing.js $TMPDIR && cd $TMPDIR && npm init -y && npm i wechaty-*.*.*.tgz && node smoke-testing.js",
"test:shell": "shellcheck bin/*.sh",
"test:unit": "blue-tape -r ts-node/register -r source-map-support/register \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"",
"test:win32": "npm run test:unit",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册