Skip to content

Commit

Permalink
Run Infection on PHP 8.1. (#1535)
Browse files Browse the repository at this point in the history
* Run Infection on PHP 8.1

* update symfony deps, add ReturnTypeWillChange attribute

* add check on VariadicPlaceholder

* remove conflict with symfony/console 4.1.5

* try to fix Return type of Mock_SplFileInfo_8d3a072c::getPath() should either be compatible with SplFileInfo::getPath() on 8.1

* whitelist PHP 8.1 constants in scoper.inc.php

* Add MockSplFileInfo mocks to work with Unit tests

* Increase possible direct issues

* fix another bunch of tests

* export SYMFONY_DEPRECATIONS_HELPER env variable as part of CI pipeline

* cast to int explicitly to avoid "Implicit conversion from float to int loses precision"

* fix pipeline

* remove continue-on-error on PHP 8.1

* remove ignore-platform-req from pipeline

* clean up pipeline

* import ReturnTypeWillChange to use section
  • Loading branch information
sidz committed Oct 13, 2021
1 parent ef4ddca commit 55446cf
Show file tree
Hide file tree
Showing 26 changed files with 327 additions and 225 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/autoreview.yaml
Expand Up @@ -38,9 +38,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/ci.yaml
Expand Up @@ -18,16 +18,15 @@ jobs:
matrix:
operating-system: [ubuntu-latest]
php-version: ['7.4']
dependencies: ['']
coverage-driver: [pcov, xdebug]
e2e-runner: ['bin/infection']
include:
- { operating-system: 'windows-latest', php-version: '7.4', dependencies: '', coverage-driver: 'xdebug' }
- { operating-system: 'ubuntu-latest', php-version: '7.4', dependencies: '', coverage-driver: 'pcov' }
- { operating-system: 'ubuntu-latest', php-version: '8.0', dependencies: '--ignore-platform-req=php', coverage-driver: 'pcov', e2e-runner: 'build/infection.phar' }
- { operating-system: 'windows-latest', php-version: '7.4', coverage-driver: 'xdebug' }
- { operating-system: 'ubuntu-latest', php-version: '7.4', coverage-driver: 'pcov' }
- { operating-system: 'ubuntu-latest', php-version: '8.0', coverage-driver: 'pcov', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', coverage-driver: 'pcov' }

continue-on-error: ${{ matrix.php-version == '8.0' }}
name: CI on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }} ${{ matrix.dependencies }} with ${{ matrix.e2e-runner }}
name: CI on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }} with ${{ matrix.e2e-runner }}

steps:
- name: Checkout code
Expand All @@ -49,7 +48,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
Expand All @@ -58,24 +57,34 @@ jobs:
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress ${{ matrix.dependencies }}
composer install --no-interaction --prefer-dist --no-progress
- name: Run tests
shell: bash
run: |
# Required as long as "PHPUnit\Runner\DefaultTestResultCache implements the Serializable interface, which is deprecated.
# Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)" is not fixed
if [[ "${{ matrix.php-version }}" == '8.1' ]]; then
export SYMFONY_DEPRECATIONS_HELPER=max[direct]=1
fi
make test-unit
- name: Run integration tests
shell: bash
run: |
if [[ "${{ matrix.php-version }}" == '8.1' ]]; then
export SYMFONY_DEPRECATIONS_HELPER=max[direct]=1
fi
make test-unit PHPUNIT_GROUP=integration
- name: Cache E2E tests dependencies
if: runner.os == 'Windows'
uses: actions/cache@v2
with:
path: tests/e2e/*/vendor
key: e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('tests/e2e/*/composer.json') }}-${{ matrix.dependencies }}
key: e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('tests/e2e/*/composer.json') }}
restore-keys: |
e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('tests/e2e/*/composer.json') }}-
e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-
Expand All @@ -86,7 +95,7 @@ jobs:
shell: bash
run: |
ls tests/e2e/*/composer.json | xargs dirname |
xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress ${{ matrix.dependencies }}
xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress
- name: Run a subset of E2E tests
if: runner.os == 'Windows'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/mt-annotations.yaml
Expand Up @@ -35,9 +35,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/mt.yaml
Expand Up @@ -22,7 +22,6 @@ jobs:
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-version: ['7.4']
dependencies: ['']
coverage-driver: [pcov]

name: Mutation testing on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}
Expand All @@ -46,16 +45,15 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist --no-progress ${{ matrix.dependencies }}
composer update --no-interaction --prefer-dist --no-progress
- name: Collect coverage report
run: |
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Expand Up @@ -52,7 +52,7 @@
"infection/extension-installer": "^0.1.0",
"infection/include-interceptor": "^0.2.5",
"justinrainbow/json-schema": "^5.2.10",
"nikic/php-parser": "^4.10.3",
"nikic/php-parser": "^4.13",
"ondram/ci-detector": "^3.3.0",
"sanmai/later": "^0.1.1",
"sanmai/pipeline": "^5.1",
Expand All @@ -67,8 +67,7 @@
"webmozart/path-util": "^2.3"
},
"conflict": {
"phpunit/php-code-coverage": ">9 <9.1.4",
"symfony/console": "=4.1.5"
"phpunit/php-code-coverage": ">9 <9.1.4"
},
"require-dev": {
"ext-simplexml": "*",
Expand Down

0 comments on commit 55446cf

Please sign in to comment.