Skip to content

Commit d0fa577

Browse files
authored
Merge pull request #12 from LordSimal/cake5
Fix CI
2 parents 692e229 + 1d08749 commit d0fa577

30 files changed

Lines changed: 173 additions & 225 deletions

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
root = true
44

55
[*]
6-
indent_style = tab
6+
indent_style = space
77
indent_size = 4
88
end_of_line = lf
99
insert_final_newline = true

.github/workflows/ci.yml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- cake5
78
pull_request:
89
workflow_dispatch:
910

@@ -13,11 +14,11 @@ jobs:
1314
strategy:
1415
fail-fast: false
1516
matrix:
16-
php-version: [ '8.0' ]
17+
php-version: [ '8.1', '8.2' ]
1718
db-type: [ 'sqlite', 'mysql', 'pgsql' ]
1819
prefer-lowest: [ '' ]
1920
include:
20-
- php-version: '8.0'
21+
- php-version: '8.1'
2122
db-type: 'sqlite'
2223
prefer-lowest: 'prefer-lowest'
2324

@@ -30,7 +31,7 @@ jobs:
3031
POSTGRES_PASSWORD: postgres
3132

3233
steps:
33-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v4
3435

3536
- name: Setup Service
3637
if: matrix.db-type == 'mysql'
@@ -50,7 +51,7 @@ jobs:
5051
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5152

5253
- name: Cache dependencies
53-
uses: actions/cache@v2
54+
uses: actions/cache@v3
5455
with:
5556
path: ${{ steps.composercache.outputs.dir }}
5657
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
@@ -80,52 +81,48 @@ jobs:
8081
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
8182
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi
8283
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
83-
if [[ ${{ matrix.php-version }} == '8.0' && ${{ matrix.db-type }} == 'sqlite' ]]; then
84-
vendor/bin/phpunit --coverage-clover=coverage.xml
84+
if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.db-type }} == 'sqlite' ]]; then
85+
vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
8586
else
86-
vendor/bin/phpunit
87+
vendor/bin/phpunit --display-deprecations
8788
fi
8889
8990
- name: Validate prefer-lowest
9091
run: if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then vendor/bin/validate-prefer-lowest -m; fi
9192

9293
- name: Code Coverage Report
93-
if: success() && matrix.php-version == '8.0' && matrix.db-type == 'sqlite'
94-
uses: codecov/codecov-action@v1
94+
if: success() && matrix.php-version == '8.1' && matrix.db-type == 'sqlite'
95+
uses: codecov/codecov-action@v3
9596

9697
validation:
9798
name: Coding Standard & Static Analysis
9899
runs-on: ubuntu-22.04
99100

100101
steps:
101-
- uses: actions/checkout@v2
102+
- uses: actions/checkout@v4
102103

103104
- name: Setup PHP
104105
uses: shivammathur/setup-php@v2
105106
with:
106-
php-version: '8.0'
107+
php-version: '8.1'
107108
extensions: mbstring, intl
108109
coverage: none
110+
tools: phive, cs2pr
109111

110-
- name: Get composer cache directory
111-
id: composercache
112-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
112+
- name: Composer install
113+
uses: ramsey/composer-install@v2
113114

114-
- name: Cache dependencies
115-
uses: actions/cache@v2
116-
with:
117-
path: ${{ steps.composercache.outputs.dir }}
118-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
119-
restore-keys: ${{ runner.os }}-composer-
120-
121-
- name: Composer phpstan setup
122-
run: composer stan-setup
115+
- name: Install PHP tools with phive.
116+
run: "phive install --trust-gpg-keys 'CF1A108D0E7AE720,51C67305FFC2E5C0,12CE0F1D262429A5'"
123117

124-
- name: Run phpstan
125-
run: vendor/bin/phpstan analyse --error-format=github
118+
- name: Run phpcs
119+
if: always()
120+
run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr
126121

127122
- name: Run psalm
128-
run: vendor/bin/psalm.phar --output-format=github
123+
if: always()
124+
run: tools/psalm --output-format=github
129125

130-
- name: Run phpcs
131-
run: composer cs-check
126+
- name: Run phpstan
127+
if: always()
128+
run: tools/phpstan analyse --error-format=github

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/node_modules
1010
webroot/modified
1111
.phpunit.cache/test-results
12+
/tools

