Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.next cake5 #54

Merged
merged 6 commits into from
Sep 30, 2023
Merged
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
118 changes: 10 additions & 108 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,21 @@ name: CI

on:
push:

branches:
- master
- 3.next-cake5
pull_request:
branches:
- '*'

permissions:
contents: read

jobs:
testsuite:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['8.1']
db-type: [sqlite, mysql, pgsql]
prefer-lowest: ['']

steps:
- name: Setup MySQL latest
if: matrix.db-type == 'mysql'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin

- name: Setup PostgreSQL latest
if: matrix.db-type == 'pgsql'
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres

- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, apcu, sqlite, pdo_sqlite, pdo_${{ matrix.db-type }}, ${{ matrix.db-type }}
ini-values: apc.enable_cli = 1
coverage: pcov

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Get date part for cache key
id: key-date
run: echo "::set-output name=date::$(date +'%Y-%m')"

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}

- name: composer install
run: |
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --prefer-lowest --prefer-stable
else
composer update
fi

- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '7.4' && 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:[email protected]/cakephp?encoding=utf8'; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:[email protected]/postgres'; fi
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi

- name: Submit code coverage
if: matrix.php-version == '7.4'
uses: codecov/codecov-action@v1
uses: cakephp/.github/.github/workflows/[email protected]
secrets: inherit

cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, apcu
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Get date part for cache key
id: key-date
run: echo "::set-output name=date::$(date +'%Y-%m')"

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}

- name: composer install
run: composer stan-setup

- name: Run PHP CodeSniffer
run: composer cs-check

# - name: Run psalm
# if: success() || failure()
# run: vendor/bin/psalm.phar --output-format=github

# - name: Run phpstan
# if: success() || failure()
# run: composer stan
uses: cakephp/.github/.github/workflows/[email protected]
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/auth.json
/.ddev
/.idea
/.phpunit.result.cache
5 changes: 5 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.10.32" installed="1.10.32" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
</phive>
4 changes: 2 additions & 2 deletions .semver
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
:major: 2
:major: 3
:minor: 0
:patch: 4
:patch: 0
:special: ''
:metadata: ''
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Enumeration list for [CakePHP 5](http://cakephp.org).
Versions and branches
---------------------

| CakePHP | CakeDC Enum Plugin | Tag | Notes |
|:-----------|:--------------------------------------------------------|:----------|:---------|
| ^5.0.0-dev | [3.next](https://github.com/cakedc/enum/tree/3next) | 3.0.0-dev | unstable |
| ^4.0 | [2.next](https://github.com/cakedc/enum/tree/2.next) | 2.0.4 | stable |
| ^3.7 | [master](https://github.com/cakedc/enum/tree/master) | 1.5.0 | stable |
| ^3.7 | [develop](https://github.com/cakedc/enum/tree/develop) | - | unstable |
| ^3.6 | [master](https://github.com/cakedc/enum/tree/1.4.0) | 1.4.0 | stable |
| 3.1 - 3.5 | | 1.3.0 | stable |
| CakePHP | CakeDC Enum Plugin | Tag | Notes |
|:----------|:-------------------------------------------------------|:------|:---------|
| ^5.0.0 | [3.next](https://github.com/cakedc/enum/tree/3next) | 3.0.0 | unstable |
| ^4.0 | [2.next](https://github.com/cakedc/enum/tree/2.next) | 2.0.4 | stable |
| ^3.7 | [master](https://github.com/cakedc/enum/tree/master) | 1.5.0 | stable |
| ^3.7 | [develop](https://github.com/cakedc/enum/tree/develop) | - | unstable |
| ^3.6 | [master](https://github.com/cakedc/enum/tree/1.4.0) | 1.4.0 | stable |
| 3.1 - 3.5 | | 1.3.0 | stable |


Install
Expand All @@ -27,7 +27,7 @@ Install
Using [Composer](http://getcomposer.org):

```
composer require cakedc/enum:3.0.0-dev
composer require cakedc/enum
```

You then need to load the plugin. You can use the shell command:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-dev
3.0.0
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
},
"require": {
"php": ">=8.1",
"cakephp/cakephp": "5.x-dev"
"cakephp/cakephp": "^5.0.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"phpunit/phpunit": "^10.1.0",
"cakephp/cakephp-codesniffer": "^5.0",
"cakephp/bake": "3.x-dev",
"cakephp/migrations": "4.x-dev",
"aura/intl": "^3.0"
"cakephp/bake": "^3.0.0",
"cakephp/migrations": "^4.0.0",
"aura/intl": "^3.0",
"vimeo/psalm": "^5.15",
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4": {
Expand All @@ -34,8 +36,6 @@
"CakeDC\\Enum\\Test\\": "tests"
}
},
"prefer-stable": true,
"minimum-stability": "dev",
"scripts": {
"analyse": [
"@stan",
Expand Down
12 changes: 12 additions & 0 deletions config/Migrations/001_create_enum_lookups.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?php
declare(strict_types=1);

/**
* Copyright 2015 - 2023, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2015 - 2023, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

use Phinx\Migration\AbstractMigration;

class CreateEnumLookups extends AbstractMigration
Expand Down
6 changes: 6 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Throttle">
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />

<rule ref="CakePHP" />
</ruleset>
8 changes: 5 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
parameters:
level: 4
autoload_files:
- tests/bootstrap.php
level: 6
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src
37 changes: 20 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Enum Test Cases">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>
<!-- Setup a listener for fixtures -->
<extensions>
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
</extensions>
<!-- Prevent coverage reports from looking in tests and vendors -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage/>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
</php>
<testsuites>
<testsuite name="Enum Test Cases">
<directory>tests/TestCase/</directory>
</testsuite>
</testsuites>
<extensions>
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
</extensions>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
Loading