1717 fail-fast : false
1818 matrix :
1919 php-versions : [ '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
20+ dependencies : [ 'highest' ]
21+ include :
22+ # The lowest allowed dependency set needs to be verified only once, and the
23+ # oldest supported PHP is where consumers are most likely to end up with it.
24+ - php-versions : ' 8.0'
25+ dependencies : ' lowest'
26+
27+ name : " PHP ${{ matrix.php-versions }} (${{ matrix.dependencies }} deps)"
2028
2129 steps :
2230 - uses : actions/checkout@v7
@@ -40,20 +48,35 @@ jobs:
4048 path : |
4149 vendor
4250 tools/psalm/vendor
43- key : ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
51+ # composer.lock is not committed, so it cannot take part in the cache key:
52+ # the installed set depends on the PHP version and on the resolution
53+ # strategy, and both must be part of the key to keep the caches separate
54+ key : ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ matrix.dependencies }}-${{ hashFiles('composer.json') }}
4455 restore-keys : |
45- ${{ runner.os }}-php-
56+ ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ matrix.dependencies }}-
4657
4758 - name : Install dependencies
59+ if : ${{ matrix.dependencies == 'highest' }}
4860 run : composer install --prefer-dist
4961
62+ # Without a committed composer.lock every other job resolves to the newest
63+ # allowed release, so the lower bounds declared in composer.json are never
64+ # exercised. This job installs the other end of those ranges: the set a
65+ # consumer with older pinned dependencies actually gets.
66+ - name : Install lowest allowed dependencies
67+ if : ${{ matrix.dependencies == 'lowest' }}
68+ run : composer update --prefer-dist --prefer-lowest --prefer-stable
69+
5070 # Psalm 6 needs PHP >= 8.1 to run; the analysis target stays 8.0 (phpVersion in psalm.xml)
5171 - name : Static Analysis
5272 if : ${{ matrix.php-versions == '8.1' }}
5373 run : |
5474 composer install --prefer-dist -d tools/psalm
5575 tools/psalm/vendor/bin/psalm --no-cache
5676
77+ # Both dependency sets report coverage: code that supports one version of a
78+ # dependency is dead code under the other one, so a single set can never cover
79+ # all of src. Codecov merges the two reports, and codecov.yml waits for both.
5780 - name : Test with coverage
5881 if : ${{ matrix.php-versions == '8.0' }}
5982 run : ./bin/phpunit -d memory_limit=-1 --coverage-clover clover.xml
6790 uses : codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
6891 with :
6992 token : ${{ secrets.CODECOV_TOKEN }}
93+ flags : ${{ matrix.dependencies }}
7094
7195 phar :
7296 runs-on : " ubuntu-22.04"
0 commit comments