.phive/phars.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="phpstan" version="1.10.28" installed="1.10.28" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.14.1" installed="5.14.1" location="./tools/psalm" copy="false"/>
5+
</phive>

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"require-dev": {
1616
"cakedc/cakephp-phpstan": "3.next-cake5-dev",
1717
"cakephp/cakephp-codesniffer": "^5.1",
18-
"phpunit/phpunit": "^10.0"
18+
"phpunit/phpunit": "^10.1"
1919
},
2020
"autoload": {
2121
"psr-4": {
@@ -30,16 +30,18 @@
3030
}
3131
},
3232
"scripts": {
33-
"cs-check": "phpcs --colors --parallel=16 -p src/",
34-
"cs-fix": "phpcbf --colors --parallel=16 -p src/",
35-
"phpstan": "phpstan.phar analyse",
36-
"psalm": "psalm.phar --show-info=false",
33+
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
34+
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
35+
"phpstan": "tools/phpstan analyse",
36+
"psalm": "tools/psalm --show-info=false",
3737
"stan": [
3838
"@phpstan",
3939
"@psalm"
4040
],
41+
"stan-baseline": "tools/phpstan --generate-baseline",
42+
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
4143
"test": "phpunit",
42-
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:~1.9.0 psalm/phar:~5.4.0 && mv composer.backup composer.json",
44+
"stan-setup": "phive install",
4345
"lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json"
4446
},
4547
"config": {

phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<ruleset name="CakePHP DebugKit">
2+
<ruleset name="CakePHP Assets Plugin">
33
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />
44

55
<rule ref="CakePHP" />
@@ -8,4 +8,4 @@
88
<property name="lineLimit" value="150"/>
99
</properties>
1010
</rule>
11-
</ruleset>
11+
</ruleset>

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ parameters:
88
- tests/bootstrap.php
99

1010
includes:
11-
- vendor/cakedc/cakephp-phpstan/extension.neon
11+
- vendor/cakedc/cakephp-phpstan/extension.neon

phpunit.xml.dist

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache">
3-
<php>
4-
<!-- E_ALL => 32767 -->
5-
<!-- E_ALL & ~E_USER_DEPRECATED => 16383 -->
6-
<ini name="error_reporting" value="16383"/>
7-
</php>
8-
<testsuites>
9-
<testsuite name="assets">
10-
<directory>tests/</directory>
11-
</testsuite>
12-
</testsuites>
13-
<!-- Prevent coverage reports from looking in tests, vendors, config folders -->
14-
<coverage/>
15-
<source>
16-
<include>
17-
<directory suffix=".php">src/</directory>
18-
</include>
19-
</source>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
bootstrap="tests/bootstrap.php"
4+
colors="true"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache">
7+
<php>
8+
<!-- E_ALL => 32767 -->
9+
<!-- E_ALL & ~E_USER_DEPRECATED => 16383 -->
10+
<ini name="error_reporting" value="16383"/>
11+
</php>
12+
13+
<testsuites>
14+
<testsuite name="assets">
15+
<directory>tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<!-- Prevent coverage reports from looking in tests, vendors, config folders -->
20+
<source>
21+
<include>
22+
<directory suffix=".php">src/</directory>
23+
</include>
24+
</source>
2025
</phpunit>

psalm-baseline.xml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.x-dev@">
2+
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
33
<file src="src/Controller/Admin/AssetsController.php">
4-
<MissingDependency occurrences="1">
5-
<code>AppController</code>
6-
</MissingDependency>
4+
<InternalClass>
5+
<code><![CDATA[new CallbackStream(function () use ($asset) {
6+
return $asset->read();
7+
})]]></code>
8+
</InternalClass>
9+
<TooManyTemplateParams>
10+
<code><![CDATA[$this->paginate($this->Assets)]]></code>
11+
</TooManyTemplateParams>
712
</file>
813
<file src="src/Controller/AppController.php">
9-
<UndefinedClass occurrences="1">
10-
<code>BaseController</code>
11-
</UndefinedClass>
12-
</file>
13-
<file src="src/Model/Entity/Asset.php">
14-
<NonInvariantDocblockPropertyType occurrences="1">
15-
<code>$_accessible</code>
16-
</NonInvariantDocblockPropertyType>
17-
<PossiblyNullReference occurrences="1">
18-
<code>toDateTimeString</code>
19-
</PossiblyNullReference>
14+
<PropertyTypeCoercion>
15+
<code><![CDATA[$this->fetchTable('Assets.Assets')]]></code>
16+
</PropertyTypeCoercion>
2017
</file>
2118
</files>

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7+
findUnusedBaselineEntry="true"
8+
findUnusedCode="false"
79
errorBaseline="psalm-baseline.xml"
810
>
911
<projectFiles>

0 commit comments

Comments
 (0)