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

Fix: Run commands through PHP binary to ensure they are run on Windows #4335

Merged
merged 4 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ jobs:
- highest

steps:
- name: Configure git to avoid issues with line endings
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v2

Expand Down Expand Up @@ -141,17 +145,17 @@ jobs:

- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: ./tools/composer update --no-ansi --no-interaction --no-progress --prefer-lowest
run: php ./tools/composer update --no-ansi --no-interaction --no-progress --prefer-lowest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivammathur

Do you have an idea why it would be necessary to specify the php binary here for running these commands on windows-latest?

Without it, they are not run, see #4333.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@localheinz
#!/usr/bin/env php does not work on Windows, so you will have to call local phar tools with php.

When tools are installed using setup-php on Windows, it creates a batch script to call the tools with php.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @shivammathur!


- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: ./tools/composer update --no-ansi --no-interaction --no-progress
run: php ./tools/composer update --no-ansi --no-interaction --no-progress

- name: Run sanity check
run: bash ./build/scripts/sanity-check

- name: Run tests with phpunit
run: ./phpunit --coverage-clover=coverage.xml
run: php ./phpunit --coverage-clover=coverage.xml

- name: Send code coverage report to Codecov.io
uses: codecov/codecov-action@v1
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Framework/AssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ public function testAssertFileIsReadable(): void

public function testAssertFileIsNotReadable(): void
{
if (\PHP_OS_FAMILY === 'Windows') {
self::markTestSkipped('Cannot test this behaviour on Windows');
}

$tempFile = \tempnam(
\sys_get_temp_dir(),
'unreadable'
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Util/XDebugFilterScriptGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class XDebugFilterScriptGeneratorTest extends TestCase
{
public function testReturnsExpectedScript(): void
{
$expectedDirectory = __DIR__ . \DIRECTORY_SEPARATOR;
$expectedDirectory = \sprintf(\addslashes('%s' . \DIRECTORY_SEPARATOR), __DIR__);
$expected = <<<EOF
<?php declare(strict_types=1);
if (!\\function_exists('xdebug_set_filter')) {
Expand Down