From 3de7393b1fd6f40899e3d8d833eafdbf901071b9 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Thu, 23 Nov 2023 15:11:57 +0500 Subject: [PATCH 1/6] Version: 6.22.1-dev --- cleantalk.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cleantalk.php b/cleantalk.php index ec36486b3..01fa0d475 100644 --- a/cleantalk.php +++ b/cleantalk.php @@ -4,7 +4,7 @@ Plugin Name: Anti-Spam by CleanTalk Plugin URI: https://cleantalk.org Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. - Version: 6.22 + Version: 6.22.1-dev Author: СleanTalk - Anti-Spam Protection Author URI: https://cleantalk.org Text Domain: cleantalk-spam-protect From 2c1fa29380e35304c501348a964db93c077809cb Mon Sep 17 00:00:00 2001 From: Glomberg Date: Thu, 23 Nov 2023 13:16:26 +0300 Subject: [PATCH 2/6] Upd. Code. Auto tests replaced to github action instead of travis. --- .github/workflows/eslint.yml | 15 ++++++++- .github/workflows/tests.yml | 64 ++++++++++++++++++++++++++++++++++++ .travis.yml | 60 --------------------------------- 3 files changed, 78 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 41744ef11..222059f00 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -33,4 +33,17 @@ jobs: # list of things to do run: npm i - name: Code Linting - run: npm run eslint \ No newline at end of file + run: npm run eslint + + - name: Telegram notify + if: failure() + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_PLUGINS_TO }} + token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }} + message: | + Hi, ${{ github.actor }}! Your commit for ${{ github.repository }} + contains 💯 the best solution but it have to be fixed! + Auto-Tests (PHPUnit, PHPCS, Psalm) build failed ⛔! + format: html + disable_web_page_preview: true \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..fa9f6d1b7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,64 @@ +name: Auto-Tests (PHPUnit, PHPCS, Psalm) running. + +on: # event list + push: # on push to each of these branches + branches: + - dev + - fix + - master + pull_request: + branches: + - dev + - master + +env: # environment variables (available in any part of the action) + PHP_VERSION: 7.4 + +jobs: + build: + name: PHPUnit, PHPCS, Psalm + runs-on: ubuntu-latest + env: + DB_CONNECTION: mysql + DB_HOST: localhost + DB_PORT: 3306 + DB_DATABASE: wordpress_test + DB_USERNAME: root + DB_PASSWORD: root + + steps: + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.PHP_VERSION }} + + - name: Run MySQL server + run: sudo systemctl start mysql + + - name: Code Checkout + uses: actions/checkout@v4 + + - name: Make the script files executable + run: chmod +x ./tests/wp-test-setup.sh + + - name: Install WP develop + run: ./tests/wp-test-setup.sh wordpress_test root root localhost latest + + - name: Install Dependencies + run: composer i + + - name: Running tests + run: composer test + + - name: Telegram notify + if: failure() + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_PLUGINS_TO }} + token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }} + message: | + Hi, ${{ github.actor }}! Your commit for ${{ github.repository }} + contains 💯 the best solution but it have to be fixed! + Auto-Tests (PHPUnit, PHPCS, Psalm) build failed ⛔! + format: html + disable_web_page_preview: true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a3a1301a5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -dist: trusty - -os: linux - -language: php - -notifications: - email: - recipients: - - plugins@cleantalk.org - on_failure: always - on_success: never - -branches: - only: - - master - - dev - - fix - -jobs: - include: - - env: TRAVISCI=phpunit - - env: TRAVISCI=phpcs - - env: TRAVISCI=psalm - -before-install: - - composer self-update --2 - -before_script: - - source tests/wp-test-setup.sh wordpress_test root '' localhost latest - - | - if [[ "$TRAVISCI" == "phpunit" ]] ; then - composer require phpunit/phpunit 7.* - fi - - | - if [[ "$TRAVISCI" == "phpcs" ]] ; then - composer require squizlabs/php_codesniffer - composer require phpcompatibility/php-compatibility - vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility - fi - - | - if [[ "$TRAVISCI" == "psalm" ]] ; then - composer require phpunit/phpunit 7.* - composer require vimeo/psalm - fi - -script: - - | - if [[ "$TRAVISCI" == "phpunit" ]] ; then - vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-text - fi - - | - if [[ "$TRAVISCI" == "phpcs" ]] ; then - vendor/bin/phpcs --standard=tests/.phpcs.xml - fi - - | - if [[ "$TRAVISCI" == "psalm" ]] ; then - vendor/bin/psalm --no-cache --config=psalm.xml - vendor/bin/psalm --no-cache --config=psalm.xml --taint-analysis - fi \ No newline at end of file From 5ae1067ad8471bc1c59c206ee23925c92020253d Mon Sep 17 00:00:00 2001 From: Glomberg Date: Thu, 23 Nov 2023 13:24:09 +0300 Subject: [PATCH 3/6] Upd. Code. WP develop installation fixed. --- tests/wp-test-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wp-test-setup.sh b/tests/wp-test-setup.sh index b26475a98..83f3f9b25 100644 --- a/tests/wp-test-setup.sh +++ b/tests/wp-test-setup.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $# -lt 3 ]; then echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" From af7e7e1f9e38fdb752aca7a23884f9dbee8b3050 Mon Sep 17 00:00:00 2001 From: Glomberg Date: Thu, 23 Nov 2023 13:32:21 +0300 Subject: [PATCH 4/6] Upd. Code. Composer config fixed. --- composer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index abd4f9c27..4c16ad877 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "email": "plugins@cleantalk.org" } ], - "require": { + "require-dev": { "vimeo/psalm": "^4.8", "phpunit/phpunit": "^7.5", "squizlabs/php_codesniffer": "3.*", @@ -30,5 +30,10 @@ "just_phpunit": [ "vendor/bin/phpunit --configuration tests/phpunit.xml --debug" ] + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } From 0b08591607d0042c342688aa7e8eaaaaaf23899e Mon Sep 17 00:00:00 2001 From: Glomberg Date: Thu, 23 Nov 2023 14:31:28 +0300 Subject: [PATCH 5/6] Fix. Code. Secret availability for github action fixed. --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa9f6d1b7..a05d1c11f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,6 +48,8 @@ jobs: run: composer i - name: Running tests + env: + CLEANTALK_TEST_API_KEY: ${{ secrets.CLEANTALK_TEST_API_KEY }} run: composer test - name: Telegram notify From 0f937e8d3abf481e6d5e936534dfa4104a3b6eca Mon Sep 17 00:00:00 2001 From: Glomberg Date: Thu, 23 Nov 2023 14:32:02 +0300 Subject: [PATCH 6/6] Fix. Code. `Helper::httpMultiRequest()` test fixed. --- tests/Common/HelperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Common/HelperTest.php b/tests/Common/HelperTest.php index d7fcc4340..1c17a1efc 100644 --- a/tests/Common/HelperTest.php +++ b/tests/Common/HelperTest.php @@ -13,7 +13,7 @@ public function test_http__multi_request_error() { } public function test_http__multi_request_success() { - $res = Helper::httpMultiRequest( array('https://google.com', 'https://microsoft.com') ); + $res = Helper::httpMultiRequest( array('https://google.com', 'https://apple.com') ); $this->assertIsArray( $res ); $this->assertContainsOnly( 'string', $res ); }