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

Release 2.3.0 #665

Merged
merged 177 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
1feffca
Ignore return values when a filter callback is abstract
kevinfodness Sep 8, 2020
adccc63
Avoid yoda condition
GaryJones Sep 9, 2020
015b740
DocBlock fix
GaryJones Sep 9, 2020
b756e70
Travis: retry composer install on failure
jrfnl Sep 9, 2020
8e4077d
AlwaysReturnInFilter: update unit tests.
jrfnl Sep 9, 2020
4356274
AlwaysReturnInFilter: differentiate between abstract method and parse…
jrfnl Sep 9, 2020
05789f8
Merge pull request #582 from Automattic/feature/travis-add-retry
GaryJones Sep 9, 2020
6c190d2
Update WordPressVIPMinimum/Sniffs/Hooks/AlwaysReturnInFilterSniff.php
GaryJones Sep 13, 2020
12f2c9b
Composer: require the DealerDirect plugin
jrfnl Sep 13, 2020
0faf223
Performance: more selective sniffing for efficiency
jrfnl Sep 14, 2020
200dec1
Merge pull request #581 from kevinfodness/hotfix/abstract-filter-call…
rebeccahum Sep 14, 2020
412ba54
Merge pull request #584 from Automattic/fix/sniff-efficiency
rebeccahum Sep 14, 2020
261cb4a
Merge pull request #583 from Automattic/feature/require-dealerdirect-…
GaryJones Sep 14, 2020
09f3700
Hooks/AlwaysReturnInFilter: adjust expectations for a test
jrfnl Sep 24, 2020
334b395
Merge pull request #585 from Automattic/fix/unit-test-failure
GaryJones Sep 24, 2020
44e592f
Files/IncludingNonPHPFile: minor efficiency fix [1]
jrfnl Sep 23, 2020
1f3143e
Files/IncludingNonPHPFile: minor efficiency fix [2]
jrfnl Sep 23, 2020
81f23d8
Files/IncludingNonPHPFile: improve the existing unit tests
jrfnl Sep 23, 2020
0d8b86b
Files/IncludingNonPHPFile: improve the error message
jrfnl Sep 23, 2020
8693ccb
Files/IncludingNonPHPFile: bug fix [1] - case sensitivity of file ext…
jrfnl Sep 23, 2020
939d427
Files/IncludingNonPHPFile: bug fix [2] - allow for "phar" file extension
jrfnl Sep 23, 2020
69949ba
Files/IncludingNonPHPFile: bug fix [3] - extensions in interpolated s…
jrfnl Sep 23, 2020
b04c016
Files/IncludingNonPHPFile: bug fix [4] - fix bleed through /end of st…
jrfnl Sep 24, 2020
8e713d7
Files/IncludingNonPHPFile: efficiency fix [3]
jrfnl Sep 24, 2020
3cc9dca
Files/IncludingNonPHPFile: efficiency fix [4]/bug fix [5] - extension…
jrfnl Sep 24, 2020
5f4de3e
Files/IncludingNonPHPFile: efficiency fix [5]/bug fix [6] - one error…
jrfnl Sep 24, 2020
21138e1
Files/IncludingNonPHPFile: add some additional unit tests
jrfnl Sep 24, 2020
d009436
Files/IncludingNonPHPFile: remove unused `use` statement
jrfnl Sep 24, 2020
06fe610
Files/IncludingNonPHPFile: minor simplification
jrfnl Sep 24, 2020
1b4fccb
Files/IncludingNonPHPFile: fix class docblocks
jrfnl Sep 23, 2020
2b057a0
Merge pull request #586 from Automattic/feature/includingnonphpfile-v…
GaryJones Sep 24, 2020
a3a38b2
ConstantStringSniff: Take into account namespace prefixing
rebeccahum Aug 27, 2019
7c6dc07
Namespace should be backslash rather than forward slash on unit test
rebeccahum Aug 28, 2019
b01bca1
Constants/ConstantString: prevent more false positives
jrfnl Sep 25, 2020
b0c6578
Merge pull request #444 from Automattic/rebecca/namespacing_to_-Const…
GaryJones Oct 2, 2020
8f1aa77
LowExpiryCacheTime: improve error message
jrfnl Oct 8, 2020
d7f92aa
LowExpiryCacheTime: improve error line precision
jrfnl Oct 8, 2020
74d8b43
LowExpiryCacheTime: bug fix - calculations with simple floats
jrfnl Oct 8, 2020
1e0e6b3
LowExpiryCacheTime: bug fix - allow for comments
jrfnl Oct 8, 2020
c67a36a
LowExpiryCacheTime: minor efficiency tweak
jrfnl Oct 8, 2020
54f6db0
LowExpiryCacheTime: add new warning / manual inspection needed
jrfnl Oct 8, 2020
dae7c02
LowExpiryCacheTime: bug fix - allow for all arithmetic operators
jrfnl Oct 8, 2020
67d54cd
LowExpiryCacheTime: bug fix - allow for parentheses grouping calculat…
jrfnl Oct 8, 2020
5f32d2f
LowExpiryCacheTime: bug fix - allow for cache time being passed as a …
jrfnl Oct 8, 2020
244df86
LowExpiryCacheTime: bug fix - allow for a cache time of 0
jrfnl Oct 8, 2020
497f655
LowExpiryCacheTime: feature completeness - allow for `true`
jrfnl Oct 8, 2020
0340d86
LowExpiryCacheTime: bug fix - allow for WP time constants being passe…
jrfnl Oct 8, 2020
82ce04a
LowExpiryCacheTime: add a few more unit tests
jrfnl Oct 8, 2020
32aed75
LowExpiryCacheTime: add note about the object cache implementation used
jrfnl Oct 8, 2020
d374355
Merge pull request #587 from Automattic/fix/572-lowexpirytime-flag-4t…
rebeccahum Oct 9, 2020
af82f36
Functions/DynamicCalls: annotate the unit tests
jrfnl Oct 23, 2020
d8f958d
Functions/DynamicCalls: remove redundant conditions [1]
jrfnl Oct 23, 2020
0f55b11
Functions/DynamicCalls: remove redundant conditions [2]
jrfnl Oct 23, 2020
db13572
Functions/DynamicCalls: improve code readability
jrfnl Oct 23, 2020
b6ebf86
Functions/DynamicCalls: minor simplification
jrfnl Oct 23, 2020
df8c596
Functions/DynamicCalls: bug fix - ignore comments [1]
jrfnl Oct 23, 2020
8e63627
Functions/DynamicCalls: bug fix - don't blindly use the next text string
jrfnl Oct 23, 2020
e607fb0
Functions/DynamicCalls: bug fix - allow for double quotes
jrfnl Oct 23, 2020
b093d62
Functions/DynamicCalls: bug fix - fix memory + performance issue
jrfnl Oct 23, 2020
6b4a43d
Functions/DynamicCalls: rename private property
jrfnl Oct 23, 2020
3118358
Functions/DynamicCalls: bug fix - ignore comments [2]
jrfnl Oct 23, 2020
1d1a977
Functions/DynamicCalls: error message tweak
jrfnl Oct 23, 2020
20fdf8b
WPQueryParams: sniff for `exclude` array key being set
jrfnl Oct 19, 2020
97b8cfc
Merge pull request #589 from Automattic/fix/369-exclude-arg-in-get_posts
rebeccahum Oct 26, 2020
1b8c9b9
Security/Underscorejs: sniff all text string tokens
jrfnl Oct 20, 2020
3b18b77
Security/Underscorejs: throw an error for each violation
jrfnl Oct 20, 2020
ece1afd
Security/Underscorejs: add JS test case file
jrfnl Oct 20, 2020
70ec811
Security/Underscorejs: improve check for `interpolate` in JS files
jrfnl Oct 20, 2020
d3ce1d0
Security/Underscorejs: improve check for `interpolate` in PHP files
jrfnl Oct 21, 2020
1ab2794
Security/Underscorejs: bug fix - don't error when variable is escaped
jrfnl Oct 21, 2020
d9317e5
Security/Underscorejs: ignore Gruntfile.js files
jrfnl Oct 31, 2020
09d5b92
Security/Underscorejs: enhancement - check for print execution statem…
jrfnl Nov 1, 2020
4b3d7f9
Merge pull request #595 from Automattic/fix/345-underscorejs-output-e…
rebeccahum Nov 23, 2020
387d448
Merge pull request #592 from Automattic/fix/590-prevent-undefined-off…
rebeccahum Nov 23, 2020
b99c31d
Functions/DynamicCalls: Remove the word "blacklisted" and use "disall…
rebeccahum Nov 23, 2020
0496ce9
Merge pull request #596 from Automattic/remove_blacklisted_word
rebeccahum Nov 23, 2020
d5528e4
Travis: add build against PHP 8.0
jrfnl Dec 4, 2020
60ad148
Merge pull request #599 from Automattic/feature/travis-test-against-p…
GaryJones Dec 4, 2020
19ba9c8
WordPress.Security.EscapeOutput.OutputNotEscaped: Remove redundant er…
rebeccahum Jan 8, 2021
a2debb7
WordPress.Security.NonceVerification.NoNonceVerification: Remove outd…
rebeccahum Jan 8, 2021
77e07fe
Change reference in test to parent sniff
rebeccahum Jan 8, 2021
3670a4d
Remove second reference of WordPress.WP.AlternativeFunctions.curl_cur…
rebeccahum Jan 8, 2021
603b882
WordPress-VIP-Go: Replace WordPress.WP.GlobalVariablesOverride.Overri…
rebeccahum Jan 8, 2021
9ae891b
Removing cruft since it is already a warning in WordPress.WP.Alternat…
rebeccahum Jan 8, 2021
5f480bf
Merge pull request #608 from Automattic/rebecca/cleanup_-curl_curl_ge…
rebeccahum Jan 8, 2021
5d9cfb3
Merge pull request #606 from Automattic/rebecca/cleanup_604
rebeccahum Jan 9, 2021
6d3f526
Merge pull request #611 from Automattic/rebecca/cleanup_wpcs_warning_…
rebeccahum Jan 9, 2021
9626635
Remove warning type since it inherits from parent as "warning" by def…
rebeccahum Jan 11, 2021
09336ca
Remove Batcache references in messaging
rebeccahum Jan 11, 2021
09945de
Add back error type since we aren't changing the parent yet
rebeccahum Jan 11, 2021
d702c7b
Merge pull request #617 from Automattic/rebecca/remove_warning_cruft
rebeccahum Jan 12, 2021
4e334c1
Merge pull request #618 from Automattic/rebecca/cache_constraints_mes…
rebeccahum Jan 12, 2021
0fb90dc
Merge pull request #607 from Automattic/rebecca/cleanup_605
rebeccahum Jan 13, 2021
dd84717
Update doc links to docs.wpvip.com and remove WordPress.com refs
rebeccahum Jan 14, 2021
8028bd4
Add back period due to sniff requiring inline comment to have full stops
rebeccahum Jan 14, 2021
1bc47d7
Merge pull request #619 from Automattic/rebecca/update_urls
rebeccahum Jan 15, 2021
53469f5
Exclude VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable…
rebeccahum Jan 18, 2021
91782b6
Merge pull request #610 from Automattic/rebecca/cleanup_609
rebeccahum Jan 19, 2021
288159a
Silence rather than exclude for more user customization
rebeccahum Jan 22, 2021
fe2c16e
Merge pull request #620 from Automattic/rebecca/remove_unused
rebeccahum Jan 28, 2021
d091560
Remove extra tabs that snuck in the XML file
rebeccahum Feb 23, 2021
a58e583
Merge pull request #625 from Automattic/fix_xml_linting_extra_tabs
rebeccahum Feb 23, 2021
c1c62f1
CI: fix build failures [1]
jrfnl Mar 2, 2021
87ddd1b
CI: fix build failures [2]
jrfnl Mar 2, 2021
655d44a
Merge pull request #629 from Automattic/fix/ci-failures
rebeccahum Mar 2, 2021
fff8cb0
CI: fix test failure for the VIPCS VariableAnalysis sniff
jrfnl Mar 2, 2021
d199359
Merge pull request #630 from Automattic/fix/tests-variableanalysis-sn…
rebeccahum Mar 2, 2021
009aca0
QA: remove unused `use` statements
jrfnl Mar 2, 2021
d66899c
Documentation: various minor improvements
jrfnl Oct 9, 2020
6588541
ProperEscapingFunction: Flag when esc_attr is being used outside of H…
rebeccahum Feb 23, 2021
baf9e3c
Re-factor logic to be less redundant and account for comma as a strin…
rebeccahum Feb 26, 2021
4a5f506
Re-factor v2 with feedback from @jrfnl
rebeccahum Mar 1, 2021
62ae810
Fixed descriptions, account for returns better, moved code in a more …
rebeccahum Mar 2, 2021
90ba201
yoda leave behind
rebeccahum Mar 2, 2021
d1e04f6
is_outside_html_attr_context: Utilize helper endswith()
rebeccahum Mar 2, 2021
f53d5f0
Instead of checking token is not T_INLINE_HTML, explicitly look for s…
rebeccahum Mar 2, 2021
dfa99fd
Merge pull request #632 from Automattic/fix/various-minor-documentati…
rebeccahum Mar 2, 2021
71b5268
Merge pull request #631 from Automattic/fix/qa-minor-clean-up
rebeccahum Mar 2, 2021
b565f02
Ruleset tests: minor updates
jrfnl Mar 3, 2021
8c887b6
Merge pull request #634 from Automattic/follow-up/618-minor-docs-updates
rebeccahum Mar 3, 2021
2a1aa32
Update WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSnif…
rebeccahum Mar 4, 2021
2b8d9f2
Update WordPressVIPMinimum/Tests/Security/ProperEscapingFunctionUnitT…
rebeccahum Mar 4, 2021
48c1919
Update WordPressVIPMinimum/Tests/Security/ProperEscapingFunctionUnitT…
rebeccahum Mar 4, 2021
65143ee
CI: switch to GitHub Actions - step 1: sniff and lint stage
jrfnl Mar 3, 2021
7b04b16
CI: switch to GitHub Actions - step 2: test stage
jrfnl Mar 3, 2021
998c726
Merge pull request #633 from Automattic/fix/628-switch-ci-to-gh-actions
GaryJones Mar 4, 2021
46962db
WordPress-VIP-Go: Remove WordPress.WP.GlobalVariablesOverride.Prohibited
rebeccahum Mar 9, 2021
86b1e78
Add back rule but remove severity level change
rebeccahum Mar 9, 2021
f5126d6
Remove rule since it already inherits on the WordPressVIPMinimum level
rebeccahum Mar 9, 2021
1fa0266
Merge pull request #635 from Automattic/rebecca/610_followup
rebeccahum Mar 9, 2021
032742b
Move attrs and attr endings to static variable level, double escape s…
rebeccahum Mar 8, 2021
8a25fa6
IncludingFileSniff: add property of custom keywords to not trigger sniff
rebeccahum Mar 26, 2021
1382862
RestrictedFunctionsSniff - remove site_option family
rebeccahum Mar 26, 2021
b7bf01e
Fix WordPressVIPMinimum ruleset test cases for site_option grouping i…
rebeccahum Mar 26, 2021
0d7da03
Merge pull request #638 from Automattic/custom_keywords_includingfile
rebeccahum Mar 28, 2021
8383d16
Merge pull request #639 from Automattic/remove_site_option
rebeccahum Mar 28, 2021
cece3be
RestrictedFunctionsSniff: Remove wp_cache_get_multi group
rebeccahum Mar 29, 2021
43a5830
Silence WordPress.WP.AlternativeFunctions.file_system_read_readfile
rebeccahum Mar 29, 2021
164d67f
Remove WordPressVIPMinimum.Functions.RestrictedFunctions.get_super_ad…
rebeccahum Mar 29, 2021
d672f98
RestrictedFunctionsSniff: Change default message of switch_to_blog() …
rebeccahum Mar 31, 2021
52d4c50
Merge pull request #644 from Automattic/remove_wp_cache_get_multi
rebeccahum Apr 6, 2021
66bf0a9
Merge pull request #645 from Automattic/silence_readfile
rebeccahum Apr 6, 2021
d988322
Silence WordPress.WP.AlternativeFunctions.file_system_read_fclose
rebeccahum Mar 29, 2021
71e109b
Merge pull request #646 from Automattic/silence_fclose
rebeccahum Apr 6, 2021
35f3305
Merge pull request #647 from Automattic/remove_get_super_admin
rebeccahum Apr 6, 2021
34e7c56
ProperEscapingFunction: take all possible functions into account
jrfnl Apr 14, 2021
6596c68
ProperEscapingFunction: move a condition
jrfnl Apr 14, 2021
5ccd4e8
ProperEscapingFunction: allow for HTML attributes without quotes
jrfnl Apr 14, 2021
2cb1dbe
ProperEscapingFunction: minor documentation touch up
jrfnl Apr 14, 2021
b8f215c
ProperEscapingFunction: function names are case-insensitive
jrfnl Apr 14, 2021
080f3c5
ProperEscapingFunction: only trigger on function calls
jrfnl Apr 14, 2021
9be3a38
ProperEscapingFunction: allow for fully qualified function calls
jrfnl Apr 14, 2021
5962dc4
ProperEscapingFunction: make the $escaping_functions property protected
jrfnl Apr 14, 2021
288ad35
Merge pull request #624 from Automattic/fix_155
rebeccahum Apr 14, 2021
5593738
QA: remove redundant PHPCS ignore annotations
jrfnl Mar 3, 2021
e9aea8f
RestrictedFunctions: remove user_meta related errors
jrfnl Mar 2, 2021
fda4656
RestrictedVariables: remove usermeta related errors
jrfnl Mar 2, 2021
7d3d8cd
GH Actions: switch over to parallel linting of PHP files
jrfnl Mar 31, 2021
dac90e5
LowExpiryCacheTime: improve handling of potential parse errors in eva…
jrfnl Mar 31, 2021
eb8370f
Merge pull request #655 from Automattic/fix/QA/remove-outdated-ignore…
rebeccahum Apr 15, 2021
c94e555
Merge pull request #654 from Automattic/fix/lowexpirycachetime-parse-…
rebeccahum Apr 15, 2021
1af6b37
Merge pull request #653 from Automattic/fix/ghactions-improve-php-lin…
rebeccahum Apr 15, 2021
0ea8b1a
Merge pull request #652 from Automattic/fix/614-remove-user-meta-rela…
rebeccahum Apr 15, 2021
2f1494d
GH Actions: always check that all sniffs are feature complete
jrfnl Mar 31, 2021
8b2ae7d
Downgrade switch_to_blog to warning at sniff level
rebeccahum Apr 15, 2021
0c9df2a
Merge pull request #649 from Automattic/switch_to_blog_messaging
rebeccahum Apr 15, 2021
2885957
Merge pull request #656 from Automattic/fix/ghactions-add-feature-com…
rebeccahum Apr 15, 2021
59f2b01
GH Actions: add "quicktest" stage for non-PR/merge builds
jrfnl Mar 31, 2021
82c82fa
Release template: add checkbox for dependency check
jrfnl Jul 27, 2020
6d0525e
Merge pull request #657 from Automattic/feature/gh-actions-quick-test
rebeccahum Apr 15, 2021
7865ff7
Merge pull request #658 from Automattic/JRF/update-release-checklist
rebeccahum Apr 15, 2021
55c11fe
Update changelog to reflect 2.3.0
rebeccahum Apr 15, 2021
f46177d
Merge pull request #662 from Automattic/2.3.0-changelog
rebeccahum Apr 19, 2021
ff47f6b
Changelog: minor tweak
jrfnl Apr 19, 2021
2a901d7
Merge pull request #663 from Automattic/fix/changelog-230-minor-tweaks
rebeccahum Apr 19, 2021
b1e9991
Changelog: minor tweak
jrfnl Apr 19, 2021
181b6f7
Merge pull request #664 from Automattic/fix/changelog-230-minor-tweaks-2
rebeccahum Apr 19, 2021
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
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpcs.xml.dist export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.github export-ignore
/bin export-ignore
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ assignees: GaryJones, rebeccahum

