Skip to content

Commit

Permalink
Set phpunit/phpunit version when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive committed Nov 5, 2024
1 parent 0447c62 commit 193f0ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ jobs:
- ubuntu-latest
- windows-latest
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- { version: '7.2', phpunit: '8.5.*' }
- { version: '7.3', phpunit: '9.6.*' }
- { version: '7.4', phpunit: '9.6.*' }
- { version: '8.0', phpunit: '9.6.*' }
- { version: '8.1', phpunit: '9.6.*' }
- { version: '8.2', phpunit: '9.6.*' }
- { version: '8.3', phpunit: '9.6.*' }
- { version: '8.4', phpunit: '9.6.*' }
dependencies:
- lowest
- highest
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: ${{ matrix.php.version }}
coverage: xdebug

- name: Setup Problem Matchers for PHPUnit
Expand All @@ -63,13 +63,16 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependencies }}-composer-
key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php.version }}-${{ matrix.dependencies }}-composer-

# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
- name: Remove unused dependencies
run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update

- name: Set phpunit/phpunit version constraint
run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update

- name: Install highest dependencies
run: composer update --no-progress --no-interaction --prefer-dist
if: ${{ matrix.dependencies == 'highest' }}
Expand All @@ -89,4 +92,4 @@ jobs:

- name: Check benchmarks
run: vendor/bin/phpbench run --revs=1 --iterations=1
if: ${{ matrix.dependencies == 'highest' && matrix.php == '8.2' }}
if: ${{ matrix.dependencies == 'highest' && matrix.php.version == '8.2' }}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"monolog/monolog": "^1.6|^2.0|^3.0",
"phpbench/phpbench": "^1.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^9.4",
"phpunit/phpunit": "^8.5|^9.6",
"symfony/phpunit-bridge": "^5.2|^6.0|^7.0",
"vimeo/psalm": "^4.17"
},
Expand Down

0 comments on commit 193f0ff

Please sign in to comment.