@@ -166,6 +166,80 @@ the ``Tests/`` directory. Tests should follow the following principles:
166
166
A test suite must not contain ``AllTests.php `` scripts, but must rely on the
167
167
existence of a ``phpunit.xml.dist `` file.
168
168
169
+ Continuous Integration
170
+ ----------------------
171
+
172
+ Testing bundle code continuously, including all its commits and pull requests,
173
+ is a good practice called Continuous Integration. There are several services
174
+ providing this feature for free for open source projects. The most popular
175
+ service for Symfony bundles is called `Travis CI `_.
176
+
177
+ Here is the recommended configuration file (``.travis.yml ``) for Symfony bundles,
178
+ which test the two latest :doc: `LTS versions </contributing/community/releases >`
179
+ of Symfony and the latest beta release:
180
+
181
+ .. code-block :: yaml
182
+
183
+ language : php
184
+ sudo : false
185
+ cache :
186
+ directories :
187
+ - $HOME/.composer/cache/files
188
+ - $HOME/symfony-bridge/.phpunit
189
+
190
+ env :
191
+ global :
192
+ - PHPUNIT_FLAGS="-v"
193
+ - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
194
+
195
+ matrix :
196
+ fast_finish : true
197
+ include :
198
+ # Minimum supported dependencies with the latest and oldest PHP version
199
+ - php : 7.2
200
+ env : COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
201
+ - php : 7.0
202
+ env : COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
203
+
204
+ # Test the latest stable release
205
+ - php : 7.0
206
+ - php : 7.1
207
+ - php : 7.2
208
+ env : COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
209
+
210
+ # Test LTS versions. This makes sure we do not use Symfony packages with version greater
211
+ # than 2 or 3 respectively. Read more at https://github.com/symfony/lts
212
+ - php : 7.2
213
+ env : DEPENDENCIES="symfony/lts:^2"
214
+ - php : 7.2
215
+ env : DEPENDENCIES="symfony/lts:^3"
216
+
217
+ # Latest commit to master
218
+ - php : 7.2
219
+ env : STABILITY="dev"
220
+
221
+ allow_failures :
222
+ # Dev-master is allowed to fail.
223
+ - env : STABILITY="dev"
224
+
225
+ before_install :
226
+ - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
227
+ - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
228
+ - if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
229
+
230
+ install :
231
+ # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
232
+ - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
233
+ - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
234
+ - ./vendor/bin/simple-phpunit install
235
+
236
+ script :
237
+ - composer validate --strict --no-check-lock
238
+ - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
239
+
240
+ Consider using `Travis cron `_ too to make sure your project is built even if
241
+ there are no new pull requests or commits.
242
+
169
243
Installation
170
244
------------
171
245
@@ -476,3 +550,5 @@ Learn more
476
550
.. _`Packagist` : https://packagist.org/
477
551
.. _`choose any license` : http://choosealicense.com/
478
552
.. _`valid license identifier` : https://spdx.org/licenses/
553
+ .. _`Travis CI` : https://travis-ci.org/
554
+ .. _`Travis Cron` : https://docs.travis-ci.com/user/cron-jobs/
0 commit comments