Skip to content

Commit 3897d72

Browse files
authored
Merge pull request #383 from cakephp/5.x-ci-workflow
Update CI workflow
2 parents 2374ead + 3351668 commit 3897d72

File tree

4 files changed

+39
-71
lines changed

4 files changed

+39
-71
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,94 +11,52 @@ on:
1111

1212
jobs:
1313
testsuite:
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
php-version: ['7.4', '8.0']
19-
prefer-lowest: ['']
18+
php-version: ['8.1', '8.2']
19+
dependencies: ['highest']
2020
include:
21-
- php-version: '7.4'
22-
prefer-lowest: 'prefer-lowest'
21+
- php-version: '8.1'
22+
dependencies: 'lowest'
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626

2727
- name: Setup PHP
2828
uses: shivammathur/setup-php@v2
2929
with:
3030
php-version: ${{ matrix.php-version }}
31-
extensions: mbstring, intl
32-
coverage: pcov
33-
34-
- name: Get composer cache directory
35-
id: composer-cache
36-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37-
38-
- name: Get date part for cache key
39-
id: key-date
40-
run: echo "::set-output name=date::$(date +'%Y-%m')"
31+
coverage: none
4132

42-
- name: Cache composer dependencies
43-
uses: actions/cache@v2
33+
- name: Composer install
34+
uses: ramsey/composer-install@v2
4435
with:
45-
path: ${{ steps.composer-cache.outputs.dir }}
46-
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
47-
48-
- name: Composer Install
49-
run: |
50-
if [[ ${{ matrix.php-version }} == '8.0' ]]; then
51-
composer install --ignore-platform-reqs
52-
elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
53-
composer update --prefer-lowest --prefer-stable
54-
else
55-
composer install
56-
fi
57-
58-
- name: Setup problem matchers for PHPUnit
59-
if: matrix.php-version == '7.4'
60-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
36+
dependency-versions: ${{ matrix.dependencies }}
37+
composer-options: --ignore-platform-reqs
6138

6239
- name: Run PHPUnit
63-
run: |
64-
vendor/bin/phpcs --config-set installed_paths $(pwd)
65-
vendor/bin/phpunit --filter CakePHP
66-
67-
- name: Submit code coverage
68-
if: matrix.php-version == '7.4'
69-
uses: codecov/codecov-action@v1
40+
run: composer phpunit
7041

7142
cs-stan:
7243
name: Coding Standard & Static Analysis
73-
runs-on: ubuntu-18.04
44+
runs-on: ubuntu-22.04
7445

7546
steps:
76-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v3
7748

7849
- name: Setup PHP
7950
uses: shivammathur/setup-php@v2
8051
with:
81-
php-version: '7.4'
82-
extensions: mbstring, intl
52+
php-version: '8.1'
8353
tools: cs2pr
8454
coverage: none
8555

86-
- name: Get composer cache directory
87-
id: composer-cache
88-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
89-
90-
- name: Get date part for cache key
91-
id: key-date
92-
run: echo "::set-output name=date::$(date +'%Y-%m')"
93-
94-
- name: Cache composer dependencies
95-
uses: actions/cache@v2
96-
with:
97-
path: ${{ steps.composer-cache.outputs.dir }}
98-
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
99-
10056
- name: Composer install
101-
run: composer install
57+
uses: ramsey/composer-install@v2
58+
with:
59+
composer-options: --ignore-platform-reqs
10260

