Skip to content

Commit

Permalink
CI - show phpunit version from custom binary WIP
Browse files Browse the repository at this point in the history
https://github.com/EdgedesignCZ/phpqa/runs/1844108206?check_suite_focus=true#step:6:40
`phpqa tools` shows phpunit 9.5.2 (loaded from composer.lock)
No version is displayed in html artifact for php7.4. But it works for php8.0.
- php8 - https://github.com/EdgedesignCZ/phpqa/runs/1844183851?check_suite_focus=true#step:6:27
- php7.4 - https://github.com/EdgedesignCZ/phpqa/runs/1844183845?check_suite_focus=true#step:6:27
   sh: 1: exec: "/home/runner/work/phpqa/phpqa/vendor/phpunit/phpunit/phpunit" --version: not found

Maybe related to 148151c
- PHP8 warning: Passing a command as string when creating a "Symfony\Component\Process\Process" instance is deprecated since Symfony 4.2, pass it as an array of its arguments instead, or use the "Process::fromShellCommandline()" constructor if you need features provided by the shell.
- https://github.com/symfony/process/blob/5.x/CHANGELOG.md#500
  • Loading branch information
zdenekdrahos committed Feb 6, 2021
1 parent 79b955d commit b8486a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [5.5]
include:
# PHP5
- { php: 5.4, areSuggestedToolsInstalled: yes }
- { php: 5.6, isComposerUpdated: yes, areSuggestedToolsInstalled: yes }
# PHP7
- { php: 7.0 }
- { php: 7.1, isComposerUpdated: yes, areSuggestedToolsInstalled: yes }
- { php: 7.2, areSuggestedToolsInstalled: yes }
- { php: 7.3 }
php: [7.3]
include:
- { php: 7.4, isComposerUpdated: yes, areSuggestedToolsInstalled: yes }
# PHP8
- { php: 8.0, isComposerUpdated: yes, areSuggestedToolsInstalled: yes }
Expand Down Expand Up @@ -64,13 +56,11 @@ jobs:
- name: Show versions
run: |
composer outdated --direct --all
./phpqa tools
./phpqa tools --config tests/.ci
- name: Run tests
run: |
vendor/phpunit/phpunit/phpunit
bin/ci.sh
ls -lAh build
/home/runner/work/phpqa/phpqa/vendor/phpunit/phpunit/phpunit --version
- name: Upload QA files
uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install:

test_script:
- cd C:\projects\phpqa
- php phpqa tools
- php phpqa tools --config tests/.appveyor
- php phpqa --verbose --report --config tests/.appveyor
- dir build

Expand Down
9 changes: 7 additions & 2 deletions src/Tools/GetVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@ private function loadVersionFromConsoleCommand($command)
$process = $this->createSymfonyProcess($command);
$process->run();
$firstLine = $this->getFirstLine($process->getOutput());
var_dump([
'command' => $command,
'output' => $process->getOutput(),
'error' => $process->getErrorOutput(),
]);
return $this->extractVersion($firstLine);
}

private function createSymfonyProcess($command)
{
if (!method_exists('Symfony\Component\Process\Process', 'setCommandLine')) {
return new Process([$command]);
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
return Process::fromShellCommandline($command);
} else {
return new Process($command);
}
Expand Down

0 comments on commit b8486a6

Please # to comment.