15
15
- 5.4
16
16
- 5.5
17
17
- 5.6
18
+ - 7
18
19
- hhvm
19
20
20
21
branches :
21
22
only :
22
23
- " 7.x-1.x"
23
24
- " 8.x-1.x"
25
+
26
+ cache :
27
+ apt : true
28
+ directories :
29
+ - $HOME/drupal-ti-cache
24
30
25
31
matrix :
26
32
fast_finish : true
27
33
allow_failures :
28
- - php : 5.6
29
34
- php : hhvm
30
- exclude :
35
+ - php : 7
36
+ include :
31
37
# Don't need to test twice on all versions, PHP 5.4 is enough.
32
- - php : 5.3
33
- env : DRUPAL_TI_RUNNERS="phpunit"
34
- - php : 5.5
35
- env : DRUPAL_TI_RUNNERS="phpunit"
36
- - php : 5.6
37
- env : DRUPAL_TI_RUNNERS="phpunit"
38
- - php : hhvm
39
- env : DRUPAL_TI_RUNNERS="phpunit"
38
+ - php : 5.4
39
+ env : DRUPAL_TI_RUNNERS="phpunit" DRUPAL_TI_SAVE_CACHE="0"
40
40
41
41
env :
42
42
global :
66
66
# Debug options
67
67
# - DRUPAL_TI_DEBUG="-x -v"
68
68
69
+ # Cache options
70
+ # Use this variable to use another cache directory, usually not needed to be changed.
71
+ - DRUPAL_TI_CACHE_DIR="$HOME/drupal-ti-cache/"
72
+ # Set to 0 or comment out to disable cache loading.
73
+ - DRUPAL_TI_LOAD_CACHE="1"
74
+ # Set to 0 to disable cache saving, useful with many variants.
75
+ # Note: Setting this to "0" will remove the .casher directory to
76
+ # avoid race conditions between builds.
77
+ - DRUPAL_TI_SAVE_CACHE="1"
78
+ # Setup dirs to cache relative to another environment variable.
79
+ - DRUPAL_TI_CACHE_DIRS_HOME=".composer|.drush|.dist"
80
+ - DRUPAL_TI_CACHE_DIRS_TRAVIS_BUILD_DIR="tests/vendor"
81
+
69
82
matrix :
70
- - DRUPAL_TI_RUNNERS="phpunit"
83
+ # - DRUPAL_TI_RUNNERS="phpunit"
71
84
- DRUPAL_TI_RUNNERS="phpunit simpletest"
72
85
73
86
mysql :
@@ -76,9 +89,22 @@ mysql:
76
89
encoding : utf8
77
90
78
91
before_install :
79
- - cd ./tests
92
+ # Restore home directory from cache.
93
+ - mkdir -p "$DRUPAL_TI_CACHE_DIR"/HOME
94
+ - if [ "$DRUPAL_TI_LOAD_CACHE" = "1" ]; then rsync -a "$DRUPAL_TI_CACHE_DIR"/HOME/ "$HOME/"; fi
95
+
96
+ # Update composer
80
97
- composer self-update
81
- - composer global require "lionsad/drupal_ti:dev-master"
98
+
99
+ # Download drupal_ti - if not cached
100
+ - if [ -f "$HOME/.composer/vendor/bin/drupal-ti" ]; then composer global install; else composer global require "lionsad/drupal_ti:dev-master"; fi
101
+
102
+ # Restore caches from $DRUPAL_TI_CACHE_DIR/TRAVIS_BUILD_DIR to $TRAVIS_BUILD_DIR
103
+ # Note: HOME dir was already synced manually above.
104
+ - drupal-ti --load-cache TRAVIS_BUILD_DIR
105
+
106
+ # Setup tests
107
+ - cd ./tests
82
108
- drupal-ti before_install
83
109
84
110
install :
@@ -90,6 +116,21 @@ before_script:
90
116
script :
91
117
- drupal-ti script
92
118
119
+ # Syncs $DRUPAL_TI_CACHE_DIRS_{*} to $DRUPAL_TI_CACHE_DIR/{*}
120
+ # Has internal optimizations for .composer and .drush.
121
+ - drupal-ti --save-cache TRAVIS_BUILD_DIR HOME
122
+
123
+ # Do some manual caching as well
124
+ - if [ "$DRUPAL_TI_SAVE_CACHE" = "1" ]; then rsync -a composer.{json,lock} "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/; fi
125
+
126
+ # Delete composer generated files that screw up cache detection.
127
+ - rm -f "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/.composer/vendor/composer/*.php
128
+ - rm -f "$DRUPAL_TI_CACHE_DIR"/TRAVIS_BUILD_DIR/tests/.composer/vendor/autoload.php
129
+
130
+ # Tests for differences and touches a file if any are detected (optional).
131
+ - du -sh "$DRUPAL_TI_CACHE_DIR"
132
+ - drupal-ti --sync-cache
133
+
93
134
after_script :
94
135
- drupal-ti after_script
95
136
0 commit comments