diff --git a/.github/bin/phpcs-branch.php b/.github/bin/phpcs-branch.php deleted file mode 100644 index 45ff9da..0000000 --- a/.github/bin/phpcs-branch.php +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/php - $name.diff" ); - exec( "$git show $base_branch:$file | $bin_dir/phpcs --standard=./phpcs.xml.dist --report=json -nq > $name.orig.phpcs" ); - exec( "cat $file | $bin_dir/phpcs --standard=./phpcs.xml.dist --report=json -nq > $name.phpcs" ); - - $cmd = "$bin_dir/phpcs-changed --diff $name.diff --phpcs-orig $name.orig.phpcs --phpcs-new $name.phpcs"; - exec( $cmd, $output, $exec_exit_status ); - echo implode( "\n", $output ); - echo "\n"; - - exec( "rm $name.diff $name.orig.phpcs $name.phpcs" ); - return $exec_exit_status; -} - -function main() { - $base_branch = 'remotes/origin/' . getenv( 'BASE_REF' ); - $git_dir = dirname( dirname( __DIR__ ) ); - $bin_dir = dirname( dirname( __DIR__ ) ) . '/public_html/wp-content/mu-plugins/vendor/bin'; - $git = "git -C $git_dir"; - - try { - echo "\nScanning changed files...\n"; - $status = 0; - - $affected_files = shell_exec( "$git diff $base_branch --name-status --diff-filter=AM 2>&1 | grep .php$" ); - $affected_files = explode( "\n", trim( $affected_files ) ); - - foreach ( $affected_files as $record ) { - if ( ! $record ) { - continue; - } - - list( $change, $file ) = explode( "\t", trim( $record ) ); - $cmd_status = 0; - - switch ( $change ) { - case 'M': - $cmd_status = run_phpcs_changed( $file, $git, $base_branch, $bin_dir ); - break; - - case 'A': - $cmd_status = run_phpcs( $file, $bin_dir ); - break; - } - - // If any cmd exits with 1, we want to exit with 1. - $status |= $cmd_status; - } - - } catch ( Exception $exception ) { - echo "\nAborting because of error: {$exception->getMessage()} \n"; - $status = 1; - - } - - exit( $status ); -} - -main(); diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aff4eb1..fa6452f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,10 +43,6 @@ jobs: composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction echo "${PWD}/mu-plugins/vendor/bin" >> $GITHUB_PATH - - name: Lint PHP - run: | - BASE_REF=${{ github.base_ref }} php .github/bin/phpcs-branch.php - phpunit: name: PHP Unit Tests