From cbf98a2d7d981c58a61448531c06ca12847e343f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Nov 2020 17:13:30 +0100 Subject: [PATCH 01/28] [ticket/16659] Start setting up test workflow on github actions PHPBB3-16659 --- .github/workflows/tests.yml | 108 ++++++++++++++++++ ...li-travis.xml => phpunit-mysql-travis.xml} | 0 travis/phpunit-postgres-travis.xml | 2 +- 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml rename travis/{phpunit-mysqli-travis.xml => phpunit-mysql-travis.xml} (100%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..4e88c6a958 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,108 @@ +name: Tests + +on: + push: + branches: + - 3.3.x + - master + - task/github-actions + pull_request: + branches: + - 3.3.x + - master + +jobs: + unit-tests: + runs-on: ubuntu-latest + + strategy: + matrix: + php: [7.4, 7.3, 7.2] + db: + - mysql:5.6 + - mysql:5.7 + - mysql:8.0 + - postgres:9.5 + - postgres:9.6 + - postgres:10 + - postgres:11 + - postgres:12 + - postgres:13 + - sqlite3 + + name: PHP${{ matrix.php }} - ${{ matrix.db }} + + services: + mysql: + if: startsWith(${{ matrix.db }}, 'mysql') + image: ${{ matrix.db }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + postgres: + if: startsWith(${{ matrix.db }}, 'postgres') + image: ${{ matrix.db }} + env: + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + + 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 environment for phpBB + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: 0 + MYSQL8: ${{ matrix.db }} == 'mysql:8.0' + run: | + travis/setup-phpbb.sh $DB PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} + + - name: Setup database + env: + DB: ${{steps.database-type.outputs.db}} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: 0 + run: | + travis/setup-database.sh $DB $PHP_VERSION $NOTESTS + + - name: Run unit tests + env: + DB: ${{steps.database-type.outputs.db}} + run: | + phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --verbose --stop-on-error + + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md + + # - name: Run test suite + # run: composer run-script test diff --git a/travis/phpunit-mysqli-travis.xml b/travis/phpunit-mysql-travis.xml similarity index 100% rename from travis/phpunit-mysqli-travis.xml rename to travis/phpunit-mysql-travis.xml diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 3d8376bda1..2648f27bef 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -32,7 +32,7 @@ - + From ba75aa9d0ced6aaab575c2bbff5e5537794326d1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Nov 2020 17:21:08 +0100 Subject: [PATCH 02/28] [ticket/16659] Limit tests to mysql for now PHPBB3-16659 --- .github/workflows/tests.yml | 53 +++++++++++++++++++++---------------- travis/setup-database.sh | 4 +-- travis/setup-phpbb.sh | 5 ---- travis/setup-webserver.sh | 6 ++--- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e88c6a958..6e84061879 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,23 +21,23 @@ jobs: db: - mysql:5.6 - mysql:5.7 - - mysql:8.0 - - postgres:9.5 - - postgres:9.6 - - postgres:10 - - postgres:11 - - postgres:12 - - postgres:13 - - sqlite3 +# - mysql:8.0 +# - postgres:9.5 +# - postgres:9.6 +# - postgres:10 +# - postgres:11 +# - postgres:12 +# - postgres:13 +# - sqlite3 name: PHP${{ matrix.php }} - ${{ matrix.db }} services: mysql: - if: startsWith(${{ matrix.db }}, 'mysql') image: ${{ matrix.db }} env: MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: phpbb_tests ports: - 3306:3306 options: >- @@ -46,18 +46,18 @@ jobs: --health-timeout=5s --health-retries=3 - postgres: - if: startsWith(${{ matrix.db }}, 'postgres') - image: ${{ matrix.db }} - env: - POSTGRES_PASSWORD: postgres - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 +# postgres: +# if: startsWith(${{ matrix.db }}, 'postgres') +# image: ${{ matrix.db }} +# env: +# POSTGRES_PASSWORD: postgres +# ports: +# - 5432:5432 +# options: >- +# --health-cmd pg_isready +# --health-interval 10s +# --health-timeout 5s +# --health-retries 5 redis: image: redis options: >- @@ -78,14 +78,21 @@ jobs: db=$(echo "${MATRIX_DB%%:*}") echo "::set-output name=db::$db" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extension: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, pdo_mysqli, intl, gd, exif, iconv + coverage: none + - name: Setup environment for phpBB env: DB: ${{steps.database-type.outputs.db}} - PHP_VERSION: ${{ matrix.php }} + CI_PHP_VERSION: ${{ matrix.php }} NOTESTS: 0 MYSQL8: ${{ matrix.db }} == 'mysql:8.0' run: | - travis/setup-phpbb.sh $DB PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} + travis/setup-phpbb.sh $DB CI_PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} - name: Setup database env: diff --git a/travis/setup-database.sh b/travis/setup-database.sh index b581ddfccb..602d55678e 100755 --- a/travis/setup-database.sh +++ b/travis/setup-database.sh @@ -26,12 +26,12 @@ then psql -c 'create database phpbb_tests;' -U postgres fi -if [ "$TRAVIS_PHP_VERSION" == "5.6" -a "$DB" == "mysqli" ] +if [ "$TRAVIS_PHP_VERSION" == "5.6" -a "$DB" == "mysql" ] then mysql -e 'SET GLOBAL storage_engine=MyISAM;' fi -if [ "$DB" == "mysqli" -o "$DB" == "mariadb" ] +if [ "$DB" == "mariadb" ] then mysql -e 'create database IF NOT EXISTS phpbb_tests;' fi diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index 208b715dfe..7c089d76db 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -32,11 +32,6 @@ then travis/setup-mysql8.sh fi -if [ "$NOTESTS" != '1' ] -then - travis/setup-php-extensions.sh -fi - if [ "$NOTESTS" != '1' ] then travis/setup-webserver.sh diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 68bcd6ac00..35cdb0ebf4 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -12,7 +12,7 @@ set -e set -x sudo apt-get update -sudo apt-get install -y nginx realpath +sudo apt-get install -y nginx coreutils sudo service nginx stop @@ -25,13 +25,13 @@ APP_SOCK=$(realpath "$DIR")/php-app.sock NGINX_PHP_CONF="$DIR/nginx-php.conf" # php-fpm -PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" +PHP_FPM_BIN="/usr/sbin/php-fpm$CI_PHP_VERSION" PHP_FPM_CONF="$DIR/php-fpm.conf" echo " [global] - [travis] + [ci] user = $USER group = $USER listen = $APP_SOCK From 1710a38ced5d58bea7f57a521ae42208744e46a6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Nov 2020 21:37:25 +0100 Subject: [PATCH 03/28] [ticket/16659] Add postgres tests PHPBB3-16659 --- .github/workflows/tests.yml | 85 +++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6e84061879..0abe850093 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,27 +14,52 @@ on: jobs: unit-tests: runs-on: ubuntu-latest - strategy: matrix: - php: [7.4, 7.3, 7.2] - db: - - mysql:5.6 - - mysql:5.7 -# - mysql:8.0 -# - postgres:9.5 -# - postgres:9.6 -# - postgres:10 -# - postgres:11 -# - postgres:12 -# - postgres:13 -# - sqlite3 + include: +# - php: 7.1 +# db: "none" +# NOTESTS: 1 +# - php: 7.1 +# db: "mariadb:10.1" +# - php: 7.1 +# db: "mariadb:10.2" +# - php: 7.1 +# db: "mariadb:10.3" +# - php: 7.1 +# db: "mariadb:10.4" +# - php: 7.1 +# db: "mariadb:10.5" +# - php: 7.1 +# db: "postgres:9.5" + - 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" + - php: 7.1 + db: "mysql:5.7" +# - php: 7.1 +# db: "mysql:8.0" +# - php: 7.2 +# db: "mysql:5.7" +# - php: 7.3 +# db: "mysql:5.7" +# - php: 7.4 +# db: "mysql:5.7" - name: PHP${{ matrix.php }} - ${{ matrix.db }} + name: PHP ${{ matrix.php }} - ${{ matrix.db }} services: mysql: - image: ${{ matrix.db }} + image: ${{ matrix.db != 'mysql:5.6' && matrix.db != 'mysql:5.7' && matrix.db != 'mysql:8.0' && 'mysql:5.7' || matrix.db }} env: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_DATABASE: phpbb_tests @@ -46,18 +71,20 @@ jobs: --health-timeout=5s --health-retries=3 -# postgres: -# if: startsWith(${{ matrix.db }}, 'postgres') -# image: ${{ matrix.db }} -# env: -# POSTGRES_PASSWORD: postgres -# ports: -# - 5432:5432 -# options: >- -# --health-cmd pg_isready -# --health-interval 10s -# --health-timeout 5s -# --health-retries 5 + 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: + POSTGRES_HOST: localhost + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + -v /var/run/postgresql:/var/run/postgresql + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 redis: image: redis options: >- @@ -65,6 +92,8 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + ports: + - 6379:6379 steps: @@ -82,7 +111,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extension: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, pdo_mysqli, intl, gd, exif, iconv + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, pdo_mysqli, intl, gd, exif, iconv coverage: none - name: Setup environment for phpBB From d76488839322f3f9eae58e35db2d1e212c24f6cb Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 1 Dec 2020 20:52:23 +0100 Subject: [PATCH 04/28] [ticket/16659] Enable sqlite3 tests PHPBB3-16659 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0abe850093..8f255147c5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,8 +40,8 @@ jobs: # db: "postgres:12" # - php: 7.1 # db: "postgres:13" -# - php: 7.1 -# db: "sqlite3" + - php: 7.1 + db: "sqlite3" - php: 7.1 db: "mysql:5.6" - php: 7.1 From 5cbe25d415224b414e5c9211707e823d569a8d96 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 1 Dec 2020 21:28:12 +0100 Subject: [PATCH 05/28] [ticket/16659] Enable mariadb tests PHPBB3-16659 --- .github/workflows/tests.yml | 6 +++--- travis/setup-phpbb.sh | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f255147c5..39b04bb9fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,8 +24,8 @@ jobs: # db: "mariadb:10.1" # - php: 7.1 # db: "mariadb:10.2" -# - php: 7.1 -# db: "mariadb:10.3" + - php: 7.1 + db: "mariadb:10.3" # - php: 7.1 # db: "mariadb:10.4" # - php: 7.1 @@ -59,7 +59,7 @@ jobs: services: mysql: - image: ${{ matrix.db != 'mysql:5.6' && matrix.db != 'mysql:5.7' && matrix.db != 'mysql:8.0' && 'mysql:5.7' || matrix.db }} + 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 }} env: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_DATABASE: phpbb_tests diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index 7c089d76db..a6e51b5ed9 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -22,11 +22,6 @@ then travis/setup-unbuffer.sh fi -if [ "$DB" == "mariadb" ] -then - travis/setup-mariadb.sh -fi - if [ "$MYSQL8" == '1' ] then travis/setup-mysql8.sh From 2cdebe57afa2fed5153a3f782a5cfd6053a83f49 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 2 Dec 2020 16:25:42 +0100 Subject: [PATCH 06/28] [ticket/16659] Use volume for /var/run/mysqld PHPBB3-16659 --- .github/workflows/tests.yml | 1 + travis/setup-phpbb.sh | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39b04bb9fd..46cd9cb718 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -66,6 +66,7 @@ jobs: ports: - 3306:3306 options: >- + -v /srv/docker/sockets/mariadb:/var/run/mysqld --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index a6e51b5ed9..9bf19242ca 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -22,6 +22,15 @@ then travis/setup-unbuffer.sh fi +if [ "$DB" == "mariadb" ] +then + ls -l /var/run | grep -i mysqld + + if [ ! -f "/var/run/mysqld/mysqld.sock" ]; then + ln -s /srv/docker/sockets/mariadb/mysqld.sock /var/run/mysqld/mysqld.sock + fi +fi + if [ "$MYSQL8" == '1' ] then travis/setup-mysql8.sh From 5b82ca23d3c15a534d3a48d4e4fbbc036416b865 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2020 17:21:53 +0100 Subject: [PATCH 07/28] [ticket/16659] Remove special definitions for mariadb setup PHPBB3-16659 --- .github/workflows/tests.yml | 1 - travis/setup-database.sh | 5 ----- travis/setup-phpbb.sh | 9 --------- 3 files changed, 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 46cd9cb718..39b04bb9fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -66,7 +66,6 @@ jobs: ports: - 3306:3306 options: >- - -v /srv/docker/sockets/mariadb:/var/run/mysqld --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s diff --git a/travis/setup-database.sh b/travis/setup-database.sh index 602d55678e..0a4085158d 100755 --- a/travis/setup-database.sh +++ b/travis/setup-database.sh @@ -30,8 +30,3 @@ if [ "$TRAVIS_PHP_VERSION" == "5.6" -a "$DB" == "mysql" ] then mysql -e 'SET GLOBAL storage_engine=MyISAM;' fi - -if [ "$DB" == "mariadb" ] -then - mysql -e 'create database IF NOT EXISTS phpbb_tests;' -fi diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index 9bf19242ca..a6e51b5ed9 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -22,15 +22,6 @@ then travis/setup-unbuffer.sh fi -if [ "$DB" == "mariadb" ] -then - ls -l /var/run | grep -i mysqld - - if [ ! -f "/var/run/mysqld/mysqld.sock" ]; then - ln -s /srv/docker/sockets/mariadb/mysqld.sock /var/run/mysqld/mysqld.sock - fi -fi - if [ "$MYSQL8" == '1' ] then travis/setup-mysql8.sh From 1e985dc4f014802157e3ba1da2c6313cf51d975d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2020 17:49:06 +0100 Subject: [PATCH 08/28] [ticket/16659] Add PHP 8.0 and notests run PHPBB3-16659 --- .github/workflows/tests.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39b04bb9fd..6747e9f5db 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,9 +17,9 @@ jobs: strategy: matrix: include: -# - php: 7.1 -# db: "none" -# NOTESTS: 1 + - php: 7.1 + db: "none" + NOTESTS: 1 # - php: 7.1 # db: "mariadb:10.1" # - php: 7.1 @@ -46,14 +46,16 @@ jobs: db: "mysql:5.6" - php: 7.1 db: "mysql:5.7" -# - php: 7.1 -# db: "mysql:8.0" + - php: 7.1 + db: "mysql:8.0" # - php: 7.2 # db: "mysql:5.7" # - php: 7.3 # db: "mysql:5.7" # - php: 7.4 # db: "mysql:5.7" + - php: 8.0 + db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db }} From 0907087ee310db720e7e3595a518b584e5b2d584 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2020 21:05:09 +0100 Subject: [PATCH 09/28] [ticket/16659] Add steps for notests run PHPBB3-16659 --- .github/workflows/tests.yml | 82 +++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6747e9f5db..26c4cd1f44 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,38 +24,38 @@ jobs: # db: "mariadb:10.1" # - php: 7.1 # db: "mariadb:10.2" - - php: 7.1 - db: "mariadb:10.3" +# - php: 7.1 +# db: "mariadb:10.3" # - php: 7.1 # db: "mariadb:10.4" # - php: 7.1 # db: "mariadb:10.5" # - php: 7.1 # db: "postgres:9.5" - - php: 7.1 - db: "postgres:10" +# - 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" - - php: 7.1 - db: "mysql:5.7" - - php: 7.1 - db: "mysql:8.0" +# - php: 7.1 +# db: "sqlite3" +# - php: 7.1 +# db: "mysql:5.6" +# - php: 7.1 +# db: "mysql:5.7" +# - php: 7.1 +# db: "mysql:8.0" # - php: 7.2 # db: "mysql:5.7" # - php: 7.3 # db: "mysql:5.7" # - php: 7.4 # db: "mysql:5.7" - - php: 8.0 - db: "mysql:5.7" +# - php: 8.0 +# db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db }} @@ -120,7 +120,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} CI_PHP_VERSION: ${{ matrix.php }} - NOTESTS: 0 + NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} MYSQL8: ${{ matrix.db }} == 'mysql:8.0' run: | travis/setup-phpbb.sh $DB CI_PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} @@ -129,16 +129,66 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: 0 + NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} run: | travis/setup-database.sh $DB $PHP_VERSION $NOTESTS + - 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 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-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 + - 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 + + # @todo: Add commit message check + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" # Docs: https://getcomposer.org/doc/articles/scripts.md From c22cacf9bd8749320c0f82e8b80dbcd98bd2d8f9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2020 21:09:27 +0100 Subject: [PATCH 10/28] [ticket/16659] Test with PHP 8 PHPBB3-16659 --- .github/workflows/tests.yml | 26 +++++++++++++------------- travis/setup-webserver.sh | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26c4cd1f44..5948236511 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,8 +20,8 @@ jobs: - php: 7.1 db: "none" NOTESTS: 1 -# - php: 7.1 -# db: "mariadb:10.1" + - php: 7.1 + db: "mariadb:10.1" # - php: 7.1 # db: "mariadb:10.2" # - php: 7.1 @@ -54,8 +54,8 @@ jobs: # db: "mysql:5.7" # - php: 7.4 # db: "mysql:5.7" -# - php: 8.0 -# db: "mysql:5.7" + - php: '8.0' + db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db }} @@ -119,17 +119,17 @@ jobs: - name: Setup environment for phpBB env: DB: ${{steps.database-type.outputs.db}} - CI_PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + PHP_VERSION: ${{ matrix.php }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} MYSQL8: ${{ matrix.db }} == 'mysql:8.0' run: | - travis/setup-phpbb.sh $DB CI_PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} + travis/setup-phpbb.sh $DB $PHP_VERSION ${NOTESTS:-0} ${MYSQL8:-0} - name: Setup database env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} run: | travis/setup-database.sh $DB $PHP_VERSION $NOTESTS @@ -137,7 +137,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} if: ${{ matrix.NOTESTS == 1 }} run: | travis/phing-sniff.sh $DB $PHP_VERSION $NOTESTS @@ -146,7 +146,7 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} if: ${{ matrix.NOTESTS == 1 }} run: | travis/check-doctum-parse-errors.sh $DB $PHP_VERSION $NOTESTS @@ -155,16 +155,16 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} if: ${{ matrix.NOTESTS == 1 }} run: | travis/check-image-icc-profiles.sh $DB $PHP_VERSION $NOTESTS - - name: Check image ICC profiles + - name: Check executable files env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - NOTESTS: ${{ matrix.NOTESTS != 1 && 0 || 1 }} + NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} if: ${{ matrix.NOTESTS == 1 }} run: | travis/check-executable-files.sh $DB $PHP_VERSION $NOTESTS ./ diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 35cdb0ebf4..68053c1f7a 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -25,7 +25,7 @@ APP_SOCK=$(realpath "$DIR")/php-app.sock NGINX_PHP_CONF="$DIR/nginx-php.conf" # php-fpm -PHP_FPM_BIN="/usr/sbin/php-fpm$CI_PHP_VERSION" +PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION" PHP_FPM_CONF="$DIR/php-fpm.conf" echo " From bb020c3e6be7fa6910ed33045b5983c7e9f91187 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Dec 2020 11:24:10 +0100 Subject: [PATCH 11/28] [ticket/16659] Make sure php-fpm is installed PHPBB3-16659 --- .github/workflows/tests.yml | 2 +- travis/setup-webserver.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5948236511..0c223d0fb3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -113,7 +113,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, pdo_mysqli, intl, gd, exif, iconv + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv coverage: none - name: Setup environment for phpBB diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index 68053c1f7a..ea903ae1fe 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -28,6 +28,16 @@ NGINX_PHP_CONF="$DIR/nginx-php.conf" PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION" PHP_FPM_CONF="$DIR/php-fpm.conf" +if [ ! -f $PHP_FPM_BIN ] +then + sudo apt-get install php$PHP_VERSION-fpm php$PHP_VERSION-cli php$PHP_VERSION-dom \ + 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] From 4729be9e96755b11ec6ed36ad30b257d7e597378 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Dec 2020 13:46:22 +0100 Subject: [PATCH 12/28] [ticket/16659] Add builds for MySQL 8 and PHP 8.1 PHPBB3-16659 --- .github/workflows/tests.yml | 6 ++++-- travis/setup-webserver.sh | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0c223d0fb3..93d5fd4026 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,16 +46,18 @@ jobs: # db: "mysql:5.6" # - php: 7.1 # db: "mysql:5.7" -# - php: 7.1 -# db: "mysql:8.0" # - php: 7.2 # db: "mysql:5.7" # - php: 7.3 # db: "mysql:5.7" # - php: 7.4 # db: "mysql:5.7" + - php: 7.4 + db: "mysql:8.0" - php: '8.0' db: "mysql:5.7" + - php: '8.1' + db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db }} diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index ea903ae1fe..af6fccfe53 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -28,7 +28,12 @@ NGINX_PHP_CONF="$DIR/nginx-php.conf" PHP_FPM_BIN="/usr/sbin/php-fpm$PHP_VERSION" PHP_FPM_CONF="$DIR/php-fpm.conf" -if [ ! -f $PHP_FPM_BIN ] +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-dom \ php$PHP_VERSION-curl php$PHP_VERSION-xml php$PHP_VERSION-mbstring \ From d6e1989e1f7dba95b36244099cf07ca2767f9e4a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Dec 2020 14:50:46 +0100 Subject: [PATCH 13/28] [ticket/16659] First test run with all current tests PHPBB3-16659 --- .github/workflows/tests.yml | 70 +++++++++++++++++++------------------ travis/setup-database.sh | 5 +-- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 93d5fd4026..2c50ded105 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,42 +17,43 @@ jobs: strategy: matrix: include: - - php: 7.1 + - php: '7.1' db: "none" NOTESTS: 1 - - php: 7.1 + - php: '7.1' db: "mariadb:10.1" -# - php: 7.1 -# db: "mariadb:10.2" -# - php: 7.1 -# db: "mariadb:10.3" -# - php: 7.1 -# db: "mariadb:10.4" -# - php: 7.1 -# db: "mariadb:10.5" -# - php: 7.1 -# db: "postgres:9.5" -# - 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" -# - php: 7.1 -# db: "mysql:5.7" -# - php: 7.2 -# db: "mysql:5.7" -# - php: 7.3 -# db: "mysql:5.7" -# - php: 7.4 -# db: "mysql:5.7" - - php: 7.4 + - php: '7.1' + db: "mariadb:10.2" + - php: '7.1' + db: "mariadb:10.3" + - php: '7.1' + db: "mariadb:10.4" + - php: '7.1' + db: "mariadb:10.5" + - php: '7.1' + db: "postgres:9.5" + - 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" + MYISAM: 1 + - php: '7.1' + db: "mysql:5.7" + - php: '7.2' + db: "mysql:5.7" + - php: '7.3' + db: "mysql:5.7" + - php: '7.4' + db: "mysql:5.7" + - php: '7.4' db: "mysql:8.0" - php: '8.0' db: "mysql:5.7" @@ -132,8 +133,9 @@ jobs: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} NOTESTS: ${{ matrix.NOTESTS != 1 && '0' || '1' }} + MYISAM: ${{ matrix.MYISAM != 1 && '0' || '1' }} run: | - travis/setup-database.sh $DB $PHP_VERSION $NOTESTS + travis/setup-database.sh $DB $PHP_VERSION $NOTESTS $MYISAM - name: Phing sniff env: diff --git a/travis/setup-database.sh b/travis/setup-database.sh index 0a4085158d..479e17f592 100755 --- a/travis/setup-database.sh +++ b/travis/setup-database.sh @@ -14,6 +14,7 @@ set -x DB=$1 TRAVIS_PHP_VERSION=$2 NOTESTS=$3 +MYISAM=$4 if [ "$NOTESTS" == '1' ] then @@ -26,7 +27,7 @@ then psql -c 'create database phpbb_tests;' -U postgres fi -if [ "$TRAVIS_PHP_VERSION" == "5.6" -a "$DB" == "mysql" ] +if [ "$MYISAM" == '1' ] then - mysql -e 'SET GLOBAL storage_engine=MyISAM;' + mysql -h 127.0.0.1 -u root -e 'SET GLOBAL storage_engine=MyISAM;' fi From 4f282db6e20e1f9d773bdb53ff9794a271584086 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Dec 2020 14:23:18 +0100 Subject: [PATCH 14/28] [ticket/16659] Resolve issues with fulltext search in mariadb PHPBB3-16659 --- tests/functional/search/mysql_test.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/functional/search/mysql_test.php b/tests/functional/search/mysql_test.php index a97b12e905..f7e6cbf5f1 100644 --- a/tests/functional/search/mysql_test.php +++ b/tests/functional/search/mysql_test.php @@ -20,4 +20,17 @@ class phpbb_functional_search_mysql_test extends phpbb_functional_search_base { protected $search_backend = '\phpbb\search\fulltext_mysql'; + protected function create_search_index($backend = null) + { + parent::create_search_index($backend); + + // Try optimizing posts table after creating search index. + // Some versions of MariaDB might not return any results in the search + // until the table has been optimized or the index deleted and re-created. + $db = $this->get_db(); + $db->sql_return_on_error(true); + $sql = 'OPTIMIZE TABLE ' . POSTS_TABLE; + $db->sql_query($sql); + $db->sql_return_on_error(false); + } } From 6c9ecf1cc88b08d969d4b42bc9acc124e9344691 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Dec 2020 17:30:36 +0100 Subject: [PATCH 15/28] [ticket/16659] Add tests for MSSQL PHPBB3-16659 --- .github/workflows/tests.yml | 110 +++++++++++++++++++------------- travis/phpunit-mssql-travis.xml | 41 ++++++++++++ 2 files changed, 107 insertions(+), 44 deletions(-) create mode 100644 travis/phpunit-mssql-travis.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2c50ded105..fe2dc6cea2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,52 +13,54 @@ on: jobs: unit-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: include: - - php: '7.1' - db: "none" - NOTESTS: 1 - - php: '7.1' - db: "mariadb:10.1" - - php: '7.1' - db: "mariadb:10.2" - - php: '7.1' - db: "mariadb:10.3" - - php: '7.1' - db: "mariadb:10.4" - - php: '7.1' - db: "mariadb:10.5" - - php: '7.1' - db: "postgres:9.5" - - 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" - MYISAM: 1 - - php: '7.1' - db: "mysql:5.7" +# - php: '7.1' +# db: "none" +# NOTESTS: 1 +# - php: '7.1' +# db: "mariadb:10.1" +# - php: '7.1' +# db: "mariadb:10.2" +# - php: '7.1' +# db: "mariadb:10.3" +# - php: '7.1' +# db: "mariadb:10.4" +# - php: '7.1' +# db: "mariadb:10.5" +# - php: '7.1' +# db: "postgres:9.5" +# - 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" +# MYISAM: 1 +# - php: '7.1' +# db: "mysql:5.7" - php: '7.2' - db: "mysql:5.7" - - php: '7.3' - db: "mysql:5.7" - - php: '7.4' - db: "mysql:5.7" - - php: '7.4' - db: "mysql:8.0" - - php: '8.0' - db: "mysql:5.7" - - php: '8.1' - db: "mysql:5.7" + db: "mcr.microsoft.com/mssql/server:2017-latest" +# - php: '7.2' +# db: "mysql:5.7" +# - php: '7.3' +# db: "mysql:5.7" +# - php: '7.4' +# db: "mysql:5.7" +# - php: '7.4' +# db: "mysql:8.0" +# - php: '8.0' +# db: "mysql:5.7" +# - php: '8.1' +# db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db }} @@ -90,6 +92,21 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + + 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: + SA_PASSWORD: "Pssw0rd_12" + ACCEPT_EULA: "y" + ports: + - 1433:1433 + options: >- + --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Pssw0rd_12' -Q \"Use [master]; CREATE DATABASE [phpbb_tests] COLLATE Latin1_General_CI_AS\" || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + --health-start-period 10s + redis: image: redis options: >- @@ -109,14 +126,19 @@ jobs: env: MATRIX_DB: ${{ matrix.db }} run: | - db=$(echo "${MATRIX_DB%%:*}") + if [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2017-latest' ] || [ $MATRIX_DB == 'mcr.microsoft.com/mssql/server:2019-latest' ] + then + db='mssql' + else + db=$(echo "${MATRIX_DB%%:*}") + fi 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 + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv coverage: none - name: Setup environment for phpBB diff --git a/travis/phpunit-mssql-travis.xml b/travis/phpunit-mssql-travis.xml new file mode 100644 index 0000000000..37c1deae2d --- /dev/null +++ b/travis/phpunit-mssql-travis.xml @@ -0,0 +1,41 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + From e2f21b3dd3246ce9d85f185ca235952a46eb69a1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 15 Dec 2020 22:10:08 +0100 Subject: [PATCH 16/28] [ticket/16659] Use matrix db alias for MSSQL builds PHPBB3-16659 --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fe2dc6cea2..54b5952a3d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,6 +49,7 @@ jobs: # db: "mysql:5.7" - php: '7.2' db: "mcr.microsoft.com/mssql/server:2017-latest" + db_alias: 'MSSQL 2017' # - php: '7.2' # db: "mysql:5.7" # - php: '7.3' @@ -62,7 +63,7 @@ jobs: # - php: '8.1' # db: "mysql:5.7" - name: PHP ${{ matrix.php }} - ${{ matrix.db }} + name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }} services: mysql: From bff3c7c7affa4b98e229711b65573e25521c31cd Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 15 Dec 2020 22:18:21 +0100 Subject: [PATCH 17/28] [ticket/16659] Add slow tests PHPBB3-16659 --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 54b5952a3d..6a7a470f65 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,6 +42,9 @@ jobs: # db: "postgres:13" # - php: '7.1' # db: "sqlite3" + - php: '7.1' + db: "mysql:5.6" + SLOWTESTS: 1 # - php: '7.1' # db: "mysql:5.6" # MYISAM: 1 From c2c2c3f62bad1aef406d037dbfe59f1cc90b225f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 15 Dec 2020 22:33:18 +0100 Subject: [PATCH 18/28] [ticket/16659] Add commit message check PHPBB3-16659 --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a7a470f65..574724383d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -217,6 +217,13 @@ jobs: 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 # @todo: Add commit message check # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" From 67da9e0e85dd7880b2a0a1357f3dd0b09c383d39 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 15 Dec 2020 22:45:18 +0100 Subject: [PATCH 19/28] [ticket/16659] Add setup script for LDAP PHPBB3-16659 --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 574724383d..210203e640 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -163,6 +163,13 @@ jobs: 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}} From 2a1a22dffe7ad00f76015c2d903809197d0b81b0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 16 Dec 2020 16:51:46 +0100 Subject: [PATCH 20/28] [ticket/16659] Adjust slapd setup for apparmor configuration PHPBB3-16659 --- .github/workflows/tests.yml | 2 +- travis/ldap/slapd.conf | 6 +++--- travis/setup-ldap.sh | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 210203e640..88ac480518 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -142,7 +142,7 @@ jobs: 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 + 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 diff --git a/travis/ldap/slapd.conf b/travis/ldap/slapd.conf index 5fce95cee2..9f6aa980f7 100644 --- a/travis/ldap/slapd.conf +++ b/travis/ldap/slapd.conf @@ -4,13 +4,13 @@ include /etc/ldap/schema/cosine.schema include /etc/ldap/schema/inetorgperson.schema include /etc/ldap/schema/nis.schema -pidfile /tmp/slapd/slapd.pid -argsfile /tmp/slapd/slapd.args +pidfile /var/tmp/slapd/slapd.pid +argsfile /var/tmp/slapd/slapd.args modulepath /usr/lib/openldap database ldif -directory /tmp/slapd +directory /var/tmp/slapd suffix "dc=example,dc=com" rootdn "cn=admin,dc=example,dc=com" diff --git a/travis/setup-ldap.sh b/travis/setup-ldap.sh index 9be816d77d..a5cbd3c0e1 100755 --- a/travis/setup-ldap.sh +++ b/travis/setup-ldap.sh @@ -15,9 +15,10 @@ SLOWTESTS=$1 if [ "$SLOWTESTS" == '1' ] then - sudo apt-get -y install ldap-utils slapd php-ldap - mkdir /tmp/slapd - slapd -f travis/ldap/slapd.conf -h ldap://localhost:3389 & + sudo apt-get -y install ldap-utils slapd + mkdir /var/tmp/slapd + cp travis/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 travis/ldap/base.ldif fi From e0c5c0047d423d8d555b7cabf00b81ea85513b28 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 16 Dec 2020 17:41:26 +0100 Subject: [PATCH 21/28] [ticket/16659] Enable notests tests with commit message check PHPBB3-16659 --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 88ac480518..1efaf77148 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,9 +17,9 @@ jobs: strategy: matrix: include: -# - php: '7.1' -# db: "none" -# NOTESTS: 1 + - php: '7.1' + db: "none" + NOTESTS: 1 # - php: '7.1' # db: "mariadb:10.1" # - php: '7.1' From 452f2cd08607de5345e5bb6504d1cb28935b205a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 16 Dec 2020 17:48:55 +0100 Subject: [PATCH 22/28] [ticket/16659] Enable all items in build matrix PHPBB3-16659 --- .github/workflows/tests.yml | 88 ++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1efaf77148..e01cddfdf4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,51 +20,54 @@ jobs: - php: '7.1' db: "none" NOTESTS: 1 -# - php: '7.1' -# db: "mariadb:10.1" -# - php: '7.1' -# db: "mariadb:10.2" -# - php: '7.1' -# db: "mariadb:10.3" -# - php: '7.1' -# db: "mariadb:10.4" -# - php: '7.1' -# db: "mariadb:10.5" -# - php: '7.1' -# db: "postgres:9.5" -# - 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: "mariadb:10.1" + - php: '7.1' + db: "mariadb:10.2" + - php: '7.1' + db: "mariadb:10.3" + - php: '7.1' + db: "mariadb:10.4" + - php: '7.1' + db: "mariadb:10.5" + - php: '7.1' + db: "postgres:9.5" + - 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" SLOWTESTS: 1 -# - php: '7.1' -# db: "mysql:5.6" -# MYISAM: 1 -# - php: '7.1' -# db: "mysql:5.7" + - php: '7.1' + db: "mysql:5.6" + MYISAM: 1 + - 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: "mysql:5.7" -# - php: '7.3' -# db: "mysql:5.7" -# - php: '7.4' -# db: "mysql:5.7" -# - php: '7.4' -# db: "mysql:8.0" -# - php: '8.0' -# db: "mysql:5.7" -# - php: '8.1' -# db: "mysql:5.7" + - 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' + db: "mysql:5.7" + - php: '7.4' + db: "mysql:5.7" + - php: '7.4' + db: "mysql:8.0" + - php: '8.0' + db: "mysql:5.7" + - php: '8.1' + db: "mysql:5.7" name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }} @@ -231,10 +234,3 @@ jobs: 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 - # @todo: Add commit message check - - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md - - # - name: Run test suite - # run: composer run-script test From b3e3d9642e1df3169079562a5adb2f0d1f6e57da Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 16 Dec 2020 20:01:34 +0100 Subject: [PATCH 23/28] [ticket/16659] Add missing postgres test and improve naming PHPBB3-16659 --- .github/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e01cddfdf4..c976ffa360 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,6 +32,8 @@ jobs: 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' @@ -44,10 +46,14 @@ jobs: db: "sqlite3" - php: '7.1' db: "mysql:5.6" + db_alias: "MySQL Slow Tests" SLOWTESTS: 1 - php: '7.1' db: "mysql:5.6" + db_alias: "MyISAM Tests" MYISAM: 1 + - php: '7.1' + db: "mysql:5.6" - php: '7.1' db: "mysql:5.7" - php: '7.2' From ef22a029b25e0bf986c9fccc2c83cef665a1dfbf Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 16 Dec 2020 21:46:57 +0100 Subject: [PATCH 24/28] [ticket/16659] Split up tests for each database type PHPBB3-16659 --- .github/check-doctum-parse-errors.sh | 26 +++ .github/check-executable-files.sh | 63 ++++++ .github/check-image-icc-profiles.sh | 14 ++ .github/ldap/base.ldif | 41 ++++ .github/ldap/slapd.conf | 17 ++ .github/phing-sniff.sh | 16 ++ .github/phpunit-mariadb-github.xml | 39 ++++ .github/phpunit-mssql-github.xml | 41 ++++ .github/phpunit-mysql-github.xml | 41 ++++ .github/phpunit-postgres-github.xml | 41 ++++ .github/phpunit-sqlite3-github.xml | 41 ++++ .github/setup-database.sh | 26 +++ .github/setup-exiftool.sh | 14 ++ .github/setup-ldap.sh | 19 ++ .github/setup-phpbb.sh | 36 +++ .github/setup-unbuffer.sh | 14 ++ .github/setup-webserver.sh | 81 +++++++ .github/workflows/tests.yml | 314 +++++++++++++++++++-------- 18 files changed, 789 insertions(+), 95 deletions(-) create mode 100755 .github/check-doctum-parse-errors.sh create mode 100755 .github/check-executable-files.sh create mode 100755 .github/check-image-icc-profiles.sh create mode 100644 .github/ldap/base.ldif create mode 100644 .github/ldap/slapd.conf create mode 100755 .github/phing-sniff.sh create mode 100644 .github/phpunit-mariadb-github.xml create mode 100644 .github/phpunit-mssql-github.xml create mode 100644 .github/phpunit-mysql-github.xml create mode 100644 .github/phpunit-postgres-github.xml create mode 100644 .github/phpunit-sqlite3-github.xml create mode 100755 .github/setup-database.sh create mode 100755 .github/setup-exiftool.sh create mode 100755 .github/setup-ldap.sh create mode 100755 .github/setup-phpbb.sh create mode 100755 .github/setup-unbuffer.sh create mode 100755 .github/setup-webserver.sh diff --git a/.github/check-doctum-parse-errors.sh b/.github/check-doctum-parse-errors.sh new file mode 100755 index 0000000000..86abe86b36 --- /dev/null +++ b/.github/check-doctum-parse-errors.sh @@ -0,0 +1,26 @@ +#!/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 + +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 diff --git a/.github/check-executable-files.sh b/.github/check-executable-files.sh new file mode 100755 index 0000000000..d9d0800f00 --- /dev/null +++ b/.github/check-executable-files.sh @@ -0,0 +1,63 @@ +#!/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" +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 diff --git a/.github/check-image-icc-profiles.sh b/.github/check-image-icc-profiles.sh new file mode 100755 index 0000000000..d0444dc7f5 --- /dev/null +++ b/.github/check-image-icc-profiles.sh @@ -0,0 +1,14 @@ +#!/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 + +find . -type f -a -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' -a -not -wholename '*vendor/*' | \ + parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}' diff --git a/.github/ldap/base.ldif b/.github/ldap/base.ldif new file mode 100644 index 0000000000..09fe7cecc6 --- /dev/null +++ b/.github/ldap/base.ldif @@ -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 diff --git a/.github/ldap/slapd.conf b/.github/ldap/slapd.conf new file mode 100644 index 0000000000..9f6aa980f7 --- /dev/null +++ b/.github/ldap/slapd.conf @@ -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 diff --git a/.github/phing-sniff.sh b/.github/phing-sniff.sh new file mode 100755 index 0000000000..7e1595c385 --- /dev/null +++ b/.github/phing-sniff.sh @@ -0,0 +1,16 @@ +#!/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 +set -x + +cd build +../phpBB/vendor/bin/phing sniff +cd .. diff --git a/.github/phpunit-mariadb-github.xml b/.github/phpunit-mariadb-github.xml new file mode 100644 index 0000000000..74b3b85483 --- /dev/null +++ b/.github/phpunit-mariadb-github.xml @@ -0,0 +1,39 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + diff --git a/.github/phpunit-mssql-github.xml b/.github/phpunit-mssql-github.xml new file mode 100644 index 0000000000..37c1deae2d --- /dev/null +++ b/.github/phpunit-mssql-github.xml @@ -0,0 +1,41 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + diff --git a/.github/phpunit-mysql-github.xml b/.github/phpunit-mysql-github.xml new file mode 100644 index 0000000000..d14359d618 --- /dev/null +++ b/.github/phpunit-mysql-github.xml @@ -0,0 +1,41 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + diff --git a/.github/phpunit-postgres-github.xml b/.github/phpunit-postgres-github.xml new file mode 100644 index 0000000000..2648f27bef --- /dev/null +++ b/.github/phpunit-postgres-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 new file mode 100644 index 0000000000..f5b2b67b22 --- /dev/null +++ b/.github/phpunit-sqlite3-github.xml @@ -0,0 +1,41 @@ + + + + + ../tests + ../tests/functional + ../tests/lint_test.php + + + ../tests/functional + + + + + + slow + + + + + + + + + + + + + + + + diff --git a/.github/setup-database.sh b/.github/setup-database.sh new file mode 100755 index 0000000000..d34c7898b7 --- /dev/null +++ b/.github/setup-database.sh @@ -0,0 +1,26 @@ +#!/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 +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 diff --git a/.github/setup-exiftool.sh b/.github/setup-exiftool.sh new file mode 100755 index 0000000000..04999b8600 --- /dev/null +++ b/.github/setup-exiftool.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# 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 + +sudo apt-get update +sudo apt-get install -y parallel libimage-exiftool-perl diff --git a/.github/setup-ldap.sh b/.github/setup-ldap.sh new file mode 100755 index 0000000000..d554654e87 --- /dev/null +++ b/.github/setup-ldap.sh @@ -0,0 +1,19 @@ +#!/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 +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 diff --git a/.github/setup-phpbb.sh b/.github/setup-phpbb.sh new file mode 100755 index 0000000000..c74f29d5cf --- /dev/null +++ b/.github/setup-phpbb.sh @@ -0,0 +1,36 @@ +#!/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 +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 .. diff --git a/.github/setup-unbuffer.sh b/.github/setup-unbuffer.sh new file mode 100755 index 0000000000..4423d1b8b6 --- /dev/null +++ b/.github/setup-unbuffer.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# 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 + +sudo apt-get update +sudo apt-get install -y expect-dev diff --git a/.github/setup-webserver.sh b/.github/setup-webserver.sh new file mode 100755 index 0000000000..0ee15ce061 --- /dev/null +++ b/.github/setup-webserver.sh @@ -0,0 +1,81 @@ +#!/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 +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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c976ffa360..5ecac57913 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 From a1b994a8cd12f3988aa68ee919eb76e17945ab97 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 18 Dec 2020 22:26:51 +0100 Subject: [PATCH 25/28] [ticket/16659] Add scripts for ext preparation and sniffing PHPBB3-16659 --- .github/ext-sniff.sh | 25 +++++++++++++++++++++++++ .github/prepare-extension.sh | 22 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 .github/ext-sniff.sh create mode 100755 .github/prepare-extension.sh diff --git a/.github/ext-sniff.sh b/.github/ext-sniff.sh new file mode 100755 index 0000000000..fc5bafc008 --- /dev/null +++ b/.github/ext-sniff.sh @@ -0,0 +1,25 @@ +#!/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 +set -x + +EXTNAME=$1 +NOTESTS=$2 + +if [ "$NOTESTS" == "1" ] +then + phpBB/vendor/bin/phpcs \ + -s \ + --extensions=php \ + --standard=build/code_sniffer/ruleset-php-extensions.xml \ + --ignore=*/"$EXTNAME"/tests/*,*/"$EXTNAME"/vendor/* \ + phpBB/ext/"$EXTNAME" +fi diff --git a/.github/prepare-extension.sh b/.github/prepare-extension.sh new file mode 100755 index 0000000000..9a1eee43c6 --- /dev/null +++ b/.github/prepare-extension.sh @@ -0,0 +1,22 @@ +#!/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 +set -x + +EXTNAME=$1 + +# Move the extension in place +mkdir --parents phpBB/ext/$EXTNAME +cp -R ../tmp/* phpBB/ext/$EXTNAME + +# Move the extensions .github/phpunit-*-travis.xml files in place +cp -R .github/*.xml phpBB/ext/$EXTNAME/.github +cp -R .github/*.sh phpBB/ext/$EXTNAME/.github From 9762cbf94f2ee037733eebc00841ab9b390ec1f5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 19 Dec 2020 21:32:38 +0100 Subject: [PATCH 26/28] [ticket/16659] Remove test branch from build branches PHPBB3-16659 --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ecac57913..7354711a67 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,6 @@ on: branches: - 3.3.x - master - - task/github-actions pull_request: branches: - 3.3.x From 8536c437c4c396e029d851cb1074e9239dee4401 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 19 Dec 2020 21:41:54 +0100 Subject: [PATCH 27/28] [ticket/16659] Undo changes to travis folder Github actions are using their own scripts etc. PHPBB3-16659 --- travis/ldap/slapd.conf | 6 +-- travis/phpunit-mssql-travis.xml | 41 ------------------- ...l-travis.xml => phpunit-mysqli-travis.xml} | 0 travis/phpunit-postgres-travis.xml | 2 +- travis/setup-database.sh | 10 +++-- travis/setup-ldap.sh | 7 ++-- travis/setup-phpbb.sh | 10 +++++ travis/setup-webserver.sh | 21 ++-------- 8 files changed, 27 insertions(+), 70 deletions(-) delete mode 100644 travis/phpunit-mssql-travis.xml rename travis/{phpunit-mysql-travis.xml => phpunit-mysqli-travis.xml} (100%) diff --git a/travis/ldap/slapd.conf b/travis/ldap/slapd.conf index 9f6aa980f7..5fce95cee2 100644 --- a/travis/ldap/slapd.conf +++ b/travis/ldap/slapd.conf @@ -4,13 +4,13 @@ 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 +pidfile /tmp/slapd/slapd.pid +argsfile /tmp/slapd/slapd.args modulepath /usr/lib/openldap database ldif -directory /var/tmp/slapd +directory /tmp/slapd suffix "dc=example,dc=com" rootdn "cn=admin,dc=example,dc=com" diff --git a/travis/phpunit-mssql-travis.xml b/travis/phpunit-mssql-travis.xml deleted file mode 100644 index 37c1deae2d..0000000000 --- a/travis/phpunit-mssql-travis.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - ../tests - ../tests/functional - ../tests/lint_test.php - - - ../tests/functional - - - - - - slow - - - - - - - - - - - - - - - - diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysqli-travis.xml similarity index 100% rename from travis/phpunit-mysql-travis.xml rename to travis/phpunit-mysqli-travis.xml diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 2648f27bef..3d8376bda1 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -32,7 +32,7 @@ - + diff --git a/travis/setup-database.sh b/travis/setup-database.sh index 479e17f592..b581ddfccb 100755 --- a/travis/setup-database.sh +++ b/travis/setup-database.sh @@ -14,7 +14,6 @@ set -x DB=$1 TRAVIS_PHP_VERSION=$2 NOTESTS=$3 -MYISAM=$4 if [ "$NOTESTS" == '1' ] then @@ -27,7 +26,12 @@ then psql -c 'create database phpbb_tests;' -U postgres fi -if [ "$MYISAM" == '1' ] +if [ "$TRAVIS_PHP_VERSION" == "5.6" -a "$DB" == "mysqli" ] then - mysql -h 127.0.0.1 -u root -e 'SET GLOBAL storage_engine=MyISAM;' + mysql -e 'SET GLOBAL storage_engine=MyISAM;' +fi + +if [ "$DB" == "mysqli" -o "$DB" == "mariadb" ] +then + mysql -e 'create database IF NOT EXISTS phpbb_tests;' fi diff --git a/travis/setup-ldap.sh b/travis/setup-ldap.sh index a5cbd3c0e1..9be816d77d 100755 --- a/travis/setup-ldap.sh +++ b/travis/setup-ldap.sh @@ -15,10 +15,9 @@ SLOWTESTS=$1 if [ "$SLOWTESTS" == '1' ] then - sudo apt-get -y install ldap-utils slapd - mkdir /var/tmp/slapd - cp travis/ldap/slapd.conf /var/tmp/slapd/slapd.conf - slapd -d 256 -d 128 -f /var/tmp/slapd/slapd.conf -h ldap://localhost:3389 & + sudo apt-get -y install ldap-utils slapd php-ldap + mkdir /tmp/slapd + slapd -f travis/ldap/slapd.conf -h ldap://localhost:3389 & sleep 3 ldapadd -h localhost:3389 -D "cn=admin,dc=example,dc=com" -w adminadmin -f travis/ldap/base.ldif fi diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index a6e51b5ed9..208b715dfe 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -22,11 +22,21 @@ then travis/setup-unbuffer.sh fi +if [ "$DB" == "mariadb" ] +then + travis/setup-mariadb.sh +fi + if [ "$MYSQL8" == '1' ] then travis/setup-mysql8.sh fi +if [ "$NOTESTS" != '1' ] +then + travis/setup-php-extensions.sh +fi + if [ "$NOTESTS" != '1' ] then travis/setup-webserver.sh diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index af6fccfe53..68bcd6ac00 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -12,7 +12,7 @@ set -e set -x sudo apt-get update -sudo apt-get install -y nginx coreutils +sudo apt-get install -y nginx realpath sudo service nginx stop @@ -25,28 +25,13 @@ 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_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" 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-dom \ - 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] + [travis] user = $USER group = $USER listen = $APP_SOCK From 8013bb369ac934d3049b37d98c6b2ddd09df00d1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 19 Dec 2020 21:43:36 +0100 Subject: [PATCH 28/28] [ticket/16659] Build PR branch to show that CI is working PHPBB3-16659 --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7354711a67..74cc3f8e4e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,7 @@ on: branches: - 3.3.x - master + - ticket/16659 pull_request: branches: - 3.3.x