From e275f327465c43f4228d0adad1ea3a1351523928 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Mon, 19 Feb 2024 14:00:50 +0000 Subject: [PATCH 1/4] adds phpstan, phmd to pipeline --- .github/workflows/php.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4716d71..58ec6f0 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,5 +32,11 @@ jobs: - name: PHP Lint run: composer lint - - name: PHP test + - name: PHPStan + run: composer phpstan + + - name: PHPMD + run: composer phpmd + + - name: WordPress unit test run: composer test:unit From 1f15fe28f54d077baea0746b52510c02677997b6 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Mon, 19 Feb 2024 14:11:54 +0000 Subject: [PATCH 2/4] try to fix phpmd error --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3f65f7f..5649bcf 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,6 @@ "test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text", "phpstan": "phpstan analyse --memory-limit=2048M", "phpstan-baseline": "phpstan analyse -b --allow-empty-baseline --memory-limit=2048M", - "phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color" + "phpmd": "./vendor/bin/phpmd plugin.php,includes text phpmd.xml.dist --color" } } From 6f59ec5bc045731fdf02485b12748912380e15c6 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Mon, 19 Feb 2024 14:34:48 +0000 Subject: [PATCH 3/4] use different phpsetup in github action --- .github/workflows/php.yml | 15 +++++++++++---- .wp-env.json | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 58ec6f0..36d3190 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,21 +14,28 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache Composer dependencies uses: actions/cache@v4 with: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - name: Setup PHP - uses: php-actions/composer@v6 + - name: Setup PHP with tools + uses: shivammathur/setup-php@v2 with: - php_version: ${{ matrix.php-versions }} - command: update + php-version: '8.3' + tools: composer:v2 - name: Validate Composer run: composer validate --strict + - name: Install dependencies + run: composer install --prefer-dist + - name: PHP Lint run: composer lint diff --git a/.wp-env.json b/.wp-env.json index 1354cad..2a95c30 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,4 +1,5 @@ { "core": null, - "plugins": ["."] + "plugins": ["."], + "phpVersion": "8.3" } From 5572ad9aac69b9125a1991405855a5d9885a05fd Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Mon, 19 Feb 2024 14:44:38 +0000 Subject: [PATCH 4/4] use phpmd directly --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5649bcf..3f65f7f 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,6 @@ "test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text", "phpstan": "phpstan analyse --memory-limit=2048M", "phpstan-baseline": "phpstan analyse -b --allow-empty-baseline --memory-limit=2048M", - "phpmd": "./vendor/bin/phpmd plugin.php,includes text phpmd.xml.dist --color" + "phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color" } }