Skip to content

Commit e34dae9

Browse files
authored
Merge pull request #705 from Automattic/feature/ci-various-updates
2 parents 8808483 + d24fe22 commit e34dae9

File tree

4 files changed

+70
-26
lines changed

4 files changed

+70
-26
lines changed

.github/workflows/basics.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
# Allow manually triggering the workflow.
1111
workflow_dispatch:
1212

13+
# Cancels all previous workflow runs for the same branch that have not yet completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name.
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1319
jobs:
1420
checkcs:
1521
name: 'Basic CS and QA checks'
@@ -40,12 +46,12 @@ jobs:
4046

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

4551
# Install dependencies and handle caching in one go.
4652
# @link https://github.com/marketplace/actions/install-composer-dependencies
4753
- name: Install Composer dependencies
48-
uses: "ramsey/composer-install@v1"
54+
uses: "ramsey/composer-install@v2"
4955

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

.github/workflows/quicktest.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
# Allow manually triggering the workflow.
1111
workflow_dispatch:
1212

13+
# Cancels all previous workflow runs for the same branch that have not yet completed.
14+
concurrency:
15+
# The concurrency group contains the workflow name and the branch name.
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1319
jobs:
1420
#### QUICK TEST STAGE ####
1521
# This is a much quicker test which only runs the unit tests and linting against the low/high
@@ -31,26 +37,28 @@ jobs:
3137
phpcs_version: 'dev-master'
3238
wpcs_version: '2.3.*'
3339
- php: 'latest'
34-
# PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0.
35-
phpcs_version: '3.5.7'
40+
# PHPCS 3.6.1 is the lowest version of PHPCS which supports PHP 8.1.
41+
phpcs_version: '3.6.1'
3642
wpcs_version: '2.3.*'
3743

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

40-
4146
steps:
4247
- name: Checkout code
4348
uses: actions/checkout@v2
4449

4550
# On stable PHPCS versions, allow for PHP deprecation notices.
4651
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
52+
# Note: the "elif" condition is temporary and should be removed once VIPCS updates to WPCS 3.0+.
4753
- name: Setup ini config
4854
id: set_ini
4955
run: |
5056
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
5157
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
58+
elif [[ "${{ matrix.php }}" == "latest" ]]; then
59+
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
5260
else
53-
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
61+
echo '::set-output name=PHP_INI::error_reporting=-1'
5462
fi
5563
5664
- name: Install PHP
@@ -62,29 +70,34 @@ jobs:
6270

6371
- name: 'Composer: set PHPCS and WPCS versions for tests'
6472
run: |
65-
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
66-
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"
73+
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction
74+
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" --no-interaction
6775
6876
# Install dependencies and handle caching in one go.
6977
# @link https://github.com/marketplace/actions/install-composer-dependencies
7078
- name: Install Composer dependencies - normal
7179
if: ${{ startsWith( matrix.php, '8' ) == false && matrix.php != 'latest' }}
72-
uses: "ramsey/composer-install@v1"
80+
uses: "ramsey/composer-install@v2"
7381

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

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

86-
- name: Run the unit tests
94+
- name: Run the unit tests - PHP 5.4 - 8.0
95+
if: matrix.php != 'latest'
8796
run: ./bin/unit-tests
8897

98+
- name: Run the unit tests - PHP > 8.1
99+
if: matrix.php == 'latest'
100+
run: vendor/bin/phpunit --filter WordPressVIPMinimum ./vendor/squizlabs/php_codesniffer/tests/AllTests.php --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests
101+
89102
- name: Run the ruleset tests
90103
run: ./bin/ruleset-tests

.github/workflows/test.yml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ on:
1212
# Allow manually triggering the workflow.
1313
workflow_dispatch:
1414

15+
# Cancels all previous workflow runs for the same branch that have not yet completed.
16+
concurrency:
17+
# The concurrency group contains the workflow name and the branch name.
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1521
jobs:
1622
#### PHP LINT STAGE ####
1723
# Linting against high/low PHP versions should catch everything.
@@ -21,15 +27,10 @@ jobs:
2127

