Skip to content

Commit

Permalink
Release preparations (#193)
Browse files Browse the repository at this point in the history
* Update docs [skip ci]

* Update PR template [skip ci]

* Add composer require checker

* Change version for CRC

* Fix CRC (WIP), use symfony/console directly

* Remove remaining ExitCode occurence

* Exclude PHP 8.0 from CI

* Add symfony finder as a dependency

* Add cycle/database dependency, bump versions

* Fix remaining CRC issues

* Add rector

* Apply Rector changes (CI)

* Apply fixes from StyleCI

* Min MSI 100%

* Remove remaining links [skip ci]

* Remove extra line [skip ci]

* Update .github/workflows/composer-require-checker.yml

Co-authored-by: Sergei Predvoditelev <[email protected]>

* Revert some Rector changes

* Change push rules for CI (review fix)

* Update README.md

Co-authored-by: Sergei Predvoditelev <[email protected]>

* Update rector.php

Co-authored-by: Sergei Predvoditelev <[email protected]>

* Apply Rector changes (CI)

* Change rules for CI, BC (review fix)

* Drop 4 version of Psalm

---------

Co-authored-by: arogachev <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Sergei Predvoditelev <[email protected]>
  • Loading branch information
4 people authored Mar 13, 2024
1 parent e4ab25f commit 8619e9f
Show file tree
Hide file tree
Showing 57 changed files with 263 additions and 186 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
| Is bugfix? | ✔️/❌
| New feature? | ✔️/❌
| Breaks BC? | ✔️/❌
| Fixed issues | comma-separated list of tickets # fixed by the PR, if any
42 changes: 31 additions & 11 deletions .github/workflows/bc.yml_
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
on:
- pull_request
- push
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'phpunit.xml.dist'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: backwards compatibility

jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
roave_bc_check:
uses: yiisoft/actions/.github/workflows/bc.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.3']
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand Down Expand Up @@ -38,7 +39,6 @@ jobs:
- windows-latest

php:
- 8.0
- 8.1
- 8.2
- 8.3
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: Composer require checker

jobs:
composer-require-checker:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
4 changes: 3 additions & 1 deletion .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -26,6 +27,7 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.2']
['8.3']
min-covered-msi: 100
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
21 changes: 21 additions & 0 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: rector

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.3']
32 changes: 2 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,8 @@ Read more in the [official documentation](https://cycle-orm.dev/docs/readme/2.x)

## Documentation

- [English](docs/en/README.md)
- [Russian](docs/ru/README.md)
- [Spanish](docs/es/README.md)

## Testing

### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

### Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

### Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```
- Guide: [English](docs/en/guide), [Russian](docs/ru/guide), [Spanish](docs/es/guide)
- [Internals](docs/internals.md)

## License

Expand Down
19 changes: 19 additions & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"symbol-whitelist" : [
"JetBrains\\PhpStorm\\ExpectedValues",
"JetBrains\\PhpStorm\\Pure"
],
"php-core-extensions" : [
"Core",
"date",
"json",
"hash",
"pcre",
"Phar",
"Reflection",
"SPL",
"random",
"standard"
],
"scan-files" : []
}
22 changes: 15 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,38 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.0",
"cycle/annotated": "^3.2.1",
"php": "^8.1",
"cycle/annotated": "^3.5",
"cycle/database": "^2.8",
"cycle/migrations": "^3.1.1|^4.0",
"cycle/orm": "^2.2.2",
"cycle/orm": "^2.7",
"cycle/schema-migrations-generator": "^2.0",
"cycle/schema-renderer": "^1.2",
"cycle/schema-builder": "^2.7",
"cycle/schema-builder": "^2.8",
"cycle/schema-provider": "^1.0",
"psr/container": "^2.0",
"psr/event-dispatcher": "^1.0",
"psr/log": "^3.0",
"psr/simple-cache": "^2.0|^3.0",
"spiral/attributes": "^2.7|^3.0",
"webmozart/glob": "^4.0",
"spiral/core": "^3.12",
"spiral/tokenizer": "^3.12",
"webmozart/glob": "^4.7",
"yiisoft/aliases": "^1.1|^2.0|^3.0",
"yiisoft/friendly-exception": "^1.1",
"yiisoft/injector": "^1.1",
"yiisoft/yii-console": "^2.0"
"symfony/console": "^6.4",
"symfony/finder":"^5.4"
},
"require-dev": {
"cycle/entity-behavior": "^1.0",
"jetbrains/phpstorm-attributes": "^1.0",
"maglnet/composer-require-checker": "^4.3",
"phpunit/phpunit": "^9.6",
"rector/rector": "^1.0",
"roave/infection-static-analysis-plugin": "^1.25",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.7",
"vimeo/psalm": "^5.7",
"yiisoft/definitions": "^3.2",
"yiisoft/di": "^1.2",
"yiisoft/test-support": "^3.0"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ In `yii-cycle` package schema can be built from multiple sources represented by
In order to use multiple schema providers in turn, grouping `Cycle\Schema\Provider\Support\SchemaProviderPipeline`
provider is used. You can configure this provider in `schema-providers` section of a `config/params.php` file.
Arrage schema providers in such an order, that caching providers are at the top of the list,
and origin schema providers at the end.

and origin schema providers at the end.

## Entity attributes based schema

Expand Down
1 change: 0 additions & 1 deletion docs/es/README.md → docs/guide/es/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Este paquete proporciona una manera conveniente de integrarlo con el framework Y

- [Instalación y configuración](installation.md)
- [Comandos de consola](console-commands.md)
- [Clase EntityReader](entity-reader.md)
- [Lectura del esquema de datos](reading-schema.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion docs/ru/README.md → docs/guide/ru/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Cycle — это DataMapper ORM, спроектированный для без

- [Установка и настройка](installation.md)
- [Консольные команды](console-commands.md)
- [Класс EntityReader](entity-reader.md)
- [Чтение схемы данных](reading-schema.md)

# Другие пакеты
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions docs/internals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Internals

## Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

## Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

## Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```

## Code style

Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or
use either newest or any specific version of PHP:

```shell
./vendor/bin/rector
```

## Dependencies

Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive
[Composer](https://getcomposer.org/) dependencies.
27 changes: 27 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
]);

$rectorConfig->skip([
ClosureToArrowFunctionRector::class,
]);
};
5 changes: 1 addition & 4 deletions src/Command/CycleDependencyProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@

