phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

PHPUnit fails with invalid environment values

Open BradleyGoulding opened this issue 8 months ago • 0 comments

Description I encountered an issue while using php-actions/phpunit@v3 in my GitHub Actions workflow. The workflow is set up as follows:

  - name: Run tests
    uses: php-actions/phpunit@v3
    with:
      php_version: "8.1"
      bootstrap: vendor/autoload.php
      configuration: phpunit.xml
      version: "9.5.27"

This is running on a blacksmith.sh arm runner

However, the installation fails with the following error message:

Run php-actions/phpunit@v3
Run set -e
Building PHP 8.1 with extensions:  ...
docker: invalid env file (/dev/fd/63): variable 'Available CPUs: 6' contains whitespaces

Run 'docker run --help' for more information
Error: Process completed with exit code 125.

Expected behavior: The process should pass

Additional context: I have forked this repo and debugged the --env-file <( env| cut -f1 -d= ) step and found the following

BLACKSMITH_STORE_STATS=System Statistics:
-----------------
Available CPUs: 10
Jobs by Process ID:
-----------------
PID 2055811: 13 jobs
Total: 13 jobs across 1 process
Devices by Process ID:
-----------------
PID 2055811: 13 devices
Total: 13 devices across 1 process

This is causing the docker process to fail

I have reached out to Blacksmith support to advise them of this, however I think that this action should also be sanitizing or otherwise checking the env values it reads This action runs correctly on the github standard runners, I have also tested it on blacksmiths x86 runners with the same error being observed.

I have opened a PR with a patch for this process. There is a linked issue https://github.com/php-actions/composer/issues/128 that also has this problem

BradleyGoulding avatar May 15 '25 21:05 BradleyGoulding