php-actions / phpunit

Run PHPUnit tests in Github Actions.
110 stars 25 forks source link

PHP version 8.3 is not supported yet #58

Open astronati opened 8 months ago

g105b commented 8 months ago

Hi, I'll look into this because it should automatically support all PHP versions that have been officially released on docker hub.

Leave it with me and I'll make sure 8.3 is up and running.

g105b commented 8 months ago

Hi, please see the example PHPUnit repository. I've added a workflow specifically targetting PHP 8.3:

https://github.com/php-actions/example-phpunit/actions/runs/7971809939/job/21762271183 here's the test passing

Here's the workflow file:

https://github.com/php-actions/example-phpunit/blob/c3497b9146c506b7b695a07af467f80cb116ba6e/.github/workflows/ci-latest.yml#L20

name: CI-latest

on: [push]

jobs:
  build-test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - uses: php-actions/composer@v6

      - name: PHPUnit Tests
        uses: php-actions/phpunit@master
        env:
          TEST_NAME: Scarlett
        with:
          version: 9.6
          php_version: 8.3
          bootstrap: vendor/autoload.php
          configuration: test/phpunit.xml
          args: --coverage-text
astronati commented 8 months ago

Hi @g105b, following your example I've added this:

    name: PHPUnit Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: php-actions/composer@v6
        with:
          php_version: 8.3
          memory_limit: -1
          php_extensions: intl zip gd
      - uses: php-actions/phpunit@master
        with:
          version: 9.6
          php_version: 8.3
          bootstrap: vendor/autoload.php
          args: --coverage-text

      - name: Run PHPUnit Tests
        run: php bin/phpunit --stop-on-failure

but I obtain following error:

Screenshot 2024-02-20 at 20 38 06

Any suggestion? 🙏

g105b commented 8 months ago

Hi @astronati , yes I think you're running into a common misconception, and highlighting that I've got to do a better job at documenting this.

It looks like you're running PHPUnit within the Actions container in this step:

- uses: php-actions/phpunit@master

but then you're trying to run PHPUnit again using the build runner's native PHP version with run: php bin/phpunit --stop-on-failure

I believe the second step is unnecessary, and if you look in your Actions log at the previous step, you'll see a running PHPUnit.

As an explanation:

For efficiency, concurrency, and truly isolating workflows, the php-actions Github Actions have been built to work using Composite Docker containers. This allows you to run them locally too if desired, as once they're containerised, the whole environment is portable.

This comes with the side effect of not actually affecting the build runner's environment at all. So any version of PHP that is on the build runner is purely coincidental, and nothing to do with your previous steps (Ubuntu ships with PHP version 8.1.2-1ubuntu.2.14, for example).

astronati commented 7 months ago

Hi @g105b it seems I have reached a step ahead, but then I'm having an issue. Why does step exit with a non zero code?

Screenshot 2024-03-29 at 18 45 43

g105b commented 3 months ago

Are you still having an issue with non-zero exit codes? I'm trying to tidy up some issues and I can't replicate this myself, so I'm assuming it was a specific case with your project's files? Happy to help if it's still an issue for you.