diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index a2a3a04471..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,144 +0,0 @@ -build: false -clone_folder: c:\projects\phpbb -version: '{build}' - -services: - - iis - -environment: - COMPOSER_AUTH: - secure: '{"github-oauth": {"github.com": "zvq38wk7sRe87Y9W2OCYXcK7WKQDsig7GRIUDHGmxm6ZQRK8JswPbi8JoJQbFhM+"}}' - matrix: - - db: mssql - db_version: sql2012sp1 - php: 7.1 - - db: mssql - db_version: sql2014 - php: 7.1 - - db: mssql - db_version: sql2016 - php: 7.2 -# - db: mssql -# db_version: sql2017 -# php: 7.1 -# - db: mariadb -# php: 7.1 -# - db: mysqli -# php: 7.1 -# - db: sqlite -# php: 7.1 -# - db: postgresql -# php: 7.1 - -hosts: - phpbb.test: 127.0.0.1 - -init: - - SET PATH=%systemroot%\system32\inetsrv\;C:\Program Files\OpenSSL;C:\tools\php;c:\php;%PATH% - - SET ANSICON=121x90 (121x90) - - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f - -before_test: - - ps: | - Set-Service wuauserv -StartupType Manual - choco install chocolatey -y --version 0.10.13 --allow-downgrade - choco install php -y --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - Get-ChildItem -Path "c:\tools\php$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1$2')" -Recurse | - Move-Item -destination "c:\tools\php" - cd c:\tools\php - cat php.ini-development | %{$_ -replace "memory_limit = 128M","memory_limit = 1024M"} | Out-File -Encoding "Default" php.ini - Add-Content php.ini "`n date.timezone=UTC" - Add-Content php.ini "`n display_errors=On" - Add-Content php.ini "`n extension_dir=ext" - Add-Content php.ini "`n extension=php_openssl.dll" - Add-Content php.ini "`n extension=php_mbstring.dll" - Add-Content php.ini "`n extension=php_curl.dll" - Add-Content php.ini "`n extension=php_gd2.dll" - Add-Content php.ini "`n extension=php_tidy.dll" - Add-Content php.ini "`n extension=php_fileinfo.dll" - Add-Content php.ini "`n extension=php_pdo_sqlite.dll" - Add-Content php.ini "`n extension=php_sqlite3.dll" - Add-Content php.ini "`n extension=php_pdo_mysql.dll" - Add-Content php.ini "`n extension=php_mysqli.dll" - Add-Content php.ini "`n extension=php_pdo_pgsql.dll" - Add-Content php.ini "`n extension=php_pgsql.dll" - - # Get MSSQL driver - if ($env:db -eq "mssql") { - cd c:\tools\php\ext - $DLLVersion = "5.3.0" - $VCVersion = If ([System.Version]"$($env:php)" -ge [System.Version]"7.2") {"vc15"} Else {"vc14"} - curl -o php_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip https://windows.php.net/downloads/pecl/releases/sqlsrv/$($:DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-$($VCVersion)-x64.zip - 7z x -y php_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip > $null - curl -o php_pdo_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-$($VCVersion)-x64.zip - 7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php -replace '([0-9])[.]([0-9])[.]?([0-9]+)?','$1.$2')-nts-vc14-x64.zip > $null - Remove-Item c:\tools\php\* -include .zip - cd c:\tools\php - Add-Content php.ini "`nextension=php_sqlsrv.dll" - Add-Content php.ini "`nextension=php_pdo_sqlsrv.dll" - Add-Content php.ini "`n" - - $instanceName = $env:db_version.ToUpper() - Start-Service "MSSQL`$$instanceName" - Set-Variable -Name "sqlServerPath" -Value "(local)\$($env:db_version.ToUpper())" - - # Create database write test config - sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS" - $data = "", "`n`t`n`t`t`n`t") | Set-Content c:\projects\phpbb\phpBB\web.config - (Get-Content c:\projects\phpbb\phpBB\web.config).replace("`t", "`t`t`n`t") | Set-Content c:\projects\phpbb\phpBB\web.config - - cd c:\projects\phpbb\phpBB - - php ..\composer.phar install - - choco install urlrewrite -y - - ps: New-WebSite -Name 'phpBBTest' -PhysicalPath 'c:\projects\phpbb\phpBB' -Force - - ps: Import-Module WebAdministration; Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'} - - echo Change default anonymous user AUTH to ApplicationPool - - appcmd set config -section:anonymousAuthentication /username:"" --password - - echo Setup FAST-CGI configuration - - appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\tools\php\php-cgi.exe'] - - echo Setup FACT-CGI handler - - appcmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\tools\php\php-cgi.exe',resourceType='Either'] - - iisreset - - NET START W3SVC - - mkdir "C:\projects\phpbb\phpBB\cache\test" - - mkdir "C:\projects\phpbb\phpBB\cache\installer" - - icacls "C:\projects\phpbb\phpBB\cache" /grant Users:F /T - - icacls "C:\projects\phpbb\phpBB\files" /grant Users:F /T - - icacls "C:\projects\phpbb\phpBB\store" /grant Users:F /T - - icacls "C:\projects\phpbb\phpBB\images\avatars\upload" /grant Users:F /T - -test_script: - - cd c:\projects\phpbb - - php -e phpBB\vendor\phpunit\phpunit\phpunit --verbose - diff --git a/.github/ext-check-executable-files.sh b/.github/ext-check-executable-files.sh new file mode 100755 index 0000000000..09db25d40b --- /dev/null +++ b/.github/ext-check-executable-files.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +root="$1" +extname="$2" +path="${root}phpBB/ext/${extname}/" + +# Check the permissions of the files + +# The following variables MUST NOT contain any wildcard +# Directories to skip +directories_skipped="-path ${path}develop -o -path ${path}vendor -o -path ${path}.git" + +# Files to skip +files_skipped="-false" + +# Files which have to be executable +executable_files="-path ${path}bin/* -o -path ${path}install/phpbbcli.php" + +incorrect_files=$( \ + find ${path} \ + '(' \ + '(' \ + ${directories_skipped} \ + ')' \ + -a -type d -prune -a -type f \ + ')' -o \ + '(' \ + -type f -a \ + -not '(' \ + ${files_skipped} \ + ')' -a \ + '(' \ + '(' \ + '(' \ + ${executable_files} \ + ')' -a \ + -not -perm /100 \ + ')' -o \ + '(' \ + -not '(' \ + ${executable_files} \ + ')' -a \ + -perm /111 \ + ')' \ + ')' \ + ')' \ + ) + +if [ "${incorrect_files}" != '' ] +then + echo "The following files do not have proper permissions:"; + ls -la ${incorrect_files} + exit 1; +fi diff --git a/.github/phpunit-psql-windows-github.xml b/.github/phpunit-psql-windows-github.xml new file mode 100644 index 0000000000..5f131bae80 --- /dev/null +++ b/.github/phpunit-psql-windows-github.xml @@ -0,0 +1,41 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + diff --git a/.github/phpunit-sqlite3-github.xml b/.github/phpunit-sqlite3-github.xml index f5b2b67b22..b079a0bbbe 100644 --- a/.github/phpunit-sqlite3-github.xml +++ b/.github/phpunit-sqlite3-github.xml @@ -27,12 +27,6 @@ - - - - - - diff --git a/.github/prepare-extension.sh b/.github/prepare-extension.sh index 9a1eee43c6..d3adc95ec5 100755 --- a/.github/prepare-extension.sh +++ b/.github/prepare-extension.sh @@ -17,6 +17,6 @@ EXTNAME=$1 mkdir --parents phpBB/ext/$EXTNAME cp -R ../tmp/* phpBB/ext/$EXTNAME -# Move the extensions .github/phpunit-*-travis.xml files in place +# Move the test files for extensions in place cp -R .github/*.xml phpBB/ext/$EXTNAME/.github cp -R .github/*.sh phpBB/ext/$EXTNAME/.github diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 74cc3f8e4e..9d45991111 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,6 @@ on: branches: - 3.3.x - master - - ticket/16659 pull_request: branches: - 3.3.x @@ -364,3 +363,86 @@ jobs: DB: ${{steps.database-type.outputs.db}} run: | phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error + + # Test with IIS & PostgreSQL on Windows + windows-tests: + runs-on: windows-2016 + strategy: + matrix: + include: + - php: '7.4' + db: "postgres" + + name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }} + + steps: + - name: Prepare git for Windows + run: | + git config --system core.autocrlf false + git config --system core.eol lf + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, intl, gd, exif, iconv, pgsql, pdo_pgsql + ini-values: upload_tmp_dir=${{ runner.temp }}, sys_temp_dir=${{ runner.temp }} + coverage: none + + - name: Setup environment for phpBB + env: + GITHUB_WORKSPACE: ${{ github.workspace }} + TEMP_DIR: ${{ runner.temp }} + run: | + 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 + (Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("`t", "`t`t`n`t") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config + choco install urlrewrite -y + Import-Module WebAdministration + New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB" -Force + $session = Get-PSSession -Name WinPSCompatSession + $sb = {Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'}} + Invoke-Command -Scriptblock $sb -Session $session + $sb = {Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value true -location "IIS:\Sites\phpBBTest"} + Invoke-Command -Scriptblock $sb -Session $session + Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`r`n127.0.0.1`tphpbb.test" -Force + [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";%windir%\system32\inetsrv") + echo Setup FAST-CGI configuration + Add-WebConfiguration -Filter /system.webServer/fastCgi -PSPath IIS:\ -Value @{fullpath="C:\tools\php\php-cgi.exe"} + echo Setup FACT-CGI handler + 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 + $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow") + $acl = Get-ACL "${env:TEMP_DIR}" + $acl.AddAccessRule($accessRule) + Set-ACL -Path "${env:TEMP_DIR}" -ACLObject $acl + cd ${env:GITHUB_WORKSPACE}\phpBB + php ..\composer.phar install + cd .. + - name: Setup database + run: | + $postgreSqlSvc = Get-Service "postgresql*" + Set-Service $postgreSqlSvc.Name -StartupType manual + $postgreSqlSvc.Start() + try { + (Get-Service "postgresql*").Start() + } catch { + $_ | select * + } + [System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}") + $env:PGPASSWORD = 'root' + psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres + psql -c 'create database phpbb_tests;' -U postgres + - name: Run unit tests + run: | + phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c7077a379f..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -language: php -dist: xenial - -matrix: - include: - - php: 7.1 - env: DB=none;NOTESTS=1 - - php: 7.1 - env: DB=mariadb - - php: 7.1 - env: DB=postgres - - php: 7.1 - env: DB=sqlite3 - - php: 7.1 - env: DB=mysqli;SLOWTESTS=1 - - php: 7.1 - env: DB=mysqli # MyISAM - - php: 7.2 - env: DB=mysqli - - php: 7.3 - env: DB=mysqli - - php: 7.4 - env: DB=mysqli - - php: 7.4 - env: DB=mysqli;MYSQL8=1 - - php: 8.0snapshot - env: DB=mysqli - - php: nightly - env: DB=mysqli - allow_failures: - - php: nightly - fast_finish: true - -addons: - apt: - sources: - - node - -services: - - redis-server - - postgresql - - mysql - - memcached - -install: - - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} - -before_script: - - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - travis/setup-ldap.sh $SLOWTESTS - -script: - - travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - travis/check-doctum-parse-errors.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS - - travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION $NOTESTS ./ - - travis/check-stylesheet.sh $NOTESTS - - sh -c "if [ '$SLOWTESTS' != '1' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/phpunit tests/lint_test.php; fi" - - sh -c "if [ '$NOTESTS' != '1' -a '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --verbose --stop-on-error; fi" - - sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi" - - sh -c "set -x;if [ '$NOTESTS' = '1' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git remote set-branches --add origin $TRAVIS_BRANCH && git fetch && git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..$TRAVIS_PULL_REQUEST_SHA; fi" diff --git a/README.md b/README.md index 1cb10c664b..277763c582 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,10 @@ phpBB's [Development Documentation](https://area51.phpbb.com/docs/dev/index.html We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](https://bamboo.phpbb.com) or check our travis builds below: -Branch | Description | Travis CI | AppVeyor -------- | ----------- | ---------- | -------- -**master** | Latest development version | [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=master)](http://travis-ci.org/phpbb/phpbb) | [![Build status](https://ci.appveyor.com/api/projects/status/8g98ybngd2f3axy1/branch/master?svg=true)](https://ci.appveyor.com/project/phpBB/phpbb/branch/master) -**3.3.x** | Development of version 3.3.x | [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=3.3.x)](http://travis-ci.org/phpbb/phpbb) | [![Build status](https://ci.appveyor.com/api/projects/status/8g98ybngd2f3axy1/branch/3.3.x?svg=true)](https://ci.appveyor.com/project/phpBB/phpbb/branch/3.3.x) -**3.2.x** | Development of version 3.2.x | [![Build Status](https://travis-ci.org/phpbb/phpbb.svg?branch=3.2.x)](http://travis-ci.org/phpbb/phpbb) | [![Build status](https://ci.appveyor.com/api/projects/status/8g98ybngd2f3axy1/branch/3.2.x?svg=true)](https://ci.appveyor.com/project/phpBB/phpbb/branch/3.2.x) +Branch | Description | Github Actions | +------- | ----------- | -------------- | +**master** | Latest development version | ![Tests](https://github.com/phpbb/phpbb/workflows/Tests/badge.svg?branch=master) | +**3.3.x** | Development of version 3.3.x | ![Tests](https://github.com/phpbb/phpbb/workflows/Tests/badge.svg?branch=3.3.x) | ## 📜 License