Skip to content

Commit

Permalink
Merge cadabff into ddfeb6e
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE authored Nov 18, 2024
2 parents ddfeb6e + cadabff commit 896c58f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# User PHP 7.4 here for compatibility with the WordPress codesniffer rules.
- name: Setup PHP
Expand All @@ -32,32 +32,41 @@ jobs:
coverage: none
tools: composer, cs2pr

- uses: technote-space/get-diff-action@v6
- uses: technote-space/get-diff-action@v6 # repo is archived.
with:
SUFFIX_FILTER: .php

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
if: "!! env.GIT_DIFF"

- name: Cache Composer vendor directory
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
if: "!! env.GIT_DIFF"
- name: Validate composer.json and composer.lock
run: composer validate
if: "!! env.GIT_DIFF"

- name: Install dependencies
run: composer install --no-progress --optimize-autoloader --prefer-dist
if: "!! env.GIT_DIFF"

- name: Fix auto-fixable PHP Code Standards Violations
continue-on-error: true
run: vendor/bin/phpcbf --standard=phpcs.xml

- name: Commit PHPCBF changes on main
if: ${{ github.ref == 'refs/heads/main' }} # only commit on main
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖 PHPCBF"
commit_options: ""
env:
GITHUB_TOKEN: "${{ github.token }}"

- name: Detecting PHP Code Standards Violations
run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }}
run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }} --report=checkstyle | cs2pr
if: "!! env.GIT_DIFF"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, ready_for_review, synchronize ]
branches:
- main
workflow_dispatch:

jobs:

Expand All @@ -25,7 +30,7 @@ jobs:

strategy:
matrix:
php: [ '7.4' ]
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

steps:
- name: Checkout
Expand Down Expand Up @@ -102,6 +107,7 @@ jobs:
run: php-coverage-badger gh-pages/phpunit/clover.xml gh-pages/phpunit/coverage.svg

- name: Commit code coverage to gh-pages
if: ${{ github.ref == 'refs/heads/main' && matrix.php-version == '7.3' }} # only commit on main, on the PHP version we're using in production.
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: gh-pages
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/includes/HiiveConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function ( $request_response ) {
*
* @see https://github.com/10up/wp_mock/pull/246
*/
WP_Mock::userFunction( 'NewfoldLabs\WP\Module\Data\remove_filter' )
WP_Mock::userFunction( 'remove_filter' )
->once()
->with( 'http_headers_useragent', array( $sut, 'add_plugin_name_version_to_user_agent' ) );

Expand Down Expand Up @@ -343,7 +343,7 @@ function ( string $constant_name ) use ( $temp_dir ) {
*
* @see https://github.com/10up/wp_mock/pull/246
*/
WP_Mock::userFunction( 'NewfoldLabs\WP\Module\Data\remove_filter' )
WP_Mock::userFunction( 'remove_filter' )
->twice()
->with( 'http_headers_useragent', array( $sut, 'add_plugin_name_version_to_user_agent' ) );

Expand Down

0 comments on commit 896c58f

Please sign in to comment.