Skip to content

Commit

Permalink
Merge pull request #109 from woocommerce/dev/4-phpcs
Browse files Browse the repository at this point in the history
Add PHP linter and PHP linting in GitHub Actions
  • Loading branch information
eason9487 authored Apr 19, 2024
2 parents fd33d05 + 4673ff7 commit e89cb26
Show file tree
Hide file tree
Showing 23 changed files with 587 additions and 121 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/php-coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PHP Coding Standards

on:
push:
branches:
- "trunk"
paths:
- "**.php"
- .github/workflows/php-coding-standards.yml
pull_request:
paths:
- "**.php"
- .github/workflows/php-coding-standards.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
with:
php-version: 7.4
tools: cs2pr
install-deps: "no"

- name: Install Composer dependencies
run: |
# Skip installing packages from private repos.
composer remove --dev woocommerce/woorelease
composer install --prefer-dist --no-interaction
- name: Log PHPCS information
run: vendor/bin/phpcs -i

- name: Run PHPCS on all files
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Grow Packages

[![JavaScript Linting](https://github.com/woocommerce/grow/actions/workflows/js-linting.yml/badge.svg)](https://github.com/woocommerce/grow/actions/workflows/js-linting.yml)
[![PHP Coding Standards](https://github.com/woocommerce/grow/actions/workflows/php-coding-standards.yml/badge.svg)](https://github.com/woocommerce/grow/actions/workflows/php-coding-standards.yml)

This repository is a container for packages, mostly dev tools to serve the Grow Team.
The packages here are too experimental or too Grow-specific to be shared Woo-wide.
Expand Down
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"phpcompatibility/php-compatibility": "^9.0",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"woocommerce/woorelease": "^2.4",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-coding-standards/wpcs": "^3.0"
},
"repositories": [
{
Expand All @@ -38,5 +40,10 @@
"scripts-descriptions": {
"assumeReleaseUnchanged": "Tell Git to assume that the 'release.txt' file is unchanged. This allows changes in this file to be ignored by Git.",
"noAssumeReleaseUnchanged": "Tell Git to stop assuming that the 'release.txt' file is unchanged, and track it normally."
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
297 changes: 296 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e89cb26

Please sign in to comment.