Open astronati opened 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:
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
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:
Any suggestion? 🙏
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).
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?
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.
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.