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

Skip to content

Use ForEach Parallel to run Windows tests in parallel #11

Use ForEach Parallel to run Windows tests in parallel

Use ForEach Parallel to run Windows tests in parallel #11

Workflow file for this run

name: Windows
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
windows:
name: x86 / minimal-exts / lowest-php
timeout-minutes: 15
defaults:
run:
shell: pwsh
runs-on: windows-2022
env:
COMPOSER_NO_INTERACTION: '1'
SYMFONY_DEPRECATIONS_HELPER: 'strict'
ANSICON: '121x90 (121x90)'
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: '1'
steps:
- name: Setup Git
run: |
git config --global core.autocrlf false
git config --global user.email ""
git config --global user.name "Symfony"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup PHP
run: |
$env:Path = 'c:\php;' + $env:Path
mkdir c:\php && cd c:\php
iwr -outf php-7.2.5-Win32-VC15-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.2.5-Win32-VC15-x86.zip
7z x php-7.2.5-Win32-VC15-x86.zip -y >nul
cd ext
iwr -outf php_apcu-5.1.19-7.2-ts-vc15-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.19-7.2-ts-vc15-x86.zip
7z x php_apcu-5.1.19-7.2-ts-vc15-x86.zip -y >nul
iwr -outf php_redis-5.3.2-7.2-ts-vc15-x86.zip https://github.com/symfony/binary-utils/releases/download/v0.1/php_redis-5.3.2-7.2-ts-vc15-x86.zip
7z x php_redis-5.3.2-7.2-ts-vc15-x86.zip -y >nul
cd ..
Copy php.ini-development php.ini-min
"memory_limit=-1" >> php.ini-min
"serialize_precision=-1" >> php.ini-min
"max_execution_time=1200" >> php.ini-min
"post_max_size=2047M" >> php.ini-min
"upload_max_filesize=2047M" >> php.ini-min
"date.timezone=`"America/Los_Angeles`"" >> php.ini-min
"extension_dir=ext" >> php.ini-min
"extension=php_xsl.dll" >> php.ini-min
"extension=php_mbstring.dll" >> php.ini-min
Copy php.ini-min php.ini-max
"zend_extension=php_opcache.dll" >> php.ini-max
"opcache.enable_cli=1" >> php.ini-max
"extension=php_openssl.dll" >> php.ini-max
"extension=php_apcu.dll" >> php.ini-max
"extension=php_redis.dll" >> php.ini-max
"apc.enable_cli=1" >> php.ini-max
"extension=php_intl.dll" >> php.ini-max
"extension=php_fileinfo.dll" >> php.ini-max
"extension=php_pdo_sqlite.dll" >> php.ini-max
"extension=php_curl.dll" >> php.ini-max
"extension=php_sodium.dll" >> php.ini-max
Copy php.ini-max php.ini
cd ${{ github.workspace }}
- name: Install dependencies
id: setup
run: |
$env:Path = 'c:\php;' + $env:Path
mkdir $env:APPDATA\Composer && Copy .github\composer-config.json $env:APPDATA\Composer\config.json
$env:SYMFONY_VERSION=(Select-String -CaseSensitive -Pattern " VERSION =" -SimpleMatch -Path src/Symfony/Component/HttpKernel/Kernel.php | Select Line | Select-String -Pattern "([0-9][0-9]*\.[0-9])").Matches.Value
$env:COMPOSER_ROOT_VERSION=$env:SYMFONY_VERSION + ".x-dev"
php .github/build-packages.php HEAD^ $env:SYMFONY_VERSION src\Symfony\Bridge\PhpUnit
composer update --no-progress --ansi
- name: Install PHPUnit
run: |
$env:Path = 'c:\php;' + $env:Path
php phpunit install
- name: Install memurai-developer
run: |
choco install --no-progress memurai-developer
- name: Run tests (minimal extensions)
if: always() && steps.setup.outcome == 'success'
run: |
$env:Path = 'c:\php;' + $env:Path
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
$x = 0
Copy c:\php\php.ini-min c:\php\php.ini
Remove-Item -Path src\Symfony\Bridge\PhpUnit -Recurse
$COMPONENTS = (Get-ChildItem -Path src -Include phpunit.xml.dist -Recurse).Directory.FullName | Resolve-Path -Relative
$COMPONENTS | ForEach-Object {
$cmd = "php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_"
echo "+ $cmd"
$output = cmd /c $cmd
$ok = $LASTEXITCODE
if (!$ok -eq 0) {
echo $_
echo $output
echo "Job exited with: $ok"
Write-Error "KO $_"
} else {
#echo "::group::$_"
echo $_
echo $output
echo "OK $_"
#echo "::endgroup::"
}
}
- name: Run tests
if: false && always() && steps.setup.outcome == 'success'
run: |
$env:Path = 'c:\php;' + $env:Path
$env:SYMFONY_PHPUNIT_SKIPPED_TESTS = 'phpunit.skipped'
Copy c:\php\php.ini-max c:\php\php.ini
$COMPONENTS = (Get-ChildItem -Path src -Include phpunit.xml.dist -Recurse).Directory.FullName | Resolve-Path -Relative
$COMPONENTS | ForEach-Object -Parallel {
$output = php phpunit --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group network --exclude-group transient-on-windows $_
$ok = $LASTEXITCODE
if (!$ok -eq 0) {
echo $_
echo $output
echo "Job exited with: $ok"
Write-Error "KO $_"
} else {
#echo "::group::$_"
echo $_
echo $output
echo "OK $_"
#echo "::endgroup::"
}
}
0