.travis.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # @file
  2. # .travis.yml - Drupal for Travis CI Integration
  3. #
  4. # Template provided by https://github.com/LionsAd/drupal_ti.
  5. #
  6. # Based for simpletest upon:
  7. # https://github.com/sonnym/travis-ci-drupal-module-example
  8. language: php
  9. sudo: false
  10. php:
  11. - 5.3
  12. - 5.4
  13. - 5.5
  14. - 5.6
  15. - 7
  16. - hhvm
  17. branches:
  18. only:
  19. - "7.x-1.x"
  20. - "8.x-1.x"
  21. cache:
  22. apt: true
  23. directories:
  24. - $HOME/drupal-ti-cache
  25. matrix:
  26. fast_finish: true
  27. allow_failures:
  28. - php: hhvm
  29. - php: 7
  30. include:
  31. # Don't need to test twice on all versions, PHP 5.4 is enough.
  32. - php: 5.4
  33. env: DRUPAL_TI_RUNNERS="phpunit" DRUPAL_TI_SAVE_CACHE="0"
  34. env:
  35. global:
  36. # add composer's global bin directory to the path
  37. # see: https://github.com/drush-ops/drush#install---composer
  38. - PATH="$PATH:$HOME/.composer/vendor/bin"
  39. # Drupal specific vars.
  40. - DRUPAL_TI_MODULE_NAME="service_container"
  41. - DRUPAL_TI_DB="drupal_travis_db"
  42. - DRUPAL_TI_DB_URL="mysql://root:@127.0.0.1/drupal_travis_db"
  43. # Note: Do not add a trailing slash here.
  44. - DRUPAL_TI_WEBSERVER_URL="http://127.0.0.1"
  45. - DRUPAL_TI_WEBSERVER_PORT="8080"
  46. # Simpletest specific commandline arguments.
  47. - DRUPAL_TI_SIMPLETEST_ARGS="--verbose --color --concurrency 4 --url $DRUPAL_TI_WEBSERVER_URL:$DRUPAL_TI_WEBSERVER_PORT $DRUPAL_TI_MODULE_NAME"
  48. # PHPUnit specific commandline arguments.
  49. - DRUPAL_TI_PHPUNIT_ARGS=""
  50. # Code coverage via coveralls.io
  51. - DRUPAL_TI_COVERAGE="satooshi/php-coveralls:0.6.*"
  52. # This needs to match your .coveralls.yml file.
  53. - DRUPAL_TI_COVERAGE_FILE="build/logs/clover.xml"
  54. # Debug options
  55. #- DRUPAL_TI_DEBUG="-x -v"
  56. # Cache options
  57. # Use this variable to use another cache directory, usually not needed to be changed.
  58. - DRUPAL_TI_CACHE_DIR="$HOME/drupal-ti-cache/"
  59. # Set to 0 or comment out to disable cache loading.
  60. - DRUPAL_TI_LOAD_CACHE="1"
  61. # Set to 0 to disable cache saving, useful with many variants.
  62. # Note: Setting this to "0" will remove the .casher directory to
  63. # avoid race conditions between builds.
  64. - DRUPAL_TI_SAVE_CACHE="1"
  65. # Setup dirs to cache relative to another environment variable.
  66. - DRUPAL_TI_CACHE_DIRS_HOME=".composer|.drush|.dist"
  67. - DRUPAL_TI_CACHE_DIRS_TRAVIS_BUILD_DIR="tests/vendor"
  68. matrix:
  69. #- DRUPAL_TI_RUNNERS="phpunit"
  70. - DRUPAL_TI_RUNNERS="phpunit simpletest"
  71. mysql:
  72. database: drupal_travis_db
  73. username: root
  74. encoding: utf8
  75. before_install:
  76. # Restore home directory from cache.
  77. - mkdir -p "$DRUPAL_TI_CACHE_DIR"/HOME
  78. - if [ "$DRUPAL_TI_LOAD_CACHE" = "1" ]; then rsync -a "$DRUPAL_TI_CACHE_DIR"/HOME/ "$HOME/"; fi
  79. # Update composer
  80. - composer self-update
  81. # Download drupal_ti - if not cached
  82. - if [ -f "$HOME/.composer/vendor/bin/drupal-ti" ]; then composer global install; else composer global require "lionsad/drupal_ti:dev-master"; fi
  83. # Restore caches from $DRUPAL_TI_CACHE_DIR/TRAVIS_BUILD_DIR to $TRAVIS_BUILD_DIR
  84. # Note: HOME dir was already synced manually above.
  85. - drupal-ti --load-cache TRAVIS_BUILD_DIR
  86. # Setup tests
  87. - cd ./tests
  88. - drupal-ti before_install
  89. install:
  90. - drupal-ti install
  91. before_script:
  92. - drupal-ti before_script
  93. script:
  94. - drupal-ti script
  95. # Syncs $DRUPAL_TI_CACHE_DIRS_{*} to $DRUPAL_TI_CACHE_DIR/{*}
  96. # Has internal optimizations for .composer and .drush.
  97. - drupal-ti --save-cache TRAVIS_BUILD_DIR HOME
  98. # Do some manual caching as well
  99. - if [ "$DRUPAL_TI_SAVE_CACHE" = "1" ]; then rsync -a composer.{json,lock} "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/; fi
  100. # Delete composer generated files that screw up cache detection.
  101. - rm -f "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/.composer/vendor/composer/*.php
  102. - rm -f "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/.composer/vendor/autoload.php
  103. # Tests for differences and touches a file if any are detected (optional).
  104. - du -sh "$DRUPAL_TI_CACHE_DIR"
  105. - drupal-ti --sync-cache
  106. after_script:
  107. - drupal-ti after_script
  108. after_success:
  109. - bash <(curl -s https://codecov.io/bash) # -f "$DRUPAL_TI_COVERAGE_FILE"
  110. notifications:
  111. email: false
  112. webhooks:
  113. urls:
  114. - https://webhooks.gitter.im/e/0c7b5a71d435245837a1
  115. on_success: always
  116. on_failure: always
  117. on_start: false