final class CycleDependencyProxy
{
private ContainerInterface $container;

public function __construct(ContainerInterface $container)
public function __construct(private readonly ContainerInterface $container)
{
$this->container = $container;
}

public function getDatabaseProvider(): DatabaseProviderInterface
Expand Down
7 changes: 1 addition & 6 deletions src/Command/Migration/BaseMigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@

abstract class BaseMigrationCommand extends Command
{
protected CycleDependencyProxy $promise;

protected const MIGRATION_STATUS = [
State::STATUS_UNDEFINED => 'undefined',
State::STATUS_PENDING => 'pending',
State::STATUS_EXECUTED => 'executed',
];

public function __construct(CycleDependencyProxy $promise)
public function __construct(protected CycleDependencyProxy $promise)
{
$this->promise = $promise;
parent::__construct();
}

Expand Down Expand Up @@ -62,8 +59,6 @@ protected function createEmptyMigration(
}

/**
* @param OutputInterface $output
*
* @return MigrationInterface[]
*/
protected function findMigrations(OutputInterface $output): array
Expand Down
3 changes: 1 addition & 2 deletions src/Command/Migration/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Yiisoft\Yii\Console\ExitCode;

final class CreateCommand extends BaseMigrationCommand
{
Expand All @@ -27,6 +26,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->createEmptyMigration($output, $customName);

return ExitCode::OK;
return self::SUCCESS;
}
}
Loading

0 comments on commit 8619e9f

Please sign in to comment.