---

⚠️ DO NOT MERGE (YET) ⚠️
:warning: DO NOT MERGE (YET) :warning:

[Remaining work for this Milestone](https://github.com/Automattic/VIP-Coding-Standards/milestone/X)

PR for tracking changes for the X.Y.Z release. Target release date: DOW DD MMMM YYYY.

- [ ] Add change log for this release: PR #XXX
- [ ] Double-check whether any dependencies need bumping.
- [ ] Merge this PR.
- [ ] Add signed release tag against `master`.
- [ ] Close the current milestone.
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: BasicQA

on:
# Run on all pushes and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
checkcs:
name: 'Basic CS and QA checks'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: cs2pr

- name: Install xmllint
run: sudo apt-get install --no-install-recommends -y libxml2-utils

# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- uses: korelstar/xmllint-problem-matcher@v1

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict

- name: 'Composer: adjust dependencies'
# Using PHPCS `master` as an early detection system for bugs upstream.
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"dev-master"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: 'Validate XML against schema and check code style'
run: ./bin/xml-lint

# Check the code-style consistency of the PHP files.
- name: Check PHP code style
continue-on-error: true
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml

# Check that the sniffs available are feature complete.
# For now, just check that all sniffs have unit tests.
# At a later stage the documentation check can be activated.
- name: Check sniff feature completeness
run: composer check-complete
90 changes: 90 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Quicktest

on:
# Run on pushes, including merges, to all branches except `master`.
push:
branches-ignore:
- master
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
#### QUICK TEST STAGE ####
# This is a much quicker test which only runs the unit tests and linting against the low/high
# supported PHP/PHPCS combinations.
quicktest:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- php: '5.4'
phpcs_version: 'dev-master'
wpcs_version: '2.3.*'
- php: '5.4'
phpcs_version: '3.5.5'
wpcs_version: '2.3.*'

- php: 'latest'
phpcs_version: 'dev-master'
wpcs_version: '2.3.*'
- php: 'latest'
# PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0.
phpcs_version: '3.5.7'
wpcs_version: '2.3.*'

name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"


steps:
- name: Checkout code
uses: actions/checkout@v2

# On stable PHPCS versions, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- name: Setup ini config
id: set_ini
run: |
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
else
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
fi

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none

- name: 'Composer: set PHPCS and WPCS versions for tests'
run: |
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ startsWith( matrix.php, '8' ) == false && matrix.php != 'latest' }}
uses: "ramsey/composer-install@v1"

# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform
# requirements to get PHPUnit 7.x to install on nightly.
- name: Install Composer dependencies - with ignore platform
if: ${{ startsWith( matrix.php, '8' ) || matrix.php == 'latest' }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
run: ./bin/php-lint

- name: Run the unit tests
run: ./bin/unit-tests

- name: Run the ruleset tests
run: ./bin/ruleset-tests
141 changes: 141 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Test

on:
# Run on pushes to `master` and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
#### PHP LINT STAGE ####
# Linting against high/low PHP versions should catch everything.
# If needs be, we can always add interim versions at a later point in time.
lint:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', 'latest']
experimental: [false]

include:
- php: '8.1'
experimental: true

name: "Lint: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr

- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: Lint against parse errors
run: ./bin/php-lint --checkstyle | cs2pr

test:
# No use running the tests if there is a linting error somewhere as they would fail anyway.
needs: lint

runs-on: ubuntu-latest

strategy:
# Keys:
# - php: The PHP versions to test against.
# - phpcs_version: The PHPCS versions to test against.
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
# - PHPCS will run without errors on PHP 5.4 - 7.4 on any supported version.
# - PHP 8.0 needs PHPCS 3.5.7+ to run without errors.
# - The `wpcs_version` key is added to allow additional test builds when multiple WPCS versions
# would be supported. As, at this time, only the latest stable release of WPCS is supported,
# no additional versions are included in the array.
# - experimental: Whether the build is "allowed to fail".
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
phpcs_version: ['3.5.5', 'dev-master']
wpcs_version: ['2.3.*']
experimental: [false]

include:
# Complete the matrix by adding PHP 8.0, but only test against compatible PHPCS versions.
- php: '8.0'
phpcs_version: 'dev-master'
wpcs_version: '2.3.*'
experimental: false
- php: '8.0'
# PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0.
phpcs_version: '3.5.7'
wpcs_version: '2.3.*'
experimental: false

# Experimental builds. These are allowed to fail.
#- php: '8.1'
# phpcs_version: 'dev-master'
# wpcs_version: '2.3.*'
# experimental: true

name: "Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - WPCS ${{ matrix.wpcs_version }}"

continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2

# On stable PHPCS versions, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- name: Setup ini config
id: set_ini
run: |
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
else
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
fi

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none

- name: 'Composer: set PHPCS and WPCS versions for tests'
run: |
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ startsWith( matrix.php, '8' ) == false }}
uses: "ramsey/composer-install@v1"

# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform
# requirements to get PHPUnit 7.x to install on nightly.
- name: Install Composer dependencies - with ignore platform
if: ${{ startsWith( matrix.php, '8' ) }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs

- name: Run the unit tests
run: ./bin/unit-tests

- name: Run the ruleset tests
run: ./bin/ruleset-tests
Loading