.travis.yml 1.5 KB
Newer Older
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
1 2
language: node_js
node_js:
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
3
  - "9"
4
  - "10"
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
5

6 7
os:
  - linux
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
8
  - osx
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
9

Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
10 11 12
addons:
  apt:
    packages:
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
13
      - jq
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
14
      - shellcheck
15
      - moreutils
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
16

17 18 19
cache:
  directories:
    - node_modules
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
20

21 22 23 24
stages:
  - test
  - pack
  - name: deploy
Huan (李卓桓)'s avatar
test ci  
Huan (李卓桓) 已提交
25
    if: branch =~ ^(master|v\d+\.\d+)$ AND (type NOT IN (cron, pull_request))
26

27 28 29
before_install:
  - if [ "$TRAVIS_OS_NAME" == 'osx' ]; then ./scripts/prepare-osx.sh; fi

Huan (李卓桓)'s avatar
test ci  
Huan (李卓桓) 已提交
30 31 32 33 34 35
script:
  - echo $TRAVIS_OS_NAME
  - node --version
  - npm --version
  - echo "Testing started ..."
  - npm test || travis_terminate 1
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
36
  # - if [ "$TRAVIS_OS_NAME" == 'linux' ]; then npm run coverage; fi
Huan (李卓桓)'s avatar
test ci  
Huan (李卓桓) 已提交
37

38 39
jobs:
  include:
40

41 42
    - stage: pack
      script:
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
43
        - npm run test:pack && echo 'Npm pack testing is passed' || travis_terminate 1
44 45 46 47 48

    - stage: deploy
      script:
        - echo "Deploying to NPM ..."
        - npm version
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
49
        - if ./scripts/development-release.ts; then ./scripts/package-publish-config-tag-next.ts; fi
50 51 52 53 54 55
        - npm run dist

      deploy:
        provider: npm
        email: zixia@zixia.net
        api_key: "$NPM_TOKEN"
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
56
        skip_cleanup: true
57 58
        on:
          all_branches: true
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
59

60 61
notifications:
  webhooks:
62
    urls:
63
      - https://webhooks.gitter.im/e/41a19fbf1d54a04e5217
64
    on_success: always  # options: [always|never|change] default: always
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
65
    on_failure: always  # options: [always|never|change] default: always
66
    on_start: never     # options: [always|never|change] default: always
67 68 69
  email:
    on_success: change
    on_failure: change