From dc22ad07a28bb0567f37ba6e7c6c81f917429337 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 29 Sep 2025 20:10:27 +0200 Subject: [PATCH] [ticket/17555] Apply windows runner adjustments from master PHPBB-17555 --- .github/phpunit-psql-windows-github.xml | 21 +++++---- .github/workflows/tests.yml | 60 ++++++++++++++++++++----- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/.github/phpunit-psql-windows-github.xml b/.github/phpunit-psql-windows-github.xml index 5f131bae80..88fce1693b 100644 --- a/.github/phpunit-psql-windows-github.xml +++ b/.github/phpunit-psql-windows-github.xml @@ -1,14 +1,17 @@ + backupStaticAttributes="false" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + verbose="true" + bootstrap="../tests/bootstrap.php" + timeoutForSmallTests="60" + timeoutForMediumTests="300" + timeoutForLargeTests="600">> ../tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e070cabb92..9dac7ee0c5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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("", "`n`t`n`t`t`n`t") | 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