不要怂,就是干,撸起袖子干!

.travis.yml 2.4 KB
sudo: required
dist: trusty

language: node_js

branches:
  only:
    - master
    - v3
    - /^greenkeeper/.*$/
  except:
    - /^v\d+\.\d+\.\d+$/

cache:
  directories:
    - node_modules

env:
  global:
    # mysql info
    - SEQ_MYSQL_DB=sequelize_test
    - SEQ_MYSQL_USER=sequelize_test
    - SEQ_MYSQL_PW=sequelize_test
    - SEQ_MYSQL_HOST=127.0.0.1
    - SEQ_MYSQL_PORT=8999
    # postgres info
    - SEQ_PG_DB=sequelize_test
    - SEQ_PG_USER=sequelize_test
    - SEQ_PG_PW=sequelize_test
    - SEQ_PG_HOST=127.0.0.1
    - SEQ_PG_PORT=8998

before_script:
  # mount ramdisk
  - "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then sudo mkdir /mnt/sequelize-ramdisk; fi"
  - "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then sudo mount -t ramfs tmpfs /mnt/sequelize-ramdisk; fi"
  # setup docker
  - "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then docker-compose up -d ${POSTGRES_VER} ${MYSQL_VER}; fi"
  - "if [ $MYSQL_VER ]; then docker run --link ${MYSQL_VER}:db -e CHECK_PORT=3306 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"
  - "if [ $POSTGRES_VER ]; then docker run --link ${POSTGRES_VER}:db -e CHECK_PORT=5432 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"

script:
  - npm run lint
  - "if [ $COVERAGE ]; then npm run cover && bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info; else npm run test; fi"

jobs:
  include:
    - stage: tests
      node_js: 4
      env: DIALECT=sqlite COVERAGE=true
    - stage: tests
      node_js: 4
      env: MYSQL_VER=mysql-57 DIALECT=mysql COVERAGE=true
    - stage: tests
      node_js: 4
      env: POSTGRES_VER=postgres-95 DIALECT=postgres COVERAGE=true
    - stage: tests
      node_js: 4
      env: POSTGRES_VER=postgres-95 DIALECT=postgres-native COVERAGE=true
    - stage: tests
      node_js: 8
      env: DIALECT=sqlite
    - stage: tests
      node_js: 6
      env: DIALECT=sqlite
    - stage: docs
      node_js: 6
      script:
        - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then npm run docs; fi'
      deploy:
        provider: surge
        project: ./esdoc/
        domain: docs.sequelizejs.com
        skip_cleanup: true
        on:
          branch: master
    - stage: release
      node_js: 4
      env:
        - TRAVIS_JOB_NUMBER=WORKAROUND.1
      script:
        - npm run lint
        - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then npm run semantic-release; fi || true'