Skip to content

Commit e1c316f

Browse files
authored
Merge pull request #105 from Yoast/develop
Release 1.2.1
2 parents 2e0f62e + 98aa23a commit e1c316f

File tree

14 files changed

+202
-106
lines changed

14 files changed

+202
-106
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@ updates:
99
- package-ecosystem: "github-actions"
1010
directory: "/"
1111
schedule:
12-
interval: "weekly"
12+
interval: "cron"
13+
cronjob: "15 22 5,20 * *" # At 22:15, every 5th and 20th day of the month.
1314
open-pull-requests-limit: 5
1415
commit-message:
1516
prefix: "GH Actions:"
1617
labels:
1718
- "yoastcs/qa"
18-
reviewers:
19-
- "jrfnl"
19+
groups:
20+
action-runners:
21+
applies-to: version-updates
22+
update-types:
23+
- "minor"
24+
- "patch"
2025

2126
# Maintain dependencies for Composer.
2227
- package-ecosystem: "composer"
2328
directory: "/"
2429
schedule:
25-
interval: "weekly"
30+
interval: "cron"
31+
cronjob: "15 22 5,20 * *" # At 22:15, every 5th and 20th day of the month.
2632
open-pull-requests-limit: 5 # Set to 0 to (temporarily) disable.
2733
versioning-strategy: "increase-if-necessary"
2834
commit-message:
2935
prefix: "Composer:"
3036
labels:
3137
- "yoastcs/qa"
32-
reviewers:
33-
- "jrfnl"

.github/release-checklist.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Release checklist
2+
===========================================================
3+
4+
## Pre-release
5+
6+
- [ ] Composer: check if any dependencies/version constraints need updating - PR #xxx
7+
- [ ] Add changelog for the release - PR #xxx
8+
:pencil2: Verify that a release link at the bottom of the `CHANGELOG.md` file has been added.
9+
10+
## Release
11+
12+
- [ ] Create PR to merge the `develop` branch into `main`.
13+
- [ ] Merge that PR
14+
- [ ] Make sure all CI builds are green.
15+
- [ ] Create a release from the tag (careful, GH defaults to `develop`!) & copy & paste the changelog to it.
16+
Make sure to copy the links to the issues and the links to the GH usernames from the bottom of the changelog!
17+
- [ ] Close the milestone.
18+
- [ ] Open a new milestone for the next release.
19+
- [ ] If any open PRs/issues which were milestoned for the release did not make it into the release, update their milestone.
20+
21+
## Announce
22+
23+
- [ ] Tweet about the release.
24+
25+
26+
---
27+
28+
Additional actions to take, not part of the release checklist:
29+
- [ ] Post a link to the release in the Yoast Slack.
30+
- [ ] Update the test dependencies in Yoast packages.

.github/workflows/cs.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,33 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
actionlint:
12+
name: 'Lint GH Action workflows'
13+
uses: Yoast/.github/.github/workflows/reusable-actionlint.yml@c14f66005ab514663a48d00712db67617c98728c # v1.0.0
14+
1115
checkcs:
1216
name: 'Basic CS and QA checks'
1317
runs-on: ubuntu-latest
1418

1519
steps:
1620
- name: Checkout code
17-
uses: actions/checkout@v4
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
with:
23+
persist-credentials: false
1824

1925
- name: Install PHP
20-
uses: shivammathur/setup-php@v2
26+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
2127
with:
22-
php-version: '7.4'
28+
php-version: 'latest'
2329
coverage: none
2430
tools: cs2pr
31+
env:
32+
fail-fast: true
2533

2634
# Install dependencies and handle caching in one go.
27-
# @link https://github.com/marketplace/actions/install-composer-dependencies
35+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
2836
- name: Install Composer dependencies
29-
uses: "ramsey/composer-install@v2"
37+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
3038
with:
3139
# Bust the cache at least once a month - output format: YYYY-MM.
3240
custom-cache-suffix: $(date -u "+%Y-%m")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check PRs for merge conflicts
2+
3+
on:
4+
# Check for new conflicts due to merges.
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
# Check conflicts in new PRs and for resolved conflicts due to an open PR being updated.
10+
pull_request_target:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
16+
jobs:
17+
check-prs:
18+
if: github.repository_owner == 'Yoast'
19+
20+
name: Check PRs for merge conflicts
21+
uses: Yoast/.github/.github/workflows/reusable-merge-conflict-check.yml@c14f66005ab514663a48d00712db67617c98728c # v1.0.0

.github/workflows/test.yml

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,46 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.3']
22+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.6']
2323
coverage: [false]
2424

2525
# Run code coverage only on high/low PHP.
2626
include:
2727
- php: 5.6
2828
coverage: true
29-
- php: 8.2
29+
- php: 8.5
3030
coverage: true
3131

32-
continue-on-error: ${{ matrix.php == '8.3' }}
32+
continue-on-error: ${{ matrix.php == '8.6' }}
3333

3434
name: "Tests: PHP ${{ matrix.php }}"
3535

