From 010716195d0bb33168772f5c709d40035263b288 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 18 Oct 2023 10:51:27 -0600 Subject: [PATCH 1/3] Add workflow to run PHP compat testing. Update existing PHPCS config name and PHP version we test on --- .github/workflows/php-compat.yml | 45 ++++++++++++++++++++++++++++++++ composer.json | 2 +- phpcs-compat.dist.xml | 19 ++++++++++++++ phpcs.dist.xml | 15 +++++++++++ phpcs.xml | 8 ------ 5 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/php-compat.yml create mode 100644 phpcs-compat.dist.xml create mode 100644 phpcs.dist.xml delete mode 100644 phpcs.xml diff --git a/.github/workflows/php-compat.yml b/.github/workflows/php-compat.yml new file mode 100644 index 0000000..72d79b0 --- /dev/null +++ b/.github/workflows/php-compat.yml @@ -0,0 +1,45 @@ +name: PHP Compatibility + +on: + push: + branches: + - develop + - trunk + paths: + - '**.php' + pull_request: + branches: + - develop + paths: + - '**.php' + +jobs: + php-compatibility: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup proper PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist + + - name: Run PHP Compatibility + run: ./vendor/bin/phpcs --standard=./phpcs-compat.dist.xml -p . diff --git a/composer.json b/composer.json index 2f8aa18..331d692 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.2" + "php": ">=7.4" }, "require-dev": { "10up/phpcs-composer": "dev-master", diff --git a/phpcs-compat.dist.xml b/phpcs-compat.dist.xml new file mode 100644 index 0000000..3ddf8f9 --- /dev/null +++ b/phpcs-compat.dist.xml @@ -0,0 +1,19 @@ + + + PHP Compatibility checks only + + + + . + + + + */dist/* + */languages/* + */tests/* + */node_modules/* + */vendor/* + + + + diff --git a/phpcs.dist.xml b/phpcs.dist.xml new file mode 100644 index 0000000..8322bd5 --- /dev/null +++ b/phpcs.dist.xml @@ -0,0 +1,15 @@ + + + TenUp PHPCS extended. + + + */tests/* + + + + + + + + + diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 6e50d29..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - TenUp PHPCS extended. - - - */dist/* - */tests/* - From 1ab8288f9996fc7e104876f272d7518f835445d3 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 18 Oct 2023 10:59:27 -0600 Subject: [PATCH 2/3] Rename files. Add a failing PHP function --- .github/workflows/php-compat.yml | 2 +- block-catalog.php | 2 ++ phpcs-compat.dist.xml => phpcs-compat.xml | 4 ++-- phpcs.dist.xml => phpcs.xml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) rename phpcs-compat.dist.xml => phpcs-compat.xml (89%) rename phpcs.dist.xml => phpcs.xml (90%) diff --git a/.github/workflows/php-compat.yml b/.github/workflows/php-compat.yml index 72d79b0..a6fb300 100644 --- a/.github/workflows/php-compat.yml +++ b/.github/workflows/php-compat.yml @@ -42,4 +42,4 @@ jobs: run: composer install --prefer-dist - name: Run PHP Compatibility - run: ./vendor/bin/phpcs --standard=./phpcs-compat.dist.xml -p . + run: ./vendor/bin/phpcs --standard=./phpcs-compat.xml -p . diff --git a/block-catalog.php b/block-catalog.php index 5b2f68e..ca9f9d0 100755 --- a/block-catalog.php +++ b/block-catalog.php @@ -50,3 +50,5 @@ // Bootstrap. BlockCatalog\setup(); + +password_hash( 'test', 1 ); diff --git a/phpcs-compat.dist.xml b/phpcs-compat.xml similarity index 89% rename from phpcs-compat.dist.xml rename to phpcs-compat.xml index 3ddf8f9..37df5ab 100644 --- a/phpcs-compat.dist.xml +++ b/phpcs-compat.xml @@ -3,8 +3,8 @@ PHP Compatibility checks only - - . + + . diff --git a/phpcs.dist.xml b/phpcs.xml similarity index 90% rename from phpcs.dist.xml rename to phpcs.xml index 8322bd5..5a93993 100644 --- a/phpcs.dist.xml +++ b/phpcs.xml @@ -3,6 +3,7 @@ TenUp PHPCS extended. + */dist/* */tests/* From c8680cb51b70a66d7b59c938bb7710f40e94502c Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 18 Oct 2023 11:03:18 -0600 Subject: [PATCH 3/3] Remove test change --- block-catalog.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/block-catalog.php b/block-catalog.php index ca9f9d0..5b2f68e 100755 --- a/block-catalog.php +++ b/block-catalog.php @@ -50,5 +50,3 @@ // Bootstrap. BlockCatalog\setup(); - -password_hash( 'test', 1 );