-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from alleyinteractive/feature/ci-tests
Adding CI tests
- Loading branch information
Showing
18 changed files
with
912 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Dotfiles | ||
[.*] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Exclude these files from release archives. | ||
# | ||
# This will also make the files unavailable when using Composer with `--prefer-dist`. | ||
# | ||
# Via WPCS. | ||
# | ||
/.github export-ignore | ||
/phpunit.xml export-ignore | ||
/tests export-ignore | ||
|
||
# | ||
# Auto detect text files and perform LF normalization. | ||
# | ||
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ | ||
# | ||
* text=auto | ||
|
||
# | ||
# The above will handle all files not found below. | ||
# | ||
*.md text | ||
*.php text | ||
*.inc text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run general tests | ||
uses: alleyinteractive/action-test-general@develop | ||
|
||
- name: Run PHP Tests | ||
uses: alleyinteractive/action-test-php@develop | ||
with: | ||
skip-services: 'true' | ||
wordpress-version: 'false' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ composer.lock | |
# IDEs | ||
.idea | ||
.vscode | ||
.DS_Store | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,98 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Alley Interactive" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"> | ||
<description>The Alley Interactive PHP coding standard.</description> | ||
|
||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<exclude-pattern>*\.js$</exclude-pattern> | ||
<exclude-pattern>*\.css$</exclude-pattern> | ||
|
||
<!-- Use the WordPress ruleset, with some customizations. --> | ||
<rule ref="WordPress"> | ||
<!-- Allow short array syntax. --> | ||
<exclude name="Universal.Arrays.DisallowShortArraySyntax" /> | ||
<!-- Allow short ternary expressions --> | ||
<exclude name="Universal.Operators.DisallowShortTernary.Found" /> | ||
<!-- Allow any name to be used as a function paramater name. --> | ||
<exclude name="Universal.NamingConventions.NoReservedKeywordParameterNames" /> | ||
<!-- Allow post-increment/decrement vs disallowing it. --> | ||
<exclude name="Universal.Operators.DisallowStandalonePostIncrementDecrement" /> | ||
<!-- Allow checking any capability. --> | ||
<exclude name="WordPress.WP.Capabilities.Undetermined" /> | ||
<exclude name="WordPress.WP.Capabilities.Unknown" /> | ||
</rule> | ||
|
||
<!-- Use the VIP Go ruleset. --> | ||
<rule ref="WordPress-VIP-Go" /> | ||
|
||
<!-- Use the PHPCompatibilityWP rules --> | ||
<rule ref="PHPCompatibilityWP" /> | ||
|
||
<!-- Check for cross-version support for PHP 8.1 and higher. --> | ||
<config name="testVersion" value="8.1-"/> | ||
|
||
<!-- | ||
Alley specific customizations. | ||
--> | ||
|
||
<!-- We prefer short array syntax. --> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
<rule ref="WordPress"> | ||
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/> | ||
</rule> | ||
|
||
<!-- Allow for common global prefixes used in Alley code. --> | ||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> | ||
<properties> | ||
<property name="prefixes" type="array" value="wp_starter_theme,ai_,_ai" /> | ||
</properties> | ||
|
||
<!-- In practice, partials should be loaded outside of the global namespace with get_template_part(). --> | ||
<exclude-pattern>template-parts/</exclude-pattern> | ||
<exclude-pattern>vendor/</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Keep common boilerplate code from triggering an error. --> | ||
<rule ref="Squiz.Commenting.FileComment.SpacingAfterComment"> | ||
<!-- | ||
Downgrade while so many PHP files are empty to start with. | ||
The empty file makes it difficult to comply with this rule | ||
and the trailing newline rule at the same time. | ||
--> | ||
<type>warning</type> | ||
|
||
<!-- | ||
Once your PHP files have been filled in, you might be able | ||
to start checking for compliance again with an | ||
exclude-pattern like these: | ||
<exclude-pattern>themes(/vip)?/[^/]+/[^/]+\.php$</exclude-pattern> | ||
<exclude-pattern>themes(/vip)?/[^/]+/template-parts/*</exclude-pattern> | ||
--> | ||
</rule> | ||
|
||
<!-- Encourage having only one class/interface/trait per file. --> | ||
<rule ref="Generic.Files.OneObjectStructurePerFile"> | ||
<!-- | ||
Increase severity. If it becomes a problem for this sniff to trigger an | ||
error, then we might want to provide feedback to the WPCS maintainers. | ||
See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/1111. | ||
--> | ||
<type>error</type> | ||
</rule> | ||
|
||
<!-- Ignore an issue with singleton classes instance methods being flagged. --> | ||
<rule ref="Universal.CodeAnalysis.ConstructorDestructorReturn.ReturnValueFound"> | ||
<exclude-pattern>(class|trait)-(instance|singleton).php</exclude-pattern> | ||
</rule> | ||
<description>The Alley Interactive PHP coding standard.</description> | ||
|
||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<exclude-pattern>*\.js$</exclude-pattern> | ||
<exclude-pattern>*\.css$</exclude-pattern> | ||
|
||
<!-- Use the WordPress ruleset, with some customizations. --> | ||
<rule ref="WordPress"> | ||
<!-- Allow short array syntax. --> | ||
<exclude name="Universal.Arrays.DisallowShortArraySyntax" /> | ||
<!-- Allow short ternary expressions --> | ||
<exclude name="Universal.Operators.DisallowShortTernary.Found" /> | ||
<!-- Allow any name to be used as a function paramater name. --> | ||
<exclude name="Universal.NamingConventions.NoReservedKeywordParameterNames" /> | ||
<!-- Allow post-increment/decrement vs disallowing it. --> | ||
<exclude name="Universal.Operators.DisallowStandalonePostIncrementDecrement" /> | ||
<!-- Allow checking any capability. --> | ||
<exclude name="WordPress.WP.Capabilities.Undetermined" /> | ||
<exclude name="WordPress.WP.Capabilities.Unknown" /> | ||
</rule> | ||
|
||
<!-- Use the VIP Go ruleset. --> | ||
<rule ref="WordPress-VIP-Go" /> | ||
|
||
<!-- Use the PHPCompatibilityWP rules --> | ||
<rule ref="PHPCompatibilityWP" /> | ||
|
||
<!-- Check for cross-version support for PHP 8.1 and higher. --> | ||
<config name="testVersion" value="8.1-"/> | ||
|
||
<!-- | ||
Alley specific customizations. | ||
--> | ||
|
||
<!-- We prefer short array syntax. --> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
<rule ref="WordPress"> | ||
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/> | ||
</rule> | ||
|
||
<!-- Allow for common global prefixes used in Alley code. --> | ||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> | ||
<properties> | ||
<property name="prefixes" type="array" value="wp_starter_theme,ai_,_ai" /> | ||
</properties> | ||
|
||
<!-- In practice, partials should be loaded outside of the global namespace with get_template_part(). --> | ||
<exclude-pattern>template-parts/</exclude-pattern> | ||
<exclude-pattern>vendor/</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Keep common boilerplate code from triggering an error. --> | ||
<rule ref="Squiz.Commenting.FileComment.SpacingAfterComment"> | ||
<!-- | ||
Downgrade while so many PHP files are empty to start with. | ||
The empty file makes it difficult to comply with this rule | ||
and the trailing newline rule at the same time. | ||
--> | ||
<type>warning</type> | ||
|
||
<!-- | ||
Once your PHP files have been filled in, you might be able | ||
to start checking for compliance again with an | ||
exclude-pattern like these: | ||
<exclude-pattern>themes(/vip)?/[^/]+/[^/]+\.php$</exclude-pattern> | ||
<exclude-pattern>themes(/vip)?/[^/]+/template-parts/*</exclude-pattern> | ||
--> | ||
</rule> | ||
|
||
<!-- Encourage having only one class/interface/trait per file. --> | ||
<rule ref="Generic.Files.OneObjectStructurePerFile"> | ||
<!-- | ||
Increase severity. If it becomes a problem for this sniff to trigger an | ||
error, then we might want to provide feedback to the WPCS maintainers. | ||
See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/1111. | ||
--> | ||
<type>error</type> | ||
</rule> | ||
|
||
<!-- Ignore an issue with singleton classes instance methods being flagged. --> | ||
<rule ref="Universal.CodeAnalysis.ConstructorDestructorReturn.ReturnValueFound"> | ||
<exclude-pattern>(class|trait)-(instance|singleton).php</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Allow PSR-4 file format for test files --> | ||
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> | ||
<exclude-pattern>tests/*Test.php</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Allow PSR-4 file format for test files --> | ||
<rule ref="WordPress.Files.FileName.InvalidClassFileName"> | ||
<exclude-pattern>tests/*Test.php</exclude-pattern> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Changelog | ||
|
||
This project adheres to [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). | ||
|
||
This project adheres to [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). | ||
|
||
### Unreleased | ||
|
||
- Allow PSR-4 style `ClassName.php` file names to support our migration to PSR-4 for test files. | ||
|
||
### 2.0.2 | ||
|
||
- Fix issue with files with `js`/`css` in the path being ignored. | ||
- Bumping to PHP 8.1. | ||
|
||
### 2.0.1 | ||
|
||
- Update "Prefer array syntax" rule to 3.0. | ||
|
||
### 2.0.0 | ||
|
||
- **Breaking Change:** Upgraded to `automattic/vipwpcs` and | ||
`wp-coding-standards/wpcs` to 3.0. See [Upgrading to 2.0](https://github.com/alleyinteractive/alley-coding-standards/wiki/Upgrading-to-2.0) | ||
for more details. | ||
|
||
### 1.0.1 | ||
|
||
- Ignore deprecation errors in WPCS to allow it work with PHP 8.0+. | ||
|
||
### 1.0.0 | ||
|
||
- No changes, tagging a stable release of Alley Coding Standards. | ||
|
||
### 0.4.1 | ||
|
||
- Upgrading to `automattic/vipwpcs` v2.3.3 and `dealerdirect/phpcodesniffer-composer-installer` v0.7.2. | ||
|
||
### 0.4.0 | ||
|
||
- Add PHPCompatibilityWP sniffs to our rules, configured for PHP 8.0+ | ||
- Make template-parts rule checking more ambiguous to better support scanning standalone plugins and themes | ||
- Added `static analysis` keyword to Composer to promote package to be installed with `--dev`. | ||
|
||
### 0.3.0 | ||
|
||
- Add PHPCompatibilityWP standard as a dependency (#9) | ||
- Exclude plugin template parts from WordPress.NamingConventions.PrefixAllGlobals sniff (#11) | ||
- Remove 'wp_cache_set' from forbidden functions (#12) | ||
|
||
### 0.2.0 | ||
|
||
- Sniff name changed to Alley-Interactive. | ||
- Composer package renamed to `alleyinteractive/alley-coding-standards`. | ||
- Allow short ternary syntax (#6) | ||
|
||
### 0.1.0 | ||
|
||
- Initial release. |
Oops, something went wrong.