Skip to content

Commit

Permalink
Merge pull request #6 from pestphp/3-windows-support
Browse files Browse the repository at this point in the history
3 windows support
  • Loading branch information
nunomaduro authored Nov 8, 2023
2 parents 1e4ed17 + b2d17ba commit 4c45536
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest] # windows-latest is not supported
os: [ubuntu-latest, macos-latest, windows-latest]
php: ['8.2', '8.3']
dependency-version: [prefer-lowest, prefer-stable]
parallel: ['', '--parallel']
Expand Down
6 changes: 5 additions & 1 deletion src/K6.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,14 @@ private static function extractZip(string $fileName): void
}

/**
* Returns the computer's architecture.
* Returns the computer's architecture. Force amd64 on windows
*/
private static function arch(): string
{
if(self::os() === 'windows') {
return 'amd64';
}

return str_contains(php_uname('m'), 'arm') ? 'arm64' : 'amd64';
}

Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/K6.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@

expect((string) $binary)->toBe(realpath(__DIR__.'/../../bin/k6-'.k6::K6_VERSION.'-linux-'.$arch.'/k6'));
})->skipOnMac()->skipOnWindows();

it('infers the path from the environment on Windows', function (): void {
$binary = K6::make();

$arch = 'amd64'; // Always amd64 on windows

expect((string) $binary)->toBe(realpath(__DIR__.'/../../bin/k6-'.k6::K6_VERSION.'-windows-'.$arch.'/k6.exe'));
})->skipOnMac()->skipOnLinux();

0 comments on commit 4c45536

Please sign in to comment.