10000 Use ForEach Parallel to run Windows tests in parallel · wouterj/symfony@b7f6d1e · GitHub
[go: up one dir, main page]

Skip to content

Commit b7f6d1e

Browse files
committed
Use ForEach Parallel to run Windows tests in parallel
1 parent da4eb8b commit b7f6d1e

File tree

1 file changed

+42
-11
lines changed

1 file changed

+42
-11
lines changed

.github/workflows/windows.yml

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
windows:
1616
name: x86 / minimal-exts / lowest-php
1717

18+
timeout-minutes: 15
19+
1820
defaults:
1921
run:
2022
shell: pwsh
@@ -75,7 +77,6 @@ jobs:
7577
"extension=php_sodium.dll" >> php.ini-max
7678
Copy php.ini-max php.ini
7779
cd ${{ github.workspace }}
78-
iwr -outf composer.phar https://getcomposer.org/download/latest-stable/composer.phar
7980
8081
- name: Install dependencies
8182
id: setup
@@ -87,7 +88,7 @@ jobs:
8788
$env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev"
8889
8990
php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit
90-
php composer.phar update --no-progress --ansi
91+
composer update --no-progress --ansi
9192
9293
- name: Install PHPUnit
9394
run: |
@@ -108,21 +109,51 @@ jobs:
108109
109110
Copy c:\php\php.ini-min c:\php\php.ini
110111
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
111-
mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
112-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
113-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
114112
115-
exit $x
113+
$COMPONENTS = (Get-ChildItem -Path src -Include phpunit.xml.dist -Recurse).Directory.FullName | Resolve-Path -Relative
114+
$COMPONENTS | ForEach-Object {
115+
$cmd = "php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_"
116+
echo "+ $cmd"
117+
$output = cmd /c $cmd
118+
$ok = $LASTEXITCODE
119+
120+
if (!$ok -eq 0) {
121+
echo $_
122+
echo $output
123+
echo "Job exited with: $ok"
124+
Write-Error "KO $_"
125+
} else {
126+
#echo "::group::$_"
127+
echo $_
128+
echo $output
129+
echo "OK $_"
130+
#echo "::endgroup::"
131+
}
132+
}
116133
117134
- name: Run tests
118-
if: always() && steps.setup.outcome == 'success'
135+
if: false && always() && steps.setup.outcome == 'success'
119136
run: |
120137
$env:Path = 'c:\php;' + $env:Path
121138
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
122-
$x = 0
123139
124140
Copy c:\php\php.ini-max c:\php\php.ini
125-
php phpunit src\Symfony --exclude-group tty,benchmark,intl-data,network,transient-on-windows || ($x = 1)
126-
php phpunit src\Symfony\Component\HttpClient || ($x = 1)
127141
128-
exit $x
142+
$COMPONENTS = (Get-ChildItem -Path src -Include phpunit.xml.dist -Recurse).Directory.FullName | Resolve-Path -Relative
143+
$COMPONENTS | ForEach-Object -Parallel {
144+
$output = php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_
145+
$ok = $LASTEXITCODE
146+
147+
if (!$ok -eq 0) {
148+
echo $_
149+
echo $output
150+
echo "Job exited with: $ok"
151+
Write-Error "KO $_"
152+
} else {
153+
#echo "::group::$_"
154+
echo $_
155+
echo $output
156+
echo "OK $_"
157+
#echo "::endgroup::"
158+
}
159+
}

0 commit comments

Comments
 (0)
0