Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup-php for php8.0 installs phpunit 10.0 #694

Closed
2 of 5 tasks
mwinkens opened this issue Feb 3, 2023 · 3 comments
Closed
2 of 5 tasks

setup-php for php8.0 installs phpunit 10.0 #694

mwinkens opened this issue Feb 3, 2023 · 3 comments
Assignees
Labels
workflow-edit Issue can be fixed by editing the GitHub Action workflow

Comments

@mwinkens
Copy link

mwinkens commented Feb 3, 2023

Describe the bug

PHPUnit 10.0.0 by Sebastian Bergmann and contributors.

This version of PHPUnit requires PHP >= 8.1.
You are using PHP 8.0.27 (/usr/bin/php8.0).
Error: Process completed with exit code 1.

GitHub Actions job part

      - name: Install PHP ${{ matrix.php-version }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-version }}
          ini-file: myapp/php.ini
          tools: phpunit, phpcs, phpcbf

Version

  • I have checked releases, and the bug exists in the latest patch version of v1 or v2.
  • v2
  • v1

Runners

  • GitHub Hosted
  • Self Hosted

Operating systems

PHP versions

8.0

To Reproduce

Expected behavior

Not installing incompatible versions

Screenshots/Logs

Additional context

Are you willing to submit a PR?

Workaround:

specify the phpunit version as described in the Tools Support:

      - name: Install PHP ${{ matrix.php-version }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-version }}
          ini-file: myapp/php.ini
          tools: phpunit:9.5, phpcs, phpcbf
@mwinkens mwinkens added the bug Something isn't working label Feb 3, 2023
@shivammathur
Copy link
Owner

tools input installs the latest version by default for a tool. Please specify the phpunit version that is correct for the php version while using it.

@shivammathur shivammathur added workflow-edit Issue can be fixed by editing the GitHub Action workflow and removed bug Something isn't working labels Feb 3, 2023
@VincentLanglet
Copy link

Hi @shivammathur, when using a matrix for php-version,

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP ${{ matrix.php-versions }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          tools: phpunit
          coverage: xdebug

it not easy to set specify which phpunit version to use:

  • Phpunit 8 for php 7.2
  • Phpunit 9 for php 7.3, 7.4, 8.0
  • Phpunit 10 for php 8.1

There seems to be some logic for xdebug related to the php version

(/^5\.[3-6]$|^7\.[0-1]$/.test(version) && extension == 'xdebug3') ||
(/^8\.[0-9]$/.test(version) && extension == 'xdebug2')

Can't the same thing be done for phpunit ?

@shivammathur
Copy link
Owner

@VincentLanglet
Yes, If someone contributes a PR for this, I will accept it.

@amnuts amnuts mentioned this issue May 24, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflow-edit Issue can be fixed by editing the GitHub Action workflow
Projects
None yet
Development

No branches or pull requests

3 participants