Skip to content

Commit 30c101d

Browse files
committed
Lock all dependencies
We must have `composer.lock` as part of our repository. Otherwise, the tools used for development change and break things unexpectedly. Currently, this is the case with PHPUnit 10 that introduces quite a few breaking changes. We cannot `composer install` and hope that we will get a set of compatible dependencies. Instead, we must lock our tools and upgrade them only when we want/need to upgrade them specifically, in a dedicated commit, and not part of a totally unrelated work, because it just so happenned that PHPUnit released something. `composer.lock` is based on the oldest PHP version that is officially supported by PHP core. Currently, that is 8.0. This typically gives us compatibility out of the box for 8.0, 8.1 and 8.2 with a single lock file. EOL PHP versions, that we unfortunately keep supporting in PHPWord, are "the special cases", and as such they will generate a new lock files in CI, because we cannot have a single lock files that spread over such as long time (almost 4 years for PHP 7.1) with major breaking change in the language in between.
1 parent 0806448 commit 30c101d

File tree

4 files changed

+4938
-6
lines changed

4 files changed

+4938
-6
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
php-version:
11-
- "7.1"
11+
- "7.1.3"
1212
- "7.2"
1313
- "7.3"
1414
- "7.4"
@@ -39,6 +39,10 @@ jobs:
3939
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
4040
restore-keys: ${{ runner.os }}-composer-
4141

42+
- name: Remove lock for old EOL PHP versions
43+
if: matrix.php-version == '7.1.3' || matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4'
44+
run: rm composer.lock && composer config platform.php ${{ matrix.php-version }}
45+
4246
- name: Install dependencies
4347
run: composer install --no-progress --prefer-dist --optimize-autoloader
4448

@@ -63,7 +67,7 @@ jobs:
6367
- name: Setup PHP, with composer and extensions
6468
uses: shivammathur/setup-php@v2
6569
with:
66-
php-version: 7.4
70+
php-version: 8.0
6771
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
6872
coverage: none
6973
tools: cs2pr
@@ -90,11 +94,13 @@ jobs:
9094
steps:
9195
- name: Checkout
9296
uses: actions/checkout@v3
97+
with:
98+
fetch-depth: 0
9399

94100
- name: Setup PHP, with composer and extensions
95101
uses: shivammathur/setup-php@v2
96102
with:
97-
php-version: 7.4
103+
php-version: 8.0
98104
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
99105
coverage: pcov
100106

@@ -115,5 +121,5 @@ jobs:
115121
- name: Coverage
116122
run: |
117123
./vendor/bin/phpunit --coverage-clover coverage-clover.xml
118-
curl -LO https://scrutinizer-ci.com/ocular.phar
119-
php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml
124+
composer global require scrutinizer/ocular
125+
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage-clover.xml

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Desktop.ini
88
_build
99
/build
1010
phpunit.xml
11-
composer.lock
1211
composer.phar
1312
vendor
1413
/report

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
"check": "Runs PHP CheckStyle and PHP Mess detector",
5858
"fix": "Fixes issues found by PHP-CS"
5959
},
60+
"config": {
61+
"platform": {
62+
"php": "8.0"
63+
}
64+
},
6065
"require": {
6166
"php": "^7.1|^8.0",
6267
"ext-dom": "*",

0 commit comments

Comments
 (0)