From f0903de27712d9bbe32e702d33e262752bd8cef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:03:56 +0200 Subject: [PATCH 01/30] test --- .forgejo/workflows/phpunit.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 0daeb73..f71e753 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -28,6 +28,15 @@ jobs: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Cache WordPress Setup + id: cache-wordpress + uses: actions/cache@v4 + with: + path: | + WP_TESTS_DIR + WP_CORE_DIR + key: wordpress-cache-1 + - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 with: -- 2.39.5 From d520ed5939ffc6979733cc90566fca2bb64b078f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:10:31 +0200 Subject: [PATCH 02/30] test --- .forgejo/workflows/phpcs.yml | 8 ++++++++ .forgejo/workflows/phpunit.yml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 4db1ac5..aa586d4 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -25,6 +25,13 @@ jobs: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Cache Composer + id: cache-composer + uses: https://code.forgejo.org/actions/actions/cache@v4 + with: + path: vendor + key: cache-composer-1 + - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 with: @@ -35,6 +42,7 @@ jobs: runner: self-hosted - name: Install Composer dependencies for PHP + if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - name: Detect coding standard violations diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index f71e753..8d7bef6 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -30,7 +30,7 @@ jobs: - name: Cache WordPress Setup id: cache-wordpress - uses: actions/cache@v4 + uses: https://code.forgejo.org/actions/actions/cache@v4 with: path: | WP_TESTS_DIR @@ -53,6 +53,7 @@ jobs: run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client - name: Setup Test Environment + if: steps.cache-wordpress.outputs.cache-hit != 'true' run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 - name: Unit Testing -- 2.39.5 From a1e847d46509f8aa64956b5dbce1c430e08dc7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:11:04 +0200 Subject: [PATCH 03/30] test --- .forgejo/workflows/phpcs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index aa586d4..633a53d 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -27,7 +27,7 @@ jobs: - name: Cache Composer id: cache-composer - uses: https://code.forgejo.org/actions/actions/cache@v4 + uses: https://code.forgejo.org/actions/cache@v4 with: path: vendor key: cache-composer-1 -- 2.39.5 From 7ce208d7b8f3db08b2fdfa2e36790b2db3f03115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:13:22 +0200 Subject: [PATCH 04/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 8d7bef6..d8d97b2 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -30,7 +30,7 @@ jobs: - name: Cache WordPress Setup id: cache-wordpress - uses: https://code.forgejo.org/actions/actions/cache@v4 + uses: https://code.forgejo.org/actions/cache@v4 with: path: | WP_TESTS_DIR -- 2.39.5 From 7bb31e1a71caae53a1f78c587ae1da4d884331f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:14:14 +0200 Subject: [PATCH 05/30] test --- .forgejo/workflows/phpcs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 633a53d..6d78b90 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -45,5 +45,7 @@ jobs: if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 + - run: composer config --list + - name: Detect coding standard violations run: ./vendor/bin/phpcs \ No newline at end of file -- 2.39.5 From 6a89c00e2d75bfb8dbf2f9388daef8995c2067f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:15:29 +0200 Subject: [PATCH 06/30] violate a coding standard --- activitypub-event-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activitypub-event-extensions.php b/activitypub-event-extensions.php index 9be6461..cc0db15 100644 --- a/activitypub-event-extensions.php +++ b/activitypub-event-extensions.php @@ -18,7 +18,7 @@ */ // Exit if accessed directly. -defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore +defined('ABSPATH' ) || exit; // @codeCoverageIgnore define( 'ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); -- 2.39.5 From 8b343eb46e3457b9ff630ab19912323074ac86e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:22:44 +0200 Subject: [PATCH 07/30] test --- .forgejo/workflows/phpcs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 6d78b90..8a1e3bb 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -45,7 +45,7 @@ jobs: if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - - run: composer config --list + - run: which composer && composer config --list - name: Detect coding standard violations - run: ./vendor/bin/phpcs \ No newline at end of file + run: ./vendor/bin/phpcs -- 2.39.5 From 2af7ea52887ad60408f2b5f1a88e396304934663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:30:23 +0200 Subject: [PATCH 08/30] test --- .forgejo/workflows/phpcs.yml | 6 ++++-- .forgejo/workflows/phpunit.yml | 2 +- activitypub-event-extensions.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 8a1e3bb..f47edd0 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -29,8 +29,10 @@ jobs: id: cache-composer uses: https://code.forgejo.org/actions/cache@v4 with: - path: vendor - key: cache-composer-1 + path: | + ./vendor/ + /root/.cache/composer/ + key: cache-composer-2 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index d8d97b2..dc4fe8a 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -35,7 +35,7 @@ jobs: path: | WP_TESTS_DIR WP_CORE_DIR - key: wordpress-cache-1 + key: cache-wordpress-1 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 diff --git a/activitypub-event-extensions.php b/activitypub-event-extensions.php index cc0db15..9be6461 100644 --- a/activitypub-event-extensions.php +++ b/activitypub-event-extensions.php @@ -18,7 +18,7 @@ */ // Exit if accessed directly. -defined('ABSPATH' ) || exit; // @codeCoverageIgnore +defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore define( 'ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); -- 2.39.5 From 5b7676ee0961d2d00cbc9c482615d90155a07ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:38:14 +0200 Subject: [PATCH 09/30] test --- .forgejo/workflows/phpcs.yml | 3 +-- .forgejo/workflows/phpunit.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index f47edd0..b7cc8f9 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -32,6 +32,7 @@ jobs: path: | ./vendor/ /root/.cache/composer/ + /usr/local/bin/composer key: cache-composer-2 - name: Setup PHP @@ -47,7 +48,5 @@ jobs: if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - - run: which composer && composer config --list - - name: Detect coding standard violations run: ./vendor/bin/phpcs diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index dc4fe8a..417558a 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -33,8 +33,8 @@ jobs: uses: https://code.forgejo.org/actions/cache@v4 with: path: | - WP_TESTS_DIR - WP_CORE_DIR + ${{ env.WP_CORE_DIR }} + ${{ env.WP_TESTS_DIR }} key: cache-wordpress-1 - name: Setup PHP -- 2.39.5 From f8d0f01be00dd1176a886bfe99c68fc3bc003089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:41:36 +0200 Subject: [PATCH 10/30] test --- .forgejo/workflows/phpcs.yml | 2 +- .forgejo/workflows/phpunit.yml | 2 +- composer.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index b7cc8f9..3338848 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -40,7 +40,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} coverage: none - tools: composer, cs2pr + tools: composer env: runner: self-hosted diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 417558a..45811ca 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -42,7 +42,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} coverage: none - tools: composer, phpunit-polyfills + tools: composer env: runner: self-hosted diff --git a/composer.json b/composer.json index 945c004..a790815 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,8 @@ "squizlabs/php_codesniffer": "3.*", "wp-coding-standards/wpcs": "dev-develop", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", - "sirbrillig/phpcs-variable-analysis": "^2.11" + "sirbrillig/phpcs-variable-analysis": "^2.11", + "yoast/phpunit-polyfills": "^3.0" }, "config": { "allow-plugins": true -- 2.39.5 From 6020c1f277e91276ac7f397ef885261cc5ce69ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:45:07 +0200 Subject: [PATCH 11/30] test --- .forgejo/workflows/phpunit.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 45811ca..9f52286 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -37,6 +37,16 @@ jobs: ${{ env.WP_TESTS_DIR }} key: cache-wordpress-1 + - name: Cache Composer + id: cache-composer + uses: https://code.forgejo.org/actions/cache@v4 + with: + path: | + ./vendor/ + /root/.cache/composer/ + /usr/local/bin/composer + key: cache-composer-2 + - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 with: @@ -47,6 +57,7 @@ jobs: runner: self-hosted - name: Install Composer dependencies for PHP + if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - name: Install mysqladmin -- 2.39.5 From 535e77c0172ec423e30340bd9c38da7ad86a8bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:47:15 +0200 Subject: [PATCH 12/30] test --- .forgejo/workflows/phpunit.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 9f52286..1e759d5 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -68,6 +68,6 @@ jobs: run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 - name: Unit Testing - run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && phpunit + run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit env: PHP_VERSION: ${{ matrix.php-versions }} diff --git a/composer.json b/composer.json index a790815..238b8e1 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "scripts": { "lint": [ - "vendor/bin/phpcs -n -q" + "vendor/bin/phpcs" ], "lint:fix": [ "vendor/bin/phpcbf" -- 2.39.5 From e3041b015f7d409da3edbb51a22ab3221f4efc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:53:02 +0200 Subject: [PATCH 13/30] test --- .forgejo/workflows/phpunit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 1e759d5..70666d8 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -67,6 +67,8 @@ jobs: if: steps.cache-wordpress.outputs.cache-hit != 'true' run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 + - run: composer show -i + - name: Unit Testing run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit env: -- 2.39.5 From c2fb6dffded2caf0c43692108099ca42edd4b670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 12:55:55 +0200 Subject: [PATCH 14/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 70666d8..d083d9d 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -45,7 +45,7 @@ jobs: ./vendor/ /root/.cache/composer/ /usr/local/bin/composer - key: cache-composer-2 + key: cache-composer-3 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 -- 2.39.5 From 50c25cdc4e34f5970b3934e4a41495676aeb9cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:00:08 +0200 Subject: [PATCH 15/30] test --- .forgejo/workflows/phpunit.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index d083d9d..06eb2cf 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -60,8 +60,13 @@ jobs: if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - - name: Install mysqladmin - run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client + - uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest + with: + packages: mysql-client + version: 1.0 + + # - name: Install mysqladmin + # run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client - name: Setup Test Environment if: steps.cache-wordpress.outputs.cache-hit != 'true' -- 2.39.5 From 1008bd62c8881b6e26c01c97ff266a4bc1798bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:11:43 +0200 Subject: [PATCH 16/30] test --- .forgejo/workflows/phpcs.yml | 2 +- .forgejo/workflows/phpunit.yml | 7 ++++--- bin/install-wp-tests.sh | 22 +++++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 3338848..7b30c4a 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -33,7 +33,7 @@ jobs: ./vendor/ /root/.cache/composer/ /usr/local/bin/composer - key: cache-composer-2 + key: cache-composer-3 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 06eb2cf..9efddd0 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -65,13 +65,14 @@ jobs: packages: mysql-client version: 1.0 - # - name: Install mysqladmin - # run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client - - name: Setup Test Environment if: steps.cache-wordpress.outputs.cache-hit != 'true' run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 + - name: Setup WordPress Test Database + if: steps.cache-wordpress.outputs.cache-hit != 'false' + run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true + - run: composer show -i - name: Unit Testing diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh index e772021..f10e7c3 100644 --- a/bin/install-wp-tests.sh +++ b/bin/install-wp-tests.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ $# -lt 3 ]; then - echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + echo "usage: $0 [db-host] [wp-version] [skip-database-creation] [skip-wp-install] [skip-plugins] [skip-test-suite]" exit 1 fi @@ -11,6 +11,10 @@ DB_PASS=$3 DB_HOST=${4-localhost} WP_VERSION=${5-latest} SKIP_DB_CREATE=${6-false} +SKIP_WP_INSTALL=${7-false} +SKIP_PLUGINS_INSTALL=${8-false} +SKIP_TEST_SUITE_INSTALL=${9-false} + TMPDIR=${TMPDIR-/tmp} TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") @@ -54,7 +58,10 @@ fi set -ex install_wp() { - rm -rf $WP_CORE_DIR + if [ "$SKIP_WP_INSTALL" = "true" ]; then + echo "Skipping WordPress installation." + return 0 + fi if [ -d $WP_CORE_DIR ]; then return; @@ -97,6 +104,11 @@ install_wp() { } install_test_suite() { + if [ "$SKIP_TEST_SUITE_INSTALL" = "true" ]; then + echo "Skipping test suite installation." + return 0 + fi + # portable in-place argument for both GNU sed and Mac OSX sed if [[ $(uname -s) == 'Darwin' ]]; then local ioption='-i.bak' @@ -178,7 +190,11 @@ install_db() { } install_wp_plugins() { - download https://downloads.wordpress.org/plugin/activitypub.3.2.5.zip $TMPDIR/activitypub.zip + if [ "$SKIP_PLUGINS_INSTALL" = "true" ]; then + echo "Skipping WordPress plugin installation." + return 0 + fi + download https://downloads.wordpress.org/plugin/activitypub.3.2.5.zip $TMPDIR/activitypub.zip unzip $TMPDIR/activitypub.zip -d $WP_CORE_DIR/wp-content/plugins/ } -- 2.39.5 From 6c71423d6241fca762346ba6b40464b48e274a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:13:50 +0200 Subject: [PATCH 17/30] test --- .forgejo/workflows/phpunit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 9efddd0..32c3820 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -60,7 +60,8 @@ jobs: if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - - uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest + - name: Install and Cache mysqladmin needed to initialize the Test Database + uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest with: packages: mysql-client version: 1.0 -- 2.39.5 From 380495e1b607529623c725a156166a6fef817ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:15:52 +0200 Subject: [PATCH 18/30] test --- .forgejo/workflows/phpcs.yml | 4 +--- .forgejo/workflows/phpunit.yml | 14 +++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 7b30c4a..dccb6d0 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -31,9 +31,7 @@ jobs: with: path: | ./vendor/ - /root/.cache/composer/ - /usr/local/bin/composer - key: cache-composer-3 + key: cache-composer-4 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 32c3820..df87868 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -43,9 +43,7 @@ jobs: with: path: | ./vendor/ - /root/.cache/composer/ - /usr/local/bin/composer - key: cache-composer-3 + key: cache-composer-4 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 @@ -56,11 +54,11 @@ jobs: env: runner: self-hosted - - name: Install Composer dependencies for PHP + - name: Install composer dependencies for PHP if: steps.cache-composer.outputs.cache-hit != 'true' uses: ramsey/composer-install@v3 - - name: Install and Cache mysqladmin needed to initialize the Test Database + - name: Install and cache mysqladmin needed to initialize the test database uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest with: packages: mysql-client @@ -68,14 +66,12 @@ jobs: - name: Setup Test Environment if: steps.cache-wordpress.outputs.cache-hit != 'true' - run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 + run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false false false false - - name: Setup WordPress Test Database + - name: Initialize WordPress test database if: steps.cache-wordpress.outputs.cache-hit != 'false' run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true - - run: composer show -i - - name: Unit Testing run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit env: -- 2.39.5 From bd037022bc9695f460af0ffc501bececf53c04c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:26:24 +0200 Subject: [PATCH 19/30] use different caches for composer --- .forgejo/workflows/phpcs.yml | 2 +- .forgejo/workflows/phpunit.yml | 11 ++++++----- composer.json | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index dccb6d0..5eddf5a 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -31,7 +31,7 @@ jobs: with: path: | ./vendor/ - key: cache-composer-4 + key: cache-composer-phpcs-1 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index df87868..4444647 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -38,12 +38,12 @@ jobs: key: cache-wordpress-1 - name: Cache Composer - id: cache-composer + id: cache-composer-phpunit uses: https://code.forgejo.org/actions/cache@v4 with: path: | ./vendor/ - key: cache-composer-4 + key: cache-composer-phpunit-1 - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 @@ -54,9 +54,10 @@ jobs: env: runner: self-hosted - - name: Install composer dependencies for PHP - if: steps.cache-composer.outputs.cache-hit != 'true' - uses: ramsey/composer-install@v3 + - name: Install PHP Unit + if: steps.cache-composer-phpunit.outputs.cache-hit != 'true' + # Polyfills requires all needed packages including phpunit itself. + uses: composer install --dev yoast/phpunit-polyfills:"^3.0" - name: Install and cache mysqladmin needed to initialize the test database uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest diff --git a/composer.json b/composer.json index 238b8e1..2b19f28 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ "wp-coding-standards/wpcs": "dev-develop", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "sirbrillig/phpcs-variable-analysis": "^2.11", - "yoast/phpunit-polyfills": "^3.0" }, "config": { "allow-plugins": true -- 2.39.5 From 7204bccb03641d1ed8e34d0de1aa97ef67df99f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:26:35 +0200 Subject: [PATCH 20/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 4444647..e2884c9 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -57,7 +57,7 @@ jobs: - name: Install PHP Unit if: steps.cache-composer-phpunit.outputs.cache-hit != 'true' # Polyfills requires all needed packages including phpunit itself. - uses: composer install --dev yoast/phpunit-polyfills:"^3.0" + uses: composer install yoast/phpunit-polyfills:"^3.0" - name: Install and cache mysqladmin needed to initialize the test database uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest -- 2.39.5 From 4d32178120e010abad9d3a4bb0db584560ccc8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:28:08 +0200 Subject: [PATCH 21/30] test --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2b19f28..7c9ab9b 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "squizlabs/php_codesniffer": "3.*", "wp-coding-standards/wpcs": "dev-develop", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", - "sirbrillig/phpcs-variable-analysis": "^2.11", + "sirbrillig/phpcs-variable-analysis": "^2.11" }, "config": { "allow-plugins": true -- 2.39.5 From 47f026b4b448f9152c984dd33b6b6d7fb4d072c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:28:49 +0200 Subject: [PATCH 22/30] test --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7c9ab9b..8a5b5a5 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "phpcompatibility/php-compatibility": "*", "phpcompatibility/phpcompatibility-wp": "*", "squizlabs/php_codesniffer": "3.*", - "wp-coding-standards/wpcs": "dev-develop", + "wp-coding-standards/wpcs": "^3.1.0", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "sirbrillig/phpcs-variable-analysis": "^2.11" }, -- 2.39.5 From 80a5e13fba969e57bcfc6ad857b8a95bdfae437a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:30:10 +0200 Subject: [PATCH 23/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index e2884c9..a1ae46d 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -57,7 +57,7 @@ jobs: - name: Install PHP Unit if: steps.cache-composer-phpunit.outputs.cache-hit != 'true' # Polyfills requires all needed packages including phpunit itself. - uses: composer install yoast/phpunit-polyfills:"^3.0" + run: composer install yoast/phpunit-polyfills:"^3.0" - name: Install and cache mysqladmin needed to initialize the test database uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest -- 2.39.5 From 0329ed8f190911a87c7188efd3a1d537509eebe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:32:32 +0200 Subject: [PATCH 24/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index a1ae46d..2e3d1b7 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -57,7 +57,7 @@ jobs: - name: Install PHP Unit if: steps.cache-composer-phpunit.outputs.cache-hit != 'true' # Polyfills requires all needed packages including phpunit itself. - run: composer install yoast/phpunit-polyfills:"^3.0" + run: composer require --dev yoast/phpunit-polyfills:"^3.0" - name: Install and cache mysqladmin needed to initialize the test database uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest -- 2.39.5 From e18493897f13b9d3da1b68fdccc36800daf98a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:35:45 +0200 Subject: [PATCH 25/30] add unittests for php 8.1 - 8.3 --- .forgejo/workflows/phpunit.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 2e3d1b7..cf444ea 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -19,7 +19,7 @@ jobs: MYSQL_ROOT_PASSWORD: root strategy: matrix: - php-versions: ['8.1'] + php-versions: ['8.1', '8.2', '8.3'] name: Run phpunit tests env: extensions: mysql @@ -42,7 +42,7 @@ jobs: uses: https://code.forgejo.org/actions/cache@v4 with: path: | - ./vendor/ + ./vendor/install key: cache-composer-phpunit-1 - name: Setup PHP @@ -54,9 +54,8 @@ jobs: env: runner: self-hosted - - name: Install PHP Unit + - name: Install PHPUnit and PHPUnit-Polyfills if: steps.cache-composer-phpunit.outputs.cache-hit != 'true' - # Polyfills requires all needed packages including phpunit itself. run: composer require --dev yoast/phpunit-polyfills:"^3.0" - name: Install and cache mysqladmin needed to initialize the test database -- 2.39.5 From 9a4351dc704c37af6089d4454986a3ef087631dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:37:49 +0200 Subject: [PATCH 26/30] better naming of jobs --- .forgejo/workflows/phpunit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index cf444ea..6d9f4a1 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: php-versions: ['8.1', '8.2', '8.3'] - name: Run phpunit tests + name: Run PHPunit ${{ matrix.php-version }} env: extensions: mysql key: cache-v1 @@ -48,7 +48,7 @@ jobs: - name: Setup PHP uses: https://github.com/shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php-version }} coverage: none tools: composer env: @@ -75,4 +75,4 @@ jobs: - name: Unit Testing run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit env: - PHP_VERSION: ${{ matrix.php-versions }} + PHP_VERSION: ${{ matrix.php-version }} -- 2.39.5 From e0b66de594b7ee892c8adc9033045feb8e53fd39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:41:17 +0200 Subject: [PATCH 27/30] test --- .forgejo/workflows/phpunit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 6d9f4a1..849e810 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -19,8 +19,8 @@ jobs: MYSQL_ROOT_PASSWORD: root strategy: matrix: - php-versions: ['8.1', '8.2', '8.3'] - name: Run PHPunit ${{ matrix.php-version }} + php-version: ['8.1', '8.2', '8.3'] + name: Run PHPUnit ${{ matrix.php-version }} env: extensions: mysql key: cache-v1 -- 2.39.5 From 943dcd8cb5a2547d6cbbaf52ddf5da3630ffb40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:42:19 +0200 Subject: [PATCH 28/30] test --- .forgejo/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 849e810..9ab9538 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: php-version: ['8.1', '8.2', '8.3'] - name: Run PHPUnit ${{ matrix.php-version }} + name: PHPUnit – PHP ${{ matrix.php-version }} env: extensions: mysql key: cache-v1 -- 2.39.5 From b4e6fef6659ed68fa7a756539524b5fc64168ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 13:44:44 +0200 Subject: [PATCH 29/30] test --- .forgejo/workflows/phpcs.yml | 2 +- .forgejo/workflows/phpunit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/phpcs.yml b/.forgejo/workflows/phpcs.yml index 5eddf5a..8a18ae7 100755 --- a/.forgejo/workflows/phpcs.yml +++ b/.forgejo/workflows/phpcs.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: php-versions: ['8.1'] - name: Run PHP Code Checker + name: PHP Code Checker env: extensions: mysql key: cache-v1 diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index 9ab9538..c961b3d 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -42,7 +42,7 @@ jobs: uses: https://code.forgejo.org/actions/cache@v4 with: path: | - ./vendor/install + ./vendor/ key: cache-composer-phpunit-1 - name: Setup PHP -- 2.39.5 From 3e5ee2d0456953a0806e87b6a46ee7b4746a4953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 21 Sep 2024 14:01:49 +0200 Subject: [PATCH 30/30] test --- .forgejo/workflows/phpunit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index c961b3d..e96a415 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -1,4 +1,5 @@ -name: Unit Testing +name: PHPUnit + on: push: branches: -- 2.39.5