3636
steps:
3737
- name: Checkout code
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
39+
with:
40+
persist-credentials: false
3941

4042
- name: Install PHP
41-
uses: shivammathur/setup-php@v2
43+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
4244
with:
4345
php-version: ${{ matrix.php }}
44-
ini-values: error_reporting=E_ALL, display_errors=On
46+
ini-values: zend.assertions=1, assert.exception=1, error_reporting=-1, display_errors=On, display_startup_errors=On
4547
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
48+
env:
49+
fail-fast: true
4650

47-
# Install dependencies and handle caching in one go.
48-
# @link https://github.com/marketplace/actions/install-composer-dependencies
49-
- name: Install Composer dependencies - normal
50-
if: matrix.php != '8.3'
51-
uses: "ramsey/composer-install@v2"
52-
with:
53-
# Bust the cache at least once a month - output format: YYYY-MM.
54-
custom-cache-suffix: $(date -u "+%Y-%m")
51+
# YoastCS 3.0 has a PHP 7.2 minimum which conflicts with the requirements of this package.
52+
- name: 'Composer: remove YoastCS'
53+
run: composer remove --dev yoast/yoastcs --no-update --no-interaction
5554

56-
- name: Install Composer dependencies - ignore PHP restrictions
57-
if: matrix.php == '8.3'
58-
uses: "ramsey/composer-install@v2"
55+
# Install dependencies and handle caching in one go.
56+
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
57+
- name: Install Composer dependencies
58+
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # 3.1.1
5959
with:
60-
composer-options: --ignore-platform-req=php+
60+
# For PHP "nightly", we need to install with ignore platform reqs as not all dependencies may allow it yet.
61+
composer-options: ${{ matrix.php == '8.6' && '--ignore-platform-req=php+' || '' }}
6162
# Bust the cache at least once a month - output format: YYYY-MM.
6263
custom-cache-suffix: $(date -u "+%Y-%m")
6364

@@ -72,34 +73,23 @@ jobs:
7273
if: ${{ matrix.coverage == true }}
7374
run: composer coverage
7475

75-
# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
76-
- name: Switch to PHP 7.4
77-
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php, '8' ) }}
78-
uses: shivammathur/setup-php@v2
79-
with:
80-
php-version: 7.4
81-
coverage: none
82-
83-
# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
84-
- name: Install Coveralls
85-
if: ${{ success() && matrix.coverage == true }}
86-
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction
87-
8876
- name: Upload coverage results to Coveralls
8977
if: ${{ success() && matrix.coverage == true }}
90-
env:
91-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
92-
COVERALLS_PARALLEL: true
93-
COVERALLS_FLAG_NAME: php-${{ matrix.php }}
94-
run: php-coveralls -v -x build/logs/clover.xml
78+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
79+
with:
80+
format: clover
81+
file: build/logs/clover.xml
82+
flag-name: php-${{ matrix.php }}
83+
parallel: true
9584

9685
coveralls-finish:
9786
needs: test
9887
runs-on: ubuntu-latest
9988

89+
name: Coveralls Finish
90+
10091
steps:
10192
- name: Coveralls Finished
102-
uses: coverallsapp/github-action@v2
93+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
10394
with:
104-
github-token: ${{ secrets.COVERALLS_TOKEN }}
10595
parallel-finished: true

.phpcs.xml.dist

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<?xml version="1.0"?>
22
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Coding Standard for WP Test Utils" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
3-
<description>Check the code of WP Test Utils.</description>
3+
<description>Check the code of WP Test Utils.</description>
44

5-
<!--
6-
#############################################################################
7-
COMMAND LINE ARGUMENTS
8-
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
9-
#############################################################################
10-
-->
5+
<!--
6+
#############################################################################
7+
COMMAND LINE ARGUMENTS
8+
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
9+
#############################################################################
10+
-->
1111

12-
<file>.</file>
12+
<file>.</file>
1313

14-
<!-- Only check PHP files. -->
15-
<arg name="extensions" value="php"/>
14+
<!-- Only check PHP files. -->
15+
<arg name="extensions" value="php"/>
1616

17-
<!-- Show progress, show the error codes for each message (source). -->
18-
<arg value="ps"/>
17+
<!-- Show progress, show the error codes for each message (source). -->
18+
<arg value="ps"/>
1919

20-
<!-- Strip the filepaths down to the relevant bit. -->
21-
<arg name="basepath" value="./"/>
20+
<!-- Strip the filepaths down to the relevant bit. -->
21+
<arg name="basepath" value="./"/>
2222

23-
<!-- Check up to 8 files simultaneously. -->
24-
<arg name="parallel" value="8"/>
23+
<!-- Check up to 8 files simultaneously. -->
24+
<arg name="parallel" value="8"/>
2525

2626
<!-- Cache the results between runs. -->
2727
<arg name="cache" value="./.cache/phpcs.cache"/>
@@ -41,16 +41,33 @@
4141
</property>
4242
</properties>
4343

