Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Featrure/use new phpcs setup #14

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.txt]
end_of_line = crlf
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bug report
description: Create a bug report to help us improve.
body:
- type: textarea
id: description
attributes:
label: Description
validations:
required: true

- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Start at `site-domain.com/blog`.
2. Click on any blog post.
3. Click on the 'Like' button.
4. ...

Attach any media by drag and dropping or selecting upload.

- type: textarea
id: expected
attributes:
label: What you expected to happen
placeholder: |
e.g. The post should be liked.

- type: textarea
id: actual
attributes:
label: What actually happened
placeholder: |
e.g. Clicking the button does nothing visibly.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Feature request
description: Create a feature request for this project.
body:
- type: textarea
id: description
attributes:
label: Description
description: Add a concise description of the feature being requested.
placeholder: What will this feature accomplish?
validations:
required: true

- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
placeholder: Add links to previous work or other sites that do something similar.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#### Changes proposed in this Pull Request

*

#### Testing instructions

<!--
Add as many details as possible to help others reproduce the issue and test the fix.
"Before / After" screenshots can also be very helpful when the change is visual.
-->

*

Mentions #
42 changes: 42 additions & 0 deletions .github/workflows/php-coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PHP Coding Standards

on:
pull_request:
branches: [ trunk, develop ]

jobs:
build:
strategy:
matrix:
php: [ 8.2 ]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup proper PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer

- name: Validate composer.json and composer.lock
run: composer validate --strict

- 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 run-script packages-install

- name: Run PHP_CodeSniffer
run: composer run-script lint:php
31 changes: 31 additions & 0 deletions .github/workflows/php-syntax-errors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PHP Syntax Errors

on:
push:
branches: [ trunk, develop ]
pull_request:
branches: [ trunk, develop ]

jobs:
build:
strategy:
matrix:
php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] # Include all PHP versions between the absolute minimum that shouldn't throw an error and the latest release version.

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup proper PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Check all files for syntax errors
if: ${{ matrix.php >= 8.0 }} # At least the minimum PHP version required by the plugin.
run: find -L $GITHUB_WORKSPACE -path $GITHUB_WORKSPACE/vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

- name: Check bootstrap files for syntax errors
if: ${{ matrix.php <= 7.4 }}
run: find $GITHUB_WORKSPACE -maxdepth 1 -name 'colophon.php' -print0 | xargs -0 -n 1 -P 4 php -l
Loading