@@ -363,3 +363,86 @@ jobs:
363363 DB : ${{steps.database-type.outputs.db}}
364364 run : |
365365 phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
366+
367+ # Test with IIS & PostgreSQL on Windows
368+ windows-tests :
369+ runs-on : windows-2016
370+ strategy :
371+ matrix :
372+ include :
373+ - php : ' 7.4'
374+ db : " postgres"
375+
376+ name : Windows - PHP ${{ matrix.php }} - ${{ matrix.db }}
377+
378+ steps :
379+ - name : Prepare git for Windows
380+ run : |
381+ git config --system core.autocrlf false
382+ git config --system core.eol lf
383+ - name : Checkout repository
384+ uses : actions/checkout@v2
385+
386+ - name : Setup PHP
387+ uses : shivammathur/setup-php@v2
388+ with :
389+ php-version : ${{ matrix.php }}
390+ extensions : dom, curl, libxml, mbstring, zip, pcntl, pdo, intl, gd, exif, iconv, pgsql, pdo_pgsql
391+ ini-values : upload_tmp_dir=${{ runner.temp }}, sys_temp_dir=${{ runner.temp }}
392+ coverage : none
393+
394+ - name : Setup environment for phpBB
395+ env :
396+ GITHUB_WORKSPACE : ${{ github.workspace }}
397+ TEMP_DIR : ${{ runner.temp }}
398+ run : |
399+ 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
400+ Set-Service wuauserv -StartupType Manual
401+ (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
402+ (Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("`t</system.webServer>", "`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
403+ choco install urlrewrite -y
404+ Import-Module WebAdministration
405+ New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB" -Force
406+ $session = Get-PSSession -Name WinPSCompatSession
407+ $sb = {Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'}}
408+ Invoke-Command -Scriptblock $sb -Session $session
409+ $sb = {Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value true -location "IIS:\Sites\phpBBTest"}
410+ Invoke-Command -Scriptblock $sb -Session $session
411+ Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`r`n127.0.0.1`tphpbb.test" -Force
412+ [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";%windir%\system32\inetsrv")
413+ echo Setup FAST-CGI configuration
414+ Add-WebConfiguration -Filter /system.webServer/fastCgi -PSPath IIS:\ -Value @{fullpath="C:\tools\php\php-cgi.exe"}
415+ echo Setup FACT-CGI handler
416+ New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
417+ iisreset
418+ NET START W3SVC
419+ mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\test"
420+ mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\installer"
421+ icacls "${env:GITHUB_WORKSPACE}\phpBB\cache" /grant Users:F /T
422+ icacls "${env:GITHUB_WORKSPACE}\phpBB\files" /grant Users:F /T
423+ icacls "${env:GITHUB_WORKSPACE}\phpBB\store" /grant Users:F /T
424+ icacls "${env:GITHUB_WORKSPACE}\phpBB\images\avatars\upload" /grant Users:F /T
425+ $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
426+ $acl = Get-ACL "${env:TEMP_DIR}"
427+ $acl.AddAccessRule($accessRule)
428+ Set-ACL -Path "${env:TEMP_DIR}" -ACLObject $acl
429+ cd ${env:GITHUB_WORKSPACE}\phpBB
430+ php ..\composer.phar install
431+ cd ..
432+ - name : Setup database
433+ run : |
434+ $postgreSqlSvc = Get-Service "postgresql*"
435+ Set-Service $postgreSqlSvc.Name -StartupType manual
436+ $postgreSqlSvc.Start()
437+ try {
438+ (Get-Service "postgresql*").Start()
439+ } catch {
440+ $_ | select *
441+ }
442+ [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
443+ $env:PGPASSWORD = 'root'
444+ psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
445+ psql -c 'create database phpbb_tests;' -U postgres
446+ - name : Run unit tests
447+ run : |
448+ phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error
0 commit comments