10361
- name: Run PHP CodeSniffer
104-
run: vendor/bin/phpcs --report=checkstyle CakePHP/ | cs2pr
62+
run: vendor/bin/phpcs --report=checkstyle | cs2pr

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"source": "https://github.com/cakephp/cakephp-codesniffer"
1919
},
2020
"require": {
21-
"php": ">=7.2.0",
21+
"php": ">=8.1.0",
2222
"phpstan/phpdoc-parser": "^1.4.5",
2323
"slevomat/coding-standard": "^8.4",
2424
"squizlabs/php_codesniffer": "^3.7.1"
@@ -38,9 +38,10 @@
3838
},
3939
"scripts": {
4040
"add-standard" : "phpcs --config-set installed_paths $(pwd)",
41+
"phpunit": "phpunit vendor/squizlabs/php_codesniffer/tests/AllTests.php --filter CakePHP --no-configuration --bootstrap=vendor/squizlabs/php_codesniffer/tests/bootstrap.php --dont-report-useless-tests",
4142
"test": [
4243
"@add-standard",
43-
"phpunit --filter CakePHP"
44+
"@phpunit"
4445
],
4546
"cs-check": "phpcs --colors --parallel=16 -p -s CakePHP/",
4647
"cs-fix": "phpcbf --colors --parallel=16 -p CakePHP/",

docs/README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# CakePHP ruleset
22

3-
The CakePHP standard contains 136 sniffs
3+
The CakePHP standard contains 143 sniffs
44

5-
CakePHP (19 sniffs)
5+
CakePHP (20 sniffs)
66
-------------------
77
- CakePHP.Classes.ReturnTypeHint
88
- CakePHP.Commenting.DocBlockAlignment
99
- CakePHP.Commenting.FunctionComment
1010
- CakePHP.Commenting.InheritDoc
11+
- CakePHP.Commenting.TypeHint
1112
- CakePHP.ControlStructures.ControlStructures
1213
- CakePHP.ControlStructures.ElseIfDeclaration
1314
- CakePHP.ControlStructures.WhileStructures
@@ -52,22 +53,22 @@ Generic (25 sniffs)
5253
- Generic.WhiteSpace.IncrementDecrementSpacing
5354
- Generic.WhiteSpace.ScopeIndent
5455

55-
PEAR (2 sniffs)
56+
PEAR (1 sniff)
5657
---------------
5758
- PEAR.Functions.ValidDefaultValue
58-
- PEAR.NamingConventions.ValidFunctionName
5959

6060
PSR1 (3 sniffs)
6161
---------------
6262
- PSR1.Classes.ClassDeclaration
6363
- PSR1.Files.SideEffects
6464
- PSR1.Methods.CamelCapsMethodName
6565

66-
PSR12 (16 sniffs)
66+
PSR12 (17 sniffs)
6767
-----------------
6868
- PSR12.Classes.AnonClassDeclaration
6969
- PSR12.Classes.ClassInstantiation
7070
- PSR12.Classes.ClosingBrace
71+
- PSR12.Classes.OpeningBraceSpace
7172
- PSR12.ControlStructures.BooleanOperatorPlacement
7273
- PSR12.ControlStructures.ControlStructureSpacing
7374
- PSR12.Files.DeclareStatement
@@ -94,12 +95,13 @@ PSR2 (9 sniffs)
9495
- PSR2.Methods.FunctionClosingBrace
9596
- PSR2.Methods.MethodDeclaration
9697

97-
SlevomatCodingStandard (32 sniffs)
98+
SlevomatCodingStandard (39 sniffs)
9899
----------------------------------
99100
- SlevomatCodingStandard.Arrays.TrailingArrayComma
100101
- SlevomatCodingStandard.Classes.ClassConstantVisibility
101102
- SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces
102103
- SlevomatCodingStandard.Classes.ModernClassNameReference
104+
- SlevomatCodingStandard.Classes.PropertyDeclaration
103105
- SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment
104106
- SlevomatCodingStandard.Commenting.DocCommentSpacing
105107
- SlevomatCodingStandard.Commenting.EmptyComment
@@ -114,6 +116,7 @@ SlevomatCodingStandard (32 sniffs)
114116
- SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses
115117
- SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation
116118
- SlevomatCodingStandard.Namespaces.NamespaceDeclaration
119+
- SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
117120
- SlevomatCodingStandard.Namespaces.UnusedUses
118121
- SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash
119122
- SlevomatCodingStandard.Namespaces.UseFromSameNamespace
@@ -125,11 +128,16 @@ SlevomatCodingStandard (32 sniffs)
125128
- SlevomatCodingStandard.TypeHints.DeclareStrictTypes
126129
- SlevomatCodingStandard.TypeHints.LongTypeHints
127130
- SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue
131+
- SlevomatCodingStandard.TypeHints.ParameterTypeHint
128132
- SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing
133+
- SlevomatCodingStandard.TypeHints.PropertyTypeHint
134+
- SlevomatCodingStandard.TypeHints.ReturnTypeHint
129135
- SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing
136+
- SlevomatCodingStandard.TypeHints.UnionTypeHintFormat
130137
- SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable
138+
- SlevomatCodingStandard.Variables.UnusedVariable
131139

132-
Squiz (29 sniffs)
140+
Squiz (28 sniffs)
133141
-----------------
134142
- Squiz.Arrays.ArrayBracketSpacing
135143
- Squiz.Classes.ClassFileName
@@ -144,7 +152,6 @@ Squiz (29 sniffs)
144152
- Squiz.Functions.FunctionDeclarationArgumentSpacing
145153
- Squiz.Functions.LowercaseFunctionKeywords
146154
- Squiz.Functions.MultiLineFunctionDeclaration
147-
- Squiz.NamingConventions.ValidFunctionName
148155
- Squiz.Operators.ValidLogicalOperators
149156
- Squiz.PHP.DisallowSizeFunctionsInLoops
150157
- Squiz.PHP.Eval

phpcs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
<arg name="extensions" value="php"/>
66

7+
<file>CakePHP/</file>
8+
79
<!-- CakePHP coding standard -->
810
<rule ref="CakePHP"/>
911

0 commit comments

Comments
 (0)