1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-16 13:48:58 +01:00

[ticket/16659] Split up tests for each database type

PHPBB3-16659
This commit is contained in:
Marc Alexander 2020-12-16 21:46:57 +01:00
parent b3e3d9642e
commit ef22a029b2
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
18 changed files with 789 additions and 95 deletions

26
.github/check-doctum-parse-errors.sh vendored Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
if [ ! -f doctum.phar ]; then
# Download the latest (5.1.x) release if the file does not exist
# Remove it to update your phar
curl -O https://doctum.long-term.support/releases/5.1/doctum.phar
rm -f doctum.phar.sha256
curl -O https://doctum.long-term.support/releases/5.1/doctum.phar.sha256
sha256sum --strict --check doctum.phar.sha256
rm -f doctum.phar.sha256
# You can fetch the latest (5.1.x) version code here:
# https://doctum.long-term.support/releases/5.1/VERSION
fi
# Show the version to inform users of the script
php doctum.phar --version
php doctum.phar parse build/doctum-checkout.conf.php -v

63
.github/check-executable-files.sh vendored Executable file
View File

@ -0,0 +1,63 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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"
path="${root}phpBB/"
# 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"
# 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

14
.github/check-image-icc-profiles.sh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
find . -type f -a -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' -a -not -wholename '*vendor/*' | \
parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}'

41
.github/ldap/base.ldif vendored Normal file
View File

@ -0,0 +1,41 @@
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: example
dc: example
dn: ou=foo,dc=example,dc=com
objectClass: organizationalUnit
ou: foo
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9NytMR2gveUxTMzdsc3RRd1V1dENZSVA0TWdYdm9SdDY=
dn: ou=group,dc=example,dc=com
objectClass: organizationalUnit
ou: group
dn: cn=admin,ou=foo,dc=example,dc=com
objectClass: posixAccount
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
loginShell: /bin/bash
homeDirectory: /home/admin
uid: admin
cn: admin
uidNumber: 10000
gidNumber: 10000
sn: admin
mail: admin@example.com
userPassword:: e1NTSEF9WHpueGZURHZZc21JSkl6czdMVXBjdCtWYTA1dlMzVlQ=
dn: cn=admin,ou=group,dc=example,dc=com
objectClass: posixGroup
gidNumber: 10000
cn: admin

17
.github/ldap/slapd.conf vendored Normal file
View File

@ -0,0 +1,17 @@
# See slapd.conf(5) for details on configuration options.
include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/nis.schema
pidfile /var/tmp/slapd/slapd.pid
argsfile /var/tmp/slapd/slapd.args
modulepath /usr/lib/openldap
database ldif
directory /var/tmp/slapd
suffix "dc=example,dc=com"
rootdn "cn=admin,dc=example,dc=com"
rootpw adminadmin

16
.github/phing-sniff.sh vendored Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
set -x
cd build
../phpBB/vendor/bin/phing sniff
cd ..

39
.github/phpunit-mariadb-github.xml vendored Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="mysqli" />
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
<server name="PHPBB_TEST_DBPORT" value="3306" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="root" />
<server name="PHPBB_TEST_DBPASSWD" value="" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
</phpunit>

41
.github/phpunit-mssql-github.xml vendored Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mssqlnative" />
<server name="PHPBB_TEST_DBHOST" value="127.0.0.1" />
<server name="PHPBB_TEST_DBPORT" value="" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="sa" />
<server name="PHPBB_TEST_DBPASSWD" value="Pssw0rd_12" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
</phpunit>

41
.github/phpunit-mysql-github.xml vendored Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" />
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
<server name="PHPBB_TEST_DBPORT" value="3306" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="root" />
<server name="PHPBB_TEST_DBPASSWD" value="" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
</phpunit>

41
.github/phpunit-postgres-github.xml vendored Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost" />
<server name="PHPBB_TEST_DBPORT" value="5432" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
<server name="PHPBB_TEST_DBUSER" value="postgres" />
<server name="PHPBB_TEST_DBPASSWD" value="postgres" />
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
</phpunit>

41
.github/phpunit-sqlite3-github.xml vendored Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="true"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="../tests/bootstrap.php">
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests</directory>
<exclude>../tests/functional</exclude>
<exclude>../tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php">../tests/functional</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>slow</group>
</exclude>
</groups>
<php>
<!--server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\sqlite3" /-->
<!--server name="PHPBB_TEST_DBHOST" value="../phpbb_unit_tests.sqlite3" /-->
<!--server name="PHPBB_TEST_DBPORT" value="" /-->
<!--server name="PHPBB_TEST_DBNAME" value="" /-->
<!--server name="PHPBB_TEST_DBUSER" value="" /-->
<!--server name="PHPBB_TEST_DBPASSWD" value="" /-->
<server name="PHPBB_TEST_REDIS_HOST" value="localhost" />
<server name="PHPBB_TEST_MEMCACHED_HOST" value="localhost" />
<server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/>
<server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" />
</php>
</phpunit>

26
.github/setup-database.sh vendored Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
set -x
DB=$1
MYISAM=$2
if [ "$DB" == "postgres" ]
then
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
psql -c 'create database phpbb_tests;' -U postgres
fi
if [ "$MYISAM" == '1' ]
then
mysql -h 127.0.0.1 -u root -e 'SET GLOBAL storage_engine=MyISAM;'
fi

14
.github/setup-exiftool.sh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
sudo apt-get update
sudo apt-get install -y parallel libimage-exiftool-perl

19
.github/setup-ldap.sh vendored Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
set -x
sudo apt-get -y install ldap-utils slapd
mkdir /var/tmp/slapd
cp .github/ldap/slapd.conf /var/tmp/slapd/slapd.conf
slapd -d 256 -d 128 -f /var/tmp/slapd/slapd.conf -h ldap://localhost:3389 &
sleep 3
ldapadd -h localhost:3389 -D "cn=admin,dc=example,dc=com" -w adminadmin -f .github/ldap/base.ldif

36
.github/setup-phpbb.sh vendored Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
set -x
DB=$1
PHP_VERSION=$2
NOTESTS=$3
if [ "$NOTESTS" == '1' ]
then
.github/setup-exiftool.sh
.github/setup-unbuffer.sh
fi
if [ "$NOTESTS" != '1' ]
then
.github/setup-webserver.sh
fi
cd phpBB
php ../composer.phar install --dev --no-interaction
if [[ "$PHP_VERSION" =~ ^nightly$ || "$PHP_VERSION" =~ ^8 ]]
then
php ../composer.phar remove phpunit/dbunit --dev --update-with-dependencies \
&& php ../composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs
fi
cd ..

14
.github/setup-unbuffer.sh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
sudo apt-get update
sudo apt-get install -y expect-dev

81
.github/setup-webserver.sh vendored Executable file
View File

@ -0,0 +1,81 @@
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @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
set -x
sudo apt-get update
sudo apt-get install -y nginx coreutils
sudo service nginx stop
DIR=$(dirname "$0")
USER=$(whoami)
PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB")
NGINX_SITE_CONF="/etc/nginx/sites-enabled/default"
NGINX_CONF="/etc/nginx/nginx.conf"
APP_SOCK=$(realpath "$DIR")/php-app.sock
NGINX_PHP_CONF="$DIR/nginx-php.conf"
# php-fpm
PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION"
PHP_FPM_CONF="$DIR/php-fpm.conf"
if [ ! -f $PHP_FPM_BIN ] && [ "$PHP_VERSION" == '8.1' ] && [ -f "/usr/bin/php-fpm" ]
then
PHP_FPM_BIN="/usr/bin/php-fpm"
fi
if [ ! -f $PHP_FPM_BIN ] && [ "$PHP_VERSION" != '8.1' ]
then
sudo apt-get install php$PHP_VERSION-fpm php$PHP_VERSION-cli \
php$PHP_VERSION-curl php$PHP_VERSION-xml php$PHP_VERSION-mbstring \
php$PHP_VERSION-zip php$PHP_VERSION-mysql php$PHP_VERSION-sqlite3 \
php$PHP_VERSION-intl php$PHP_VERSION-gd php$PHP_VERSION-pgsql
sudo service php$PHP_VERSION-fpm start
sudo service php$PHP_VERSION-fpm status
fi
echo "
[global]
[ci]
user = $USER
group = $USER
listen = $APP_SOCK
listen.mode = 0666
pm = static
pm.max_children = 2
php_admin_value[memory_limit] = 128M
" > $PHP_FPM_CONF
sudo $PHP_FPM_BIN \
--fpm-config "$DIR/php-fpm.conf"
# nginx
sudo sed -i "s/user www-data;/user $USER;/g" $NGINX_CONF
sudo cp "$DIR/../phpBB/docs/nginx.sample.conf" "$NGINX_SITE_CONF"
sudo sed -i \
-e "s/example\.com/localhost/g" \
-e "s|root /path/to/phpbb;|root $PHPBB_ROOT_PATH;|g" \
$NGINX_SITE_CONF
# Generate FastCGI configuration for Nginx
echo "
upstream php {
server unix:$APP_SOCK;
}
" > $NGINX_PHP_CONF
sudo mv "$NGINX_PHP_CONF" /etc/nginx/conf.d/php.conf
sudo nginx -T
sudo service nginx start

View File

@ -12,14 +12,67 @@ on:
- master
jobs:
unit-tests:
# Basic checks, e.g. parse errors, commit messages, etc.
basic-checks:
runs-on: ubuntu-18.04
strategy:
matrix:
include:
- php: '7.1'
db: "none"
- db: 'none'
php: '7.1'
NOTESTS: 1
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
steps:
- 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, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '1'
run: |
.github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
- name: Phing sniff
run: |
.github/phing-sniff.sh
- name: Check doctum parse errors
run: |
.github/check-doctum-parse-errors.sh
- name: Check image ICC profiles
run: |
.github/check-image-icc-profiles.sh
- name: Check executable files
run: |
.github/check-executable-files.sh ./
- name: Check commit message
env:
BRANCH: ${{ github.event.pull_request.base.ref }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
if: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.base.ref != '' }}
run: |
git remote set-branches --add origin $BRANCH && git fetch && git-tools/commit-msg-hook-range.sh origin/$BRANCH..$PR_SHA
# Tests for MySQL and MariaDB
mysql-tests:
runs-on: ubuntu-18.04
strategy:
matrix:
include:
- php: '7.1'
db: "mariadb:10.1"
- php: '7.1'
@ -30,20 +83,6 @@ jobs:
db: "mariadb:10.4"
- php: '7.1'
db: "mariadb:10.5"
- php: '7.1'
db: "postgres:9.5"
- php: '7.1'
db: "postgres:9.6"
- php: '7.1'
db: "postgres:10"
- php: '7.1'
db: "postgres:11"
- php: '7.1'
db: "postgres:12"
- php: '7.1'
db: "postgres:13"
- php: '7.1'
db: "sqlite3"
- php: '7.1'
db: "mysql:5.6"
db_alias: "MySQL Slow Tests"
@ -56,12 +95,6 @@ jobs:
db: "mysql:5.6"
- php: '7.1'
db: "mysql:5.7"
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2017-latest"
db_alias: 'MSSQL 2017'
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2019-latest"
db_alias: 'MSSQL 2019'
- php: '7.2'
db: "mysql:5.7"
- php: '7.3'
@ -79,7 +112,7 @@ jobs:
services:
mysql:
image: ${{ matrix.db != 'mysql:5.6' && matrix.db != 'mysql:5.7' && matrix.db != 'mysql:8.0' && matrix.db != 'mariadb:10.1' && matrix.db != 'mariadb:10.2' && matrix.db != 'mariadb:10.3' && matrix.db != 'mariadb:10.4' && matrix.db != 'mariadb:10.5' && 'mysql:5.7' || matrix.db }}
image: ${{ matrix.db }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phpbb_tests
@ -91,6 +124,95 @@ jobs:
--health-timeout=5s
--health-retries=3
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v2
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
db=$(echo "${MATRIX_DB%%:*}")
echo "::set-output name=db::$db"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '0'
run: |
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
run: |
.github/setup-database.sh $DB $MYISAM
- name: Setup LDAP
if: ${{ matrix.SLOWTESTS == 1 }}
run: |
.github/setup-ldap.sh
- name: Lint tests
if: ${{ matrix.SLOWTESTS != 1 && steps.database-type.outputs.db == 'mysql' }}
run: phpBB/vendor/bin/phpunit tests/lint_test.php
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
if: ${{ matrix.SLOWTESTS != 1 && matrix.NOTESTS != 1 }}
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
- name: Slow tests
env:
DB: ${{steps.database-type.outputs.db}}
if: ${{ matrix.SLOWTESTS == 1 }}
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --group slow
# Tests for PostgreSQL
postgres-tests:
runs-on: ubuntu-18.04
strategy:
matrix:
include:
- php: '7.1'
db: "postgres:9.5"
- php: '7.1'
db: "postgres:9.6"
- php: '7.1'
db: "postgres:10"
- php: '7.1'
db: "postgres:11"
- php: '7.1'
db: "postgres:12"
- php: '7.1'
db: "postgres:13"
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
services:
postgres:
image: ${{ matrix.db != 'postgres:9.5' && matrix.db != 'postgres:9.6' && matrix.db != 'postgres:10' && matrix.db != 'postgres:11' && matrix.db != 'postgres:12' && matrix.db != 'postgres:13' && 'postgres:10' || matrix.db }}
env:
@ -106,6 +228,74 @@ jobs:
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v2
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
db=$(echo "${MATRIX_DB%%:*}")
echo "::set-output name=db::$db"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none
- name: Setup environment for phpBB
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '0'
run: |
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
MYISAM: '0'
run: |
.github/setup-database.sh $DB $MYISAM
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error
# Other database types, namely sqlite3 and mssql
other-tests:
runs-on: ubuntu-18.04
strategy:
matrix:
include:
- php: '7.1'
db: "sqlite3"
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2017-latest"
db_alias: 'MSSQL 2017'
- php: '7.2'
db: "mcr.microsoft.com/mssql/server:2019-latest"
db_alias: 'MSSQL 2019'
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
services:
mssql:
image: ${{ matrix.db != 'mcr.microsoft.com/mssql/server:2017-latest' && matrix.db != 'mcr.microsoft.com/mssql/server:2019-latest' && 'mcr.microsoft.com/mssql/server:2017-latest' || matrix.db }}
env:
@ -158,85 +348,19 @@ jobs:
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
MYSQL8: ${{ matrix.db }} == 'mysql:8.0'
NOTESTS: '0'
run: |
travis/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0}
.github/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0}
- name: Setup database
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }}
MYISAM: '0'
run: |
travis/setup-database.sh $DB $PHP_VERSION $NOTESTS $MYISAM
- name: Setup LDAP
env:
SLOWTESTS: ${{ matrix.SLOWTESTS }}
if: ${{ matrix.SLOWTESTS == 1 }}
run: |
travis/setup-ldap.sh $SLOWTESTS
- name: Phing sniff
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
if: ${{ matrix.NOTESTS == 1 }}
run: |
travis/phing-sniff.sh $DB $PHP_VERSION $NOTESTS
- name: Check doctum parse errors
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
if: ${{ matrix.NOTESTS == 1 }}
run: |
travis/check-doctum-parse-errors.sh $DB $PHP_VERSION $NOTESTS
- name: Check image ICC profiles
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
if: ${{ matrix.NOTESTS == 1 }}
run: |
travis/check-image-icc-profiles.sh $DB $PHP_VERSION $NOTESTS
- name: Check executable files
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }}
if: ${{ matrix.NOTESTS == 1 }}
run: |
travis/check-executable-files.sh $DB $PHP_VERSION $NOTESTS ./
- name: Lint tests
if: ${{ matrix.SLOWTESTS != 1 && steps.database-type.outputs.db == 'mysql' }}
run: phpBB/vendor/bin/phpunit tests/lint_test.php
.github/setup-database.sh $DB $MYISAM
- name: Run unit tests
env:
DB: ${{steps.database-type.outputs.db}}
if: ${{ matrix.SLOWTESTS != 1 && matrix.NOTESTS != 1 }}
run: |
phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --verbose --stop-on-error
- name: Slow tests
env:
DB: ${{steps.database-type.outputs.db}}
if: ${{ matrix.SLOWTESTS == 1 }}
run: |
phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow
- name: Check commit message
env:
BRANCH: ${{ github.event.pull_request.base.ref }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
if: ${{ matrix.NOTESTS == 1 && github.event.pull_request.head.sha != '' && github.event.pull_request.base.ref != '' }}
run: |
git remote set-branches --add origin $BRANCH && git fetch && git-tools/commit-msg-hook-range.sh origin/$BRANCH..$PR_SHA
phpBB/vendor/bin/phpunit --configuration .github/phpunit-$DB-github.xml --verbose --stop-on-error