mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-12 07:24:31 +02:00
Merge pull request #6871 from iMattPro/ticket/17555
[ticket/17555] Optimize windows functional tests
This commit is contained in:
5
.github/phpunit-psql-windows-github.xml
vendored
5
.github/phpunit-psql-windows-github.xml
vendored
@@ -7,7 +7,10 @@
|
||||
bootstrap="../tests/bootstrap.php"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
backupStaticProperties="false">
|
||||
backupStaticProperties="false"
|
||||
timeoutForSmallTests="60"
|
||||
timeoutForMediumTests="300"
|
||||
timeoutForLargeTests="600">
|
||||
<testsuites>
|
||||
<testsuite name="phpBB Test Suite">
|
||||
<directory suffix="_test.php">../tests</directory>
|
||||
|
64
.github/workflows/tests.yml
vendored
64
.github/workflows/tests.yml
vendored
@@ -544,6 +544,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
|
||||
@@ -564,16 +567,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\ext" /grant Users:F /T
|
||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\vendor-ext" /grant Users:F /T
|
||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.json" /grant Users:F /T
|
||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.lock" /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)
|
||||
@@ -586,7 +611,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)
|
||||
@@ -595,12 +620,17 @@ 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: Setup node
|
||||
uses: actions/setup-node@v4
|
||||
@@ -615,5 +645,11 @@ jobs:
|
||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow
|
||||
- name: Run functional 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 --display-all-issues --stop-on-error --group functional
|
||||
|
@@ -129,11 +129,17 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
$this->bootstrap();
|
||||
|
||||
self::$cookieJar = new CookieJar;
|
||||
// Force native client on windows platform
|
||||
self::$http_client = strtolower(substr(PHP_OS, 0, 3)) === 'win' ? new NativeHttpClient() : HttpClient::create();
|
||||
self::$http_client->withOptions([
|
||||
'timeout' => 60,
|
||||
]);
|
||||
// Optimize HTTP client for Windows platform
|
||||
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
||||
self::$http_client = new NativeHttpClient([
|
||||
'timeout' => 30,
|
||||
'max_duration' => 60,
|
||||
]);
|
||||
} else {
|
||||
self::$http_client = HttpClient::create([
|
||||
'timeout' => 60,
|
||||
]);
|
||||
}
|
||||
self::$client = new HttpBrowser(self::$http_client, null, self::$cookieJar);
|
||||
|
||||
// Clear the language array so that things
|
||||
|
Reference in New Issue
Block a user