1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-12 07:24:31 +02:00

Merge pull request #6863 from marc1706/ticket/17555

[ticket/17555] Adapt windows runner tests to prevent random failures
This commit is contained in:
Marc Alexander
2025-09-29 22:22:28 +02:00
committed by GitHub
2 changed files with 62 additions and 19 deletions

View File

@@ -8,7 +8,10 @@
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
bootstrap="../tests/bootstrap.php"
timeoutForSmallTests="60"
timeoutForMediumTests="300"
timeoutForLargeTests="600">>
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>

View File

@@ -553,6 +553,9 @@ jobs:
GITHUB_WORKSPACE: ${{ github.workspace }}
TEMP_DIR: ${{ runner.temp }}
run: |
# Disable Windows Defender real-time monitoring early to improve performance
Set-MpPreference -DisableRealtimeMonitoring $true
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
Set-Service wuauserv -StartupType Manual
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
@@ -573,12 +576,38 @@ jobs:
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
iisreset
NET START W3SVC
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\test"
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\installer"
icacls "${env:GITHUB_WORKSPACE}\phpBB\cache" /grant Users:F /T
icacls "${env:GITHUB_WORKSPACE}\phpBB\files" /grant Users:F /T
icacls "${env:GITHUB_WORKSPACE}\phpBB\store" /grant Users:F /T
icacls "${env:GITHUB_WORKSPACE}\phpBB\images\avatars\upload" /grant Users:F /T
# Wait for IIS to be ready and test connectivity
Start-Sleep -Seconds 10
try {
$response = Invoke-WebRequest -Uri "http://phpbb.test/" -UseBasicParsing -TimeoutSec 30
Write-Host "Web server is responding: $($response.StatusCode)"
} catch {
Write-Host "Web server test failed: $_"
}
# Create directories and set permissions more efficiently
$dirs = @("cache\test", "cache\installer")
foreach ($dir in $dirs) {
New-Item -Path "${env:GITHUB_WORKSPACE}\phpBB\$dir" -ItemType Directory -Force
}
# Set permissions in batch for better performance
$paths = @("cache", "files", "store", "ext", "vendor-ext", "images\avatars\upload")
foreach ($path in $paths) {
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$path") {
icacls "${env:GITHUB_WORKSPACE}\phpBB\$path" /grant Users:F /T /Q
}
}
# Set permissions for specific files
$files = @("composer-ext.json", "composer-ext.lock")
foreach ($file in $files) {
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$file") {
icacls "${env:GITHUB_WORKSPACE}\phpBB\$file" /grant Users:F /Q
}
}
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl = Get-ACL "${env:TEMP_DIR}"
$acl.AddAccessRule($accessRule)
@@ -593,7 +622,7 @@ jobs:
$postgreSqlSvc = Get-Service "postgresql*"
Set-Service $postgreSqlSvc.Name -StartupType manual
$runningStatus = [System.ServiceProcess.ServiceControllerStatus]::Running
$maxStartTimeout = New-TimeSpan -Seconds 30
$maxStartTimeout = New-TimeSpan -Seconds 120
try {
$postgreSqlSvc.Start()
$postgreSqlSvc.WaitForStatus($runningStatus, $maxStartTimeout)
@@ -602,17 +631,28 @@ jobs:
}
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
$env:PGPASSWORD = 'root'
psql -c 'ALTER SYSTEM SET hot_standby = on;' -U postgres
psql -c 'ALTER SYSTEM SET wal_level = minimal;' -U postgres
# Optimize PostgreSQL for testing performance
psql -c "ALTER SYSTEM SET fsync = off;" -U postgres
psql -c "ALTER SYSTEM SET synchronous_commit = off;" -U postgres
psql -c "ALTER SYSTEM SET checkpoint_completion_target = 0.9;" -U postgres
psql -c "ALTER SYSTEM SET wal_buffers = '16MB';" -U postgres
psql -c "ALTER SYSTEM SET shared_buffers = '128MB';" -U postgres
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
psql -c 'create database phpbb_tests;' -U postgres
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
Set-MpPreference -DisableRealtimeMonitoring $true
- name: Run unit tests
if: ${{ matrix.type == 'unit' }}
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --exclude-group functional
- name: Run unit tests
if: ${{ matrix.type == 'functional' }}
timeout-minutes: 45
env:
PHPBB_FUNCTIONAL_TIMEOUT: 30
SYMFONY_DEPRECATIONS_HELPER: disabled
PHPBB_TEST_REDIS_HOST: ''
PHPBB_TEST_MEMCACHED_HOST: ''
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --group functional