44-
<!-- Use CamelCaps file names to be more in line with the naming conventions used in PHPUnit. -->
45-
<exclude name="Yoast.Files.FileName"/>
44+
<!-- Exclude some rules which are irrelevant.
45+
The code in this package is not run in the context of a WordPress plugin. -->
46+
<exclude name="WordPress.DB"/>
47+
<exclude name="WordPress.Security"/>
48+
<exclude name="WordPress.WP"/>
49+
<exclude name="Yoast.Yoast.JsonEncodeAlternative"/>
50+
<exclude name="WordPressVIPMinimum.Classes.DeclarationCompatibility"/>
51+
<exclude name="WordPressVIPMinimum.Hooks.AlwaysReturnInFilter"/>
52+
<exclude name="WordPressVIPMinimum.Security.EscapingVoidReturnFunctions"/>
53+
<exclude name="WordPressVIPMinimum.Security.ProperEscapingFunction"/>
54+
55+
<!-- Exclude select "modern PHP" sniffs, which conflict with the minimum supported PHP version of this package. -->
56+
<exclude name="Modernize.FunctionCalls.Dirname.Nested"/><!-- PHP 7.0+. -->
57+
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/><!-- PHP 7.0+. -->
58+
<exclude name="PSR12.Properties.ConstantVisibility"/><!-- PHP 7.1+. -->
59+
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/><!-- PHP 7.1+. -->
60+
<exclude name="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/><!-- PHP 7.3+. -->
61+
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/><!-- PHP 7.4+. -->
62+
<exclude name="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator"/><!-- PHP 7.4+. -->
4663

47-
<!-- The code in this package is not run in the context of a plugin. -->
48-
<exclude name="WordPress.WP.AlternativeFunctions"/>
49-
<exclude name="Yoast.Yoast.AlternativeFunctions"/>
5064
</rule>
5165

5266
<!-- Enforce PSR1 compatible namespaces. -->
53-
<rule ref="PSR1.Classes.ClassDeclaration"/>
67+
<rule ref="PSR1.Classes.ClassDeclaration">
68+
<!-- YoastCS only applies this rule to test files. Overrule it to apply to all files. -->
69+
<include-pattern>*\.php</include-pattern>
70+
</rule>
5471

5572

5673
<!--
@@ -59,13 +76,21 @@
5976
#############################################################################
6077
-->
6178

62-
<rule ref="Yoast.NamingConventions.NamespaceName">
79+
<rule ref="Yoast.Files.FileName">
6380
<properties>
64-
<property name="prefixes" type="array">
65-
<element value="Yoast\WPTestUtils"/>
81+
<property name="psr4_paths" type="array">
82+
<element key="Yoast\WPTestUtils\Tests\\" value="tests/"/>
6683
</property>
67-
<property name="src_directory" type="array">
68-
<element value="src"/>
84+
</properties>
85+
86+
<include-pattern>/tests/*\.php</include-pattern>
87+
</rule>
88+
89+
<rule ref="Yoast.NamingConventions.NamespaceName">
90+
<properties>
91+
<property name="psr4_paths" type="array">
92+
<element key="Yoast\WPTestUtils\\" value="src/"/>
93+
<element key="Yoast\WPTestUtils\Tests\\" value="tests/"/>
6994
</property>
7095
</properties>
7196
</rule>
@@ -78,7 +103,7 @@
78103

79104
<rule ref="WordPress.PHP.NoSilencedErrors">
80105
<properties>
81-
<property name="custom_whitelist" type="array">
106+
<property name="customAllowedFunctionsList" type="array">
82107
<element value="file_exists"/>
83108
</property>
84109
</properties>
@@ -92,11 +117,6 @@
92117
#############################################################################
93118
-->
94119

95-
<!-- Allow filecomments in file which don't contain OO declarations. -->
96-
<rule ref="Yoast.Commenting.FileComment.Unnecessary">
97-
<exclude-pattern>/src/*/bootstrap*\.php$</exclude-pattern>
98-
</rule>
99-
100120
<!-- Declaring a few WordPress native constants. -->
101121
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound">
102122
<exclude-pattern>/src/BrainMonkey/bootstrap\.php$</exclude-pattern>
@@ -116,9 +136,16 @@
116136
<exclude-pattern>/src/Helpers/*\.php$</exclude-pattern>
117137
</rule>
118138

119-
<!-- Ignore word count for object names in tests. -->
139+
<!-- TEST CODE -->
140+
141+
<!-- Final classes is irrelevant for test fixtures. -->
142+
<rule ref="Universal.Classes.RequireFinalClass">
143+
<exclude-pattern>/tests/*/Fixtures/*\.php$</exclude-pattern>
144+
</rule>
145+
146+
<!-- Ignore word count for object names in test fixtures. -->
120147
<rule ref="Yoast.NamingConventions.ObjectNameDepth.MaxExceeded">
121-
<exclude-pattern>/tests/*\.php$</exclude-pattern>
148+
<exclude-pattern>/tests/*/Fixtures/*\.php$</exclude-pattern>
122149
</rule>
123150

124151
<!-- Test fixtures are not the actual tests. -->

0 commit comments

Comments
 (0)