@@ -171,73 +171,59 @@ Continuous Integration
171
171
172
172
Testing bundle code continuously, including all its commits and pull requests,
173
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
-
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="max[self]=0"
201
- - php : 7.1
202
- env : COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
203
-
204
- # Test the latest stable release
205
- - php : 7.1
206
- - php : 7.2
207
- env : COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
208
-
209
- # Test LTS versions. This makes sure we do not use Symfony packages with version greater
210
- # than 2 or 3 respectively. Read more at https://github.com/symfony/lts
211
- - php : 7.2
212
- env : DEPENDENCIES="symfony/lts:^2"
213
- - php : 7.2
214
- env : DEPENDENCIES="symfony/lts:^3"
215
-
216
- # Latest commit to master
217
- - php : 7.2
218
- env : STABILITY="dev"
219
-
220
- allow_failures :
221
- # Dev-master is allowed to fail.
222
- - env : STABILITY="dev"
223
-
224
- before_install :
225
- - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
226
- - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
227
- - if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
228
-
229
- install :
230
- - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
231
- - ./vendor/bin/simple-phpunit install
232
-
233
- script :
234
- - composer validate --strict --no-check-lock
235
- # simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and
236
- # it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge)
237
- - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
238
-
239
- Consider using the `Travis cron `_ tool to make sure your project is built even if
240
- there are no new pull requests or commits.
174
+ providing this feature for free for open source projects, like `GitHub Actions `_
175
+ and `Travis CI `_.
176
+
177
+ A bundle should at least test:
178
+
179
+ * The lower bound of their dependencies (by running ``composer update --prefer-lowest ``);
180
+ * The supported PHP versions;
181
+ * All supported major Symfony versions (e.g. both ``4.x `` and ``5.x `` if
182
+ support is claimed for both).
183
+
184
+ Thus, a bundle supporting PHP 7.3, 7.4 and 8.0, and Symfony 3.4 and 4.x should
185
+ have at least this test matrix:
186
+
187
+ =========== =============== ===================
188
+ PHP version Symfony version Composer flags
189
+ =========== =============== ===================
190
+ 7.3 ``3.* `` ``--prefer-lowest ``
191
+ 7.4 ``4.* ``
192
+ 8.0 ``4.* ``
193
+ =========== =============== ===================
194
+
195
+ .. tip ::
196
+
197
+ The tests should be run with the ``SYMFONY_DEPRECATIONS_HELPER ``
198
+ env variable set to ``max[direct]=0 ``. This ensures no code in the
199
+ bundle uses deprecated features directly.
200
+
201
+ The lowest dependency tests can be run with this variable set to
202
+ ``disabled=1 ``.
203
+
204
+ Require a Specific Symfony Version
205
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
+
207
+ You can use the special ``SYMFONY_REQUIRE `` environment variable together
208
+ with Symfony Flex to install a specific Symfony version:
209
+
210
+ .. code-block :: bash
211
+
212
+ # this requires Symfony 5.x for all Symfony packages
213
+ export SYMFONY_REQUIRE=5.*
214
+
215
+ # install Symfony Flex in the CI environment
216
+ composer global require --no-progress --no-scripts --no-plugins symfony/flex
217
+
218
+ # install the dependencies (using --prefer-dist and --no-progress is
219
+ # recommended to have a better output and faster download time)
220
+ composer update --prefer-dist --no-progress
221
+
222
+ .. caution ::
223
+
224
+ If you want to cache your Composer dependencies, **do not ** cache the
225
+ ``vendor/ `` directory as this has side-effects. Instead cache
226
+ ``$HOME/.composer/cache/files ``.
241
227
242
228
Installation
243
229
------------
@@ -529,5 +515,5 @@ Learn more
529
515
.. _`Packagist` : https://packagist.org/
530
516
.. _`choose any license` : https://choosealicense.com/
531
517
.. _`valid license identifier` : https://spdx.org/licenses/
532
- .. _`Travis CI ` : https://travis-ci.org/
533
- .. _`Travis cron ` : https://docs.travis-ci.com/user/cron-jobs /
518
+ .. _`GitHub Actions ` : https://docs.github.com/en/free-pro-team@latest/actions
519
+ .. _`Travis CI ` : https://docs.travis-ci.com/
0 commit comments