From 50cf3bf4f74f06bb7bac669b09b478dbeb43a3a0 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 21:57:23 +0000 Subject: [PATCH 01/29] Revert "remove GitHub Action for PHP tests" This reverts commit f1e268ee0a10cfd801b3ad0cef3aa8b98caf39f5. --- .github/workflows/php.yml | 101 ++++++++++++++++++++++++++++++++++++++ bin/dev/setup-phpunit.sh | 13 +++++ 2 files changed, 114 insertions(+) create mode 100644 .github/workflows/php.yml create mode 100755 bin/dev/setup-phpunit.sh diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000000..1f3c518128 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,101 @@ +name: Testing Friendica +on: [push, pull_request] + +jobs: + friendica: + name: Friendica (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + services: + mariadb: + image: mariadb:latest + env: + MYSQL_ALLOW_EMPTY_PASSWORD: true + MYSQL_DATABASE: test + MYSQL_PASSWORD: test + MYSQL_USER: test + ports: + - 3306/tcp + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + redis: + image: redis + ports: + - 6379/tcp + options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 + memcached: + image: memcached + ports: + - 11211/tcp + strategy: + fail-fast: false + matrix: + php-versions: ['7.3', '7.4', '8.0'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + tools: pecl, composer:v1 + extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick, memcache + coverage: xdebug + ini-values: apc.enabled=1, apc.enable_cli=1 + + - name: Start mysql service + run: sudo /etc/init.d/mysql start + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist + + - name: Setup PHPUnit 8 + run: bin/dev/setup-phpunit.sh + + - name: Copy default Friendica config + run: cp config/local-sample.config.php config/local.config.php + + - name: Verify MariaDB connection + env: + PORT: ${{ job.services.mariadb.ports[3306] }} + run: | + while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do + sleep 1 + done + + - name: Setup MYSQL database + env: + PORT: ${{ job.services.mariadb.ports[3306] }} + run: | + mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql + + - name: Test with phpunit + run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + env: + MYSQL_HOST: 127.0.0.1 + MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} + MYSQL_DATABASE: test + MYSQL_PASSWORD: test + MYSQL_USER: test + REDIS_PORT: ${{ job.services.redis.ports[6379] }} + REDIS_HOST: 127.0.0.1 + MEMCACHED_PORT: ${{ job.services.memcached.ports[11211] }} + MEMCACHE_PORT: ${{ job.services.memcached.ports[11211] }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: clover.xml diff --git a/bin/dev/setup-phpunit.sh b/bin/dev/setup-phpunit.sh new file mode 100755 index 0000000000..b3884d3b7b --- /dev/null +++ b/bin/dev/setup-phpunit.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +PHPUNIT="$(git rev-parse --show-toplevel)/bin/phpunit" + +if ! [ -x "$PHPUNIT" ]; then + echo "Install PHPUnit 8" + cd /tmp/ + curl -s -O -L https://phar.phpunit.de/phpunit-8.phar + chmod +x phpunit-8.phar + mv phpunit-8.phar $PHPUNIT +fi + +echo "Using $PHPUNIT $($PHPUNIT --version)" From d959c07e257df3dee4363f370a07bfc34d6f38d1 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:02:44 +0000 Subject: [PATCH 02/29] remove bin/dev/setup-phpunit.sh --- bin/dev/setup-phpunit.sh | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100755 bin/dev/setup-phpunit.sh diff --git a/bin/dev/setup-phpunit.sh b/bin/dev/setup-phpunit.sh deleted file mode 100755 index b3884d3b7b..0000000000 --- a/bin/dev/setup-phpunit.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -PHPUNIT="$(git rev-parse --show-toplevel)/bin/phpunit" - -if ! [ -x "$PHPUNIT" ]; then - echo "Install PHPUnit 8" - cd /tmp/ - curl -s -O -L https://phar.phpunit.de/phpunit-8.phar - chmod +x phpunit-8.phar - mv phpunit-8.phar $PHPUNIT -fi - -echo "Using $PHPUNIT $($PHPUNIT --version)" From b6a972c5fe547623d433fb84f5e083a19c7d1a3c Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:25:48 +0000 Subject: [PATCH 03/29] Update php versions, remove code coverage upload --- .github/workflows/php.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1f3c518128..1da8fa1caa 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,5 +1,6 @@ name: Testing Friendica -on: [push, pull_request] + +on: [workflow_dispatch] jobs: friendica: @@ -28,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.3', '7.4', '8.0'] + php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout uses: actions/checkout@v2 @@ -94,8 +95,3 @@ jobs: REDIS_HOST: 127.0.0.1 MEMCACHED_PORT: ${{ job.services.memcached.ports[11211] }} MEMCACHE_PORT: ${{ job.services.memcached.ports[11211] }} - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - file: clover.xml From f48311051e972cc10dfe317b71a39b410f9f3e80 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:41:56 +0000 Subject: [PATCH 04/29] Improve workflow for PHP --- .github/workflows/php.yml | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1da8fa1caa..d4747f06ab 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,7 +32,7 @@ jobs: php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 @@ -43,29 +43,14 @@ jobs: coverage: xdebug ini-values: apc.enabled=1, apc.enable_cli=1 + # Install composer dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer + - name: "Install Composer dependencies" + uses: "ramsey/composer-install@v2" + - name: Start mysql service run: sudo /etc/init.d/mysql start - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Get composer cache directory - id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --prefer-dist - - - name: Setup PHPUnit 8 - run: bin/dev/setup-phpunit.sh - - name: Copy default Friendica config run: cp config/local-sample.config.php config/local.config.php From 2662fce74d7d8d626e065f7a90b24fd4bdfc137f Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:53:04 +0000 Subject: [PATCH 05/29] try to keep mariadb alive --- .github/workflows/php.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d4747f06ab..b67428a252 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -9,11 +9,16 @@ jobs: services: mariadb: image: mariadb:latest + restart: always env: MYSQL_ALLOW_EMPTY_PASSWORD: true MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test + command: + - --max-allowed-packet=64M + - --wait-timeout=28800 + - --interactive-timeout=28800 ports: - 3306/tcp options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 From 647717923173bd9a089d72b0a3efd05ab4f4ec8f Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:55:01 +0000 Subject: [PATCH 06/29] remove wrong parameter --- .github/workflows/php.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b67428a252..1bb7ed066d 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -9,7 +9,6 @@ jobs: services: mariadb: image: mariadb:latest - restart: always env: MYSQL_ALLOW_EMPTY_PASSWORD: true MYSQL_DATABASE: test From 3ac97e44ab512b3d4f10ab9de51f42abfba3c434 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 22:59:45 +0000 Subject: [PATCH 07/29] add command args as options --- .github/workflows/php.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1bb7ed066d..44e076f9c3 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,13 +14,9 @@ jobs: MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test - command: - - --max-allowed-packet=64M - - --wait-timeout=28800 - - --interactive-timeout=28800 ports: - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --wait-timeout=28800 --interactive-timeout=28800 redis: image: redis ports: From 69858086249b2241413b3350427a1b418d571c0f Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 23:01:20 +0000 Subject: [PATCH 08/29] remove wait-timeout --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 44e076f9c3..fe56418a44 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: MYSQL_USER: test ports: - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --wait-timeout=28800 --interactive-timeout=28800 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --interactive-timeout=28800 redis: image: redis ports: From 7176ba5a0a1f570552b145fb104f827520602170 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 6 Nov 2024 23:02:24 +0000 Subject: [PATCH 09/29] remove interactive timeout --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index fe56418a44..d4747f06ab 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: MYSQL_USER: test ports: - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --interactive-timeout=28800 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis ports: From 5066e4b6e05122e326ee37401e0de1f74fc66314 Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 7 Nov 2024 13:34:50 +0000 Subject: [PATCH 10/29] Try different port style --- .github/workflows/php.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d4747f06ab..28aba027d5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -6,6 +6,7 @@ jobs: friendica: name: Friendica (PHP ${{ matrix.php-versions }}) runs-on: ubuntu-latest + services: mariadb: image: mariadb:latest @@ -15,21 +16,25 @@ jobs: MYSQL_PASSWORD: test MYSQL_USER: test ports: - - 3306/tcp + - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + redis: image: redis ports: - - 6379/tcp + - 6379 options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 + memcached: image: memcached ports: - - 11211/tcp + - 11211 + strategy: fail-fast: false matrix: php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + steps: - name: Checkout uses: actions/checkout@v4 From 5601c8b6a1560944a3828c0203828295712df583 Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 7 Nov 2024 13:38:43 +0000 Subject: [PATCH 11/29] Try mariadb 11.1 --- .github/workflows/php.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 28aba027d5..bf81a036c6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -9,26 +9,26 @@ jobs: services: mariadb: - image: mariadb:latest + image: mariadb:11.1 env: MYSQL_ALLOW_EMPTY_PASSWORD: true MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test ports: - - 3306 + - 3306/tcp options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis ports: - - 6379 + - 6379/tcp options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 memcached: image: memcached ports: - - 11211 + - 11211/tcp strategy: fail-fast: false From 10497e9231011a435bf0fad7a5b4e9e648da2b70 Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 7 Nov 2024 13:47:02 +0000 Subject: [PATCH 12/29] Try different port --- .github/workflows/php.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index bf81a036c6..ed9c7bf373 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -9,14 +9,14 @@ jobs: services: mariadb: - image: mariadb:11.1 + image: mariadb:latest env: MYSQL_ALLOW_EMPTY_PASSWORD: true MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test ports: - - 3306/tcp + - 33306/tcp options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: @@ -61,7 +61,7 @@ jobs: - name: Verify MariaDB connection env: - PORT: ${{ job.services.mariadb.ports[3306] }} + PORT: ${{ job.services.mariadb.ports[33306] }} run: | while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do sleep 1 @@ -69,7 +69,7 @@ jobs: - name: Setup MYSQL database env: - PORT: ${{ job.services.mariadb.ports[3306] }} + PORT: ${{ job.services.mariadb.ports[33306] }} run: | mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql @@ -77,7 +77,7 @@ jobs: run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml env: MYSQL_HOST: 127.0.0.1 - MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} + MYSQL_PORT: ${{ job.services.mariadb.ports[33306] }} MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test From aa6ddb73fe9645cada6255d99d5e19c832f88c7b Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 8 Nov 2024 07:23:35 +0000 Subject: [PATCH 13/29] Restore ports --- .github/workflows/php.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ed9c7bf373..2eaf4edfd0 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: MYSQL_PASSWORD: test MYSQL_USER: test ports: - - 33306/tcp + - 3306/tcp options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: @@ -61,7 +61,7 @@ jobs: - name: Verify MariaDB connection env: - PORT: ${{ job.services.mariadb.ports[33306] }} + PORT: ${{ job.services.mariadb.ports[3306] }} run: | while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do sleep 1 @@ -69,7 +69,7 @@ jobs: - name: Setup MYSQL database env: - PORT: ${{ job.services.mariadb.ports[33306] }} + PORT: ${{ job.services.mariadb.ports[3306] }} run: | mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql @@ -77,7 +77,7 @@ jobs: run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml env: MYSQL_HOST: 127.0.0.1 - MYSQL_PORT: ${{ job.services.mariadb.ports[33306] }} + MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} MYSQL_DATABASE: test MYSQL_PASSWORD: test MYSQL_USER: test From 9623645cfad1baf4155c950102a92998a3b44acd Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 9 Nov 2024 09:32:35 +0000 Subject: [PATCH 14/29] Add copyright notes --- .github/workflows/php.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 2eaf4edfd0..df687ad0fd 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + name: Testing Friendica on: [workflow_dispatch] From d9841eeea334ee3e7e686cc89a48ad7b3e39b6ca Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 20 Dec 2024 21:07:53 +0000 Subject: [PATCH 15/29] Add Github workflow for PHPStan --- .github/workflows/phpstan.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/phpstan.yml diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000000..5b270fcd30 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + +name: PHPStan + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + + tests: + name: Run PHPStan with PHP ${{ matrix.php }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['8.4'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: Run PHPStan + run: composer run phpstan \ No newline at end of file From 81b87e9ca49332e416c3443f7d1bb7bb8ed215cb Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 20 Dec 2024 21:26:05 +0000 Subject: [PATCH 16/29] Add workflow for unit tests --- .github/workflows/unit-tests.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000000..c360c3d818 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + +name: Unit tests + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + + tests: + name: Run Unit tests (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: Run Unit tests + run: composer run test:unit \ No newline at end of file From 2fba79929d503ff1422665aa8b8ef0fcd9dadc25 Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 20 Dec 2024 21:32:59 +0000 Subject: [PATCH 17/29] add tests workflow --- .github/workflows/tests.yml | 44 ++++++++++++++++++++++++++++++++ .github/workflows/unit-tests.yml | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..5d9297d3d3 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + +name: Unit tests + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + + tests: + name: Unit tests (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: Run Unit tests + run: composer run test -- --configuration tests/phpunit.xml -d memory_limit=-1; \ No newline at end of file diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c360c3d818..841b4bb6e9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,7 +12,7 @@ on: jobs: tests: - name: Run Unit tests (PHP ${{ matrix.php }}) + name: Unit tests (PHP ${{ matrix.php }}) runs-on: ubuntu-latest strategy: From 722164711c12e0703545054f591a3760527882e1 Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 20 Dec 2024 21:36:06 +0000 Subject: [PATCH 18/29] test only src tests --- .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 5d9297d3d3..c6a7ce3d26 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: Unit tests +name: Src tests on: push: @@ -12,7 +12,7 @@ on: jobs: tests: - name: Unit tests (PHP ${{ matrix.php }}) + name: Src tests (PHP ${{ matrix.php }}) runs-on: ubuntu-latest strategy: @@ -41,4 +41,4 @@ jobs: uses: "ramsey/composer-install@v2" - name: Run Unit tests - run: composer run test -- --configuration tests/phpunit.xml -d memory_limit=-1; \ No newline at end of file + run: composer run test -- tests/src --configuration tests/phpunit.xml -d memory_limit=-1 \ No newline at end of file From c949032fc70dde6630e0dd59fc2ef8b40f3316c4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 20 Dec 2024 21:49:34 +0000 Subject: [PATCH 19/29] Remove src tests --- .github/workflows/php.yml | 5 ++++- .github/workflows/tests.yml | 44 ------------------------------------- 2 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index df687ad0fd..3e9705f269 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -4,7 +4,10 @@ name: Testing Friendica -on: [workflow_dispatch] +on: + push: + pull_request: + workflow_dispatch: jobs: friendica: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index c6a7ce3d26..0000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project -# -# SPDX-License-Identifier: CC0-1.0 - -name: Src tests - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - - tests: - name: Src tests (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - operating-system: ['ubuntu-latest'] - php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Setup PHP with composer and extensions - uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php }} - coverage: xdebug - tools: none - - - name: Clone addon repository - run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon - - - name: Install Composer dependencies - uses: "ramsey/composer-install@v2" - - - name: Run Unit tests - run: composer run test -- tests/src --configuration tests/phpunit.xml -d memory_limit=-1 \ No newline at end of file From ab22464d5504a1dbcf5573bd706f32f983f9916f Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 06:38:03 +0000 Subject: [PATCH 20/29] better healtcheck for mariadb --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 3e9705f269..268650f6d6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -24,7 +24,7 @@ jobs: MYSQL_USER: test ports: - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis From 57da3416c546bbf2dc3ea830b1a21cc5af1d7222 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 06:41:11 +0000 Subject: [PATCH 21/29] clone addon repository --- .github/workflows/php.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 268650f6d6..e565529b68 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -55,6 +55,9 @@ jobs: coverage: xdebug ini-values: apc.enabled=1, apc.enable_cli=1 + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + # Install composer dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: "Install Composer dependencies" From dd4467043a040a63268cbf821125b19af0b554aa Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 06:51:37 +0000 Subject: [PATCH 22/29] Set bin path to phpunit --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index e565529b68..605d31dcf0 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -84,7 +84,7 @@ jobs: mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql - name: Test with phpunit - run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml env: MYSQL_HOST: 127.0.0.1 MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} From 1b4ace329e4d046d549571979ef6929fdbcecfd5 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 06:55:09 +0000 Subject: [PATCH 23/29] Rename tests, use composer v2 --- .github/workflows/php.yml | 6 +++--- .github/workflows/phpstan.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 605d31dcf0..f5c3ffbd1c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: Testing Friendica +name: Databese tests on: push: @@ -11,7 +11,7 @@ on: jobs: friendica: - name: Friendica (PHP ${{ matrix.php-versions }}) + name: Tests with PHP ${{ matrix.php-versions }} runs-on: ubuntu-latest services: @@ -50,7 +50,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - tools: pecl, composer:v1 + tools: pecl, composer extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick, memcache coverage: xdebug ini-values: apc.enabled=1, apc.enable_cli=1 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 5b270fcd30..a6c03a74fb 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: PHPStan +name: Static Code Analysis on: push: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 841b4bb6e9..b0ff7bdca2 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,7 +12,7 @@ on: jobs: tests: - name: Unit tests (PHP ${{ matrix.php }}) + name: Unit testsuite (PHP ${{ matrix.php }}) runs-on: ubuntu-latest strategy: From 3b8aac4c554c13fd2682ddf1baa0e8b1391f4745 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 06:56:30 +0000 Subject: [PATCH 24/29] Add tests with PHP 8.5 --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index f5c3ffbd1c..4bbb61ea15 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] steps: - name: Checkout From af655ff392c411d3fc738260c4596bc667e71cf8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 07:05:25 +0000 Subject: [PATCH 25/29] rename workflows and test cases --- .github/workflows/{php.yml => database-tests.yml} | 4 ++-- .github/workflows/phpstan.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{php.yml => database-tests.yml} (97%) diff --git a/.github/workflows/php.yml b/.github/workflows/database-tests.yml similarity index 97% rename from .github/workflows/php.yml rename to .github/workflows/database-tests.yml index 4bbb61ea15..3ca0985d84 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/database-tests.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: Databese tests +name: Database tests on: push: @@ -11,7 +11,7 @@ on: jobs: friendica: - name: Tests with PHP ${{ matrix.php-versions }} + name: Test with PHP ${{ matrix.php-versions }} runs-on: ubuntu-latest services: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index a6c03a74fb..c4f42da741 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -12,7 +12,7 @@ on: jobs: tests: - name: Run PHPStan with PHP ${{ matrix.php }} + name: PHPStan PHP (${{ matrix.php }}) runs-on: ubuntu-latest strategy: From f8b96c562a7487805b85f60deee16e695e55b214 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 07:23:49 +0000 Subject: [PATCH 26/29] Add codestyle check --- .github/workflows/code-style.yml | 45 ++++++++++++++++++++++++++++++++ .github/workflows/phpstan.yml | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/code-style.yml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 0000000000..7a7ff39f2e --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + +name: Code Style + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + + tests: + name: PHP-CS-Fixer (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['8.4'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install PHP-CS-Fixer + run: composer install --working-dir=bin/dev/php-cs-fixer + + - name: Run PHP-CS-Fixer + continue-on-error: true + run: bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run \ No newline at end of file diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c4f42da741..d3c94de7fd 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -12,7 +12,7 @@ on: jobs: tests: - name: PHPStan PHP (${{ matrix.php }}) + name: PHPStan (PHP ${{ matrix.php }}) runs-on: ubuntu-latest strategy: From af4cac91b182b211e695192e0b5dc8f268cbc11b Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 07:27:07 +0000 Subject: [PATCH 27/29] Run PHP-CS-Fixer with PHP 8.3 --- .github/workflows/code-style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 7a7ff39f2e..d7bd23aaa3 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: operating-system: ['ubuntu-latest'] - php: ['8.4'] + php: ['8.3'] steps: - name: Checkout From 432f28ecd1e730ba7a770564789f468c9abb7831 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 14:29:13 +0000 Subject: [PATCH 28/29] merge code quality checks into on workflow --- .../{code-style.yml => code-quality.yml} | 38 ++++++++++++++-- .github/workflows/phpstan.yml | 44 ------------------- 2 files changed, 35 insertions(+), 47 deletions(-) rename .github/workflows/{code-style.yml => code-quality.yml} (54%) delete mode 100644 .github/workflows/phpstan.yml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-quality.yml similarity index 54% rename from .github/workflows/code-style.yml rename to .github/workflows/code-quality.yml index d7bd23aaa3..dad0aec9e1 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-quality.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: Code Style +name: Code Quality on: push: @@ -11,7 +11,7 @@ on: jobs: - tests: + code-style: name: PHP-CS-Fixer (PHP ${{ matrix.php }}) runs-on: ubuntu-latest @@ -42,4 +42,36 @@ jobs: - name: Run PHP-CS-Fixer continue-on-error: true - run: bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run \ No newline at end of file + run: bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run + + phpstan: + name: PHPStan (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['8.4'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: Run PHPStan + run: composer run phpstan diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml deleted file mode 100644 index d3c94de7fd..0000000000 --- a/.github/workflows/phpstan.yml +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project -# -# SPDX-License-Identifier: CC0-1.0 - -name: Static Code Analysis - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - - tests: - name: PHPStan (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - operating-system: ['ubuntu-latest'] - php: ['8.4'] - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Setup PHP with composer and extensions - uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php }} - coverage: xdebug - tools: none - - - name: Clone addon repository - run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon - - - name: Install Composer dependencies - uses: "ramsey/composer-install@v2" - - - name: Run PHPStan - run: composer run phpstan \ No newline at end of file From b801e176aadaad3c97154be1650986acb371df25 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 22 Dec 2024 14:36:19 +0000 Subject: [PATCH 29/29] Merge database and unit tests into one workflow --- .../{database-tests.yml => tests.yml} | 38 ++++++++++++++-- .github/workflows/unit-tests.yml | 44 ------------------- 2 files changed, 35 insertions(+), 47 deletions(-) rename .github/workflows/{database-tests.yml => tests.yml} (75%) delete mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/database-tests.yml b/.github/workflows/tests.yml similarity index 75% rename from .github/workflows/database-tests.yml rename to .github/workflows/tests.yml index 3ca0985d84..d0aa623842 100644 --- a/.github/workflows/database-tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: CC0-1.0 -name: Database tests +name: CI tests on: push: @@ -10,8 +10,40 @@ on: workflow_dispatch: jobs: - friendica: - name: Test with PHP ${{ matrix.php-versions }} + unit-tests: + name: Unit-Tests (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup PHP with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + coverage: xdebug + tools: none + + - name: Clone addon repository + run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: Run Unit tests + run: composer run test:unit + + database-tests: + name: Database-Tests (PHP ${{ matrix.php-versions }}) runs-on: ubuntu-latest services: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml deleted file mode 100644 index b0ff7bdca2..0000000000 --- a/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project -# -# SPDX-License-Identifier: CC0-1.0 - -name: Unit tests - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - - tests: - name: Unit testsuite (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - operating-system: ['ubuntu-latest'] - php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Setup PHP with composer and extensions - uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php }} - coverage: xdebug - tools: none - - - name: Clone addon repository - run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon - - - name: Install Composer dependencies - uses: "ramsey/composer-install@v2" - - - name: Run Unit tests - run: composer run test:unit \ No newline at end of file