2228
strategy:
2329
matrix:
24-
php: ['5.4', 'latest']
25-
experimental: [false]
26-
27-
include:
28-
- php: '8.1'
29-
experimental: true
30+
php: ['5.4', 'latest', '8.2']
3031

3132
name: "Lint: PHP ${{ matrix.php }}"
32-
continue-on-error: ${{ matrix.experimental }}
33+
continue-on-error: ${{ matrix.php == '8.2' }}
3334

3435
steps:
3536
- name: Checkout code
@@ -43,7 +44,7 @@ jobs:
4344
tools: cs2pr
4445

4546
- name: Install Composer dependencies
46-
uses: "ramsey/composer-install@v1"
47+
uses: "ramsey/composer-install@v2"
4748

4849
- name: Lint against parse errors
4950
run: ./bin/php-lint --checkstyle | cs2pr
@@ -83,8 +84,19 @@ jobs:
8384
wpcs_version: '2.3.*'
8485
experimental: false
8586

87+
# Complete the matrix by adding PHP 8.1, but only test against compatible PHPCS versions.
88+
- php: '8.1'
89+
phpcs_version: 'dev-master'
90+
wpcs_version: '2.3.*'
91+
experimental: false
92+
- php: '8.1'
93+
# PHPCS 3.6.1 is the lowest version of PHPCS which supports PHP 8.1.
94+
phpcs_version: '3.6.1'
95+
wpcs_version: '2.3.*'
96+
experimental: false
97+
8698
# Experimental builds. These are allowed to fail.
87-
#- php: '8.1'
99+
#- php: '8.2'
88100
# phpcs_version: 'dev-master'
89101
# wpcs_version: '2.3.*'
90102
# experimental: true
@@ -99,13 +111,16 @@ jobs:
99111

100112
# On stable PHPCS versions, allow for PHP deprecation notices.
101113
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
114+
# Note: the "elif" condition is temporary and should be removed once VIPCS updates to WPCS 3.0+.
102115
- name: Setup ini config
103116
id: set_ini
104117
run: |
105118
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
106119
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
120+
elif [[ "${{ matrix.php }}" == "8.1" ]]; then
121+
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
107122
else
108-
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
123+
echo '::set-output name=PHP_INI::error_reporting=-1'
109124
fi
110125
111126
- name: Install PHP
@@ -117,25 +132,30 @@ jobs:
117132

118133
- name: 'Composer: set PHPCS and WPCS versions for tests'
119134
run: |
120-
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
121-
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"
135+
composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction
136+
composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" --no-interaction
122137
123138
# Install dependencies and handle caching in one go.
124139
# @link https://github.com/marketplace/actions/install-composer-dependencies
125140
- name: Install Composer dependencies - normal
126141
if: ${{ startsWith( matrix.php, '8' ) == false }}
127-
uses: "ramsey/composer-install@v1"
142+
uses: "ramsey/composer-install@v2"
128143

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

137-
- name: Run the unit tests
152+
- name: Run the unit tests - PHP 5.4 - 8.0
153+
if: matrix.php < '8.1'
138154
run: ./bin/unit-tests
139155

156+
- name: Run the unit tests - PHP > 8.1
157+
if: matrix.php >= '8.1'
158+
run: vendor/bin/phpunit --filter WordPressVIPMinimum ./vendor/squizlabs/php_codesniffer/tests/AllTests.php --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests
159+
140160
- name: Run the ruleset tests
141161
run: ./bin/ruleset-tests

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
"phpcsstandards/phpcsdevtools": "^1.0",
2929
"phpunit/phpunit": "^4 || ^5 || ^6 || ^7"
3030
},
31+
"config": {
32+
"allow-plugins": {
33+
"dealerdirect/phpcodesniffer-composer-installer": true
34+
}
35+
},
3136
"scripts": {
3237
"install-codestandards": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
3338
"ruleset": "bin/ruleset-tests",

0 commit comments

Comments
 (0)