Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 9 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.2', '8.3', '8.4']
php-version: ['8.3', '8.4', '8.5']
db-type: [sqlite, mysql, pgsql]
prefer-lowest: ['']

Expand Down Expand Up @@ -59,22 +59,22 @@ jobs:
fi

- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '8.2' && matrix.db-type == 'mysql'
if: matrix.php-version == '8.3' && matrix.db-type == 'mysql'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run PHPUnit
run: |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
if [[ ${{ matrix.php-version }} == '8.2' ]]; then
if [[ ${{ matrix.php-version }} == '8.3' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi

- name: Submit code coverage
if: matrix.php-version == '8.2'
if: matrix.php-version == '8.3'
uses: codecov/codecov-action@v5

cs-stan:
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
extensions: mbstring, intl, apcu
coverage: none

Expand All @@ -103,21 +103,10 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-cs-stan

- name: composer install
run: composer stan-setup

- name: Run PHP CodeSniffer
run: composer cs-check
continue-on-error: true

- name: Run psalm
if: success() || failure()
run: vendor/bin/psalm.phar --output-format=github
continue-on-error: true
run: composer install --prefer-dist --no-progress

- name: Run phpstan
if: success() || failure()
run: composer stan
continue-on-error: true
- name: Run All Gates
run: composer check
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Versions and branches
Documentation
-------------

For documentation, as well as tutorials, see the [Docs](docs/home.md) directory of this repository.
For documentation, see the [Docs](docs/index.md) directory of this repository.

Support
-------
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
"source": "https://github.com/CakeDC/cakephp-api"
},
"require": {
"php": ">=8.2",
"php": ">=8.3",
"ext-json": "*",
"cakephp/cakephp": "^5.1",
"cakedc/users": "^16.0",
"crustum/cakephp-attribute-resolver": "^1.0",
"lcobucci/clock": "^2.2.0,<2.3.0",
"lcobucci/jwt": "^5.5.0",
"firebase/php-jwt": "^6.3 || ^7.0"
Expand Down Expand Up @@ -100,13 +101,14 @@
"analyse": [
"@stan"
],
"cs-check": "phpcs -p --standard=phpcs.xml src/ tests/",
"cs-fix": "phpcbf --standard=phpcs.xml src/ tests/",
"cs-check": "vendor/bin/phpcs -p --standard=phpcs.xml src/ tests/",
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml src/ tests/",
"fix-eol": "powershell -NoProfile -ExecutionPolicy Bypass -File tools/fix-lineendings.ps1",
"test": "phpunit --stderr",
"rector-check": "vendor/bin/rector process --dry-run",
"rector-fix": "vendor/bin/rector process",
"stan": "phpstan analyse src/",
"stan-baseline": "phpstan analyse --generate-baseline"
"stan-baseline": "phpstan analyse --generate-baseline",
"structarmed": "vendor/bin/structarmed analyze src"
}
}
27 changes: 27 additions & 0 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

use Cake\AttributeResolver\AttributeResolver;
use Cake\Cache\Cache;
use Cake\Cache\Engine\FileEngine;
use Cake\Core\Configure;
use Cake\Log\Log;

Expand All @@ -30,3 +33,27 @@
'file' => Configure::read('Api.Log.file'),
]);
}

// Attribute resolver cache. Auto-registered with defaults; the host application
// may override by configuring the `_cakedc_api_attributes_` engine (or its own
// engine via the resolver config) before the plugin loads.
if (!in_array('_cakedc_api_attributes_', Cache::configured(), true)) {
Cache::setConfig('_cakedc_api_attributes_', [
'className' => FileEngine::class,
'prefix' => 'cakedc_api_attributes_',
'path' => CACHE . 'persistent' . DS,
'serialize' => true,
'duration' => '+1 hour',
]);
}

// Attribute routing resolver config. Auto-registered so attribute-declared
// service routes work out of the box; override `paths` / `cache` / `validateFiles`
// by configuring the `default` resolver config in the application bootstrap.
if (AttributeResolver::getConfig('default') === null) {
AttributeResolver::setConfig('default', [
'paths' => ['src/Service/*.php', 'src/Service/**/*.php'],
'cache' => '_cakedc_api_attributes_',
'validateFiles' => true,
]);
}
Loading
Loading