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

Skip to content

Commit 74c331c

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

File tree

1 file changed

+45
-11
lines changed

1 file changed

+45
-11
lines changed

.github/workflows/windows.yml

Lines changed: 45 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,54 @@ 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+
echo ""
116+
Get-Location
117+
118+
$cmd = "php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_"
119+
echo "+ $cmd"
120+
$output = cmd /c $cmd
121+
$ok = $LASTEXITCODE
122+
123+
if (!$ok -eq 0) {
124+
echo $_
125+
echo $output
126+
echo "Job exited with: $ok"
127+
Write-Error "KO $_"
128+
} else {
129+
#echo "::group::$_"
130+
echo $_
131+
echo $output
132+
echo "OK $_"
133+
#echo "::endgroup::"
134+
}
135+
}
116136
117137
- name: Run tests
118-
if: always() && steps.setup.outcome == 'success'
138+
if: false && always() && steps.setup.outcome == 'success'
119139
run: |
120140
$env:Path = 'c:\php;' + $env:Path
121141
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
122-
$x = 0
123142
124143
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)
127144
128-
exit $x
145+
$COMPONENTS = (Get-ChildItem -Path src -Include phpunit.xml.dist -Recurse).Directory.FullName | Resolve-Path -Relative
146+
$COMPONENTS | ForEach-Object -Parallel {
147+
$output = php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_
148+
$ok = $LASTEXITCODE
149+
150+
if (!$ok -eq 0) {
151+
echo $_
152+
echo $output
153+
echo "Job exited with: $ok"
154+
Write-Error "KO $_"
155+
} else {
156+
#echo "::group::$_"
157+
echo $_
158+
echo $output
159+
echo "OK $_"
160+
#echo "::endgroup::"
161+
}
162+
}

0 commit comments

Comments
 (0)
0