Skip to content

Commit 1a698c2

Browse files
authored
#19 Refactoring to next version
2 parents 9a4957e + ddbff2d commit 1a698c2

28 files changed

+118
-132
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ jobs:
2020

2121
- name: Install composer dependencies
2222
run: |
23+
# Install code check tools
2324
composer run cs:install
24-
2525
# Install app dependencies
2626
composer install --no-interaction --prefer-dist
2727
28-
# Check code checker and coding standards
2928
- name: Check coding standards
3029
run: |
3130
composer run cs:check
@@ -37,7 +36,7 @@ jobs:
3736
runs-on: ubuntu-latest
3837
strategy:
3938
matrix:
40-
php: ['7.2', '7.3', '7.4'] # 8.0
39+
php: ['7.2', '7.3', '7.4', '8.0']
4140

4241
name: PHP ${{ matrix.php }} tests
4342
steps:
@@ -52,6 +51,9 @@ jobs:
5251

5352
- name: Install composer dependencies
5453
run: |
54+
# Remove unnecesery packages
55+
composer remove phpstan/phpstan phpstan/phpstan-nette --dev --no-interaction
56+
# Install app dependencies
5557
composer install --no-interaction --prefer-dist
5658
5759
- name: Run tests
@@ -65,3 +67,29 @@ jobs:
6567
flags: unittests
6668
name: codecov-umbrella
6769
fail_ci_if_error: true
70+
71+
benchmark:
72+
runs-on: ubuntu-latest
73+
strategy:
74+
matrix:
75+
php: ['7.4']
76+
77+
name: Benchmark on PHP ${{ matrix.php }}
78+
steps:
79+
- name: Git clone
80+
uses: actions/checkout@master
81+
82+
- name: Install PHP
83+
uses: shivammathur/setup-php@master
84+
with:
85+
php-version: ${{ matrix.php }}
86+
87+
- name: Install composer dependencies
88+
run: |
89+
# Install benchmarking tool
90+
composer global require phpbench/phpbench @dev
91+
# Install app dependencies
92+
composer install --no-interaction --prefer-dist
93+
94+
- name: Run benchmarks
95+
run: phpbench run

README.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center">
2-
Math PHP computational engine
2+
Mathematicator Framework Engine
33
</h1>
44

55
<p align="center">
@@ -10,20 +10,21 @@
1010

1111
[![Integrity check](https://github.com/mathematicator-core/engine/workflows/Integrity%20check/badge.svg)](https://github.com/mathematicator-core/engine/actions?query=workflow%3A%22Integrity+check%22)
1212
[![codecov](https://codecov.io/gh/mathematicator-core/engine/branch/master/graph/badge.svg)](https://codecov.io/gh/mathematicator-core/engine)
13+
[![Latest stable version](https://poser.pugx.org/mathematicator-core/engine/v/stable)](https://packagist.org/packages/mathematicator-core/engine)
1314
[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](./LICENSE)
1415
[![PHPStan Enabled](https://img.shields.io/badge/PHPStan-enabled%20L8-brightgreen.svg?style=flat)](https://phpstan.org/)
1516

16-
Extremely complex library for advance work with math patterns, tokens and computing.
17+
This is a Mathematicator Framework common library for advance work with
18+
math patterns, tokens and computing. The library is considered as
19+
a sublayer for other tools in Mathematicator Framework.
1720

18-
> Please help improve this documentation by sending a Pull request.
19-
20-
Install by Composer:
21+
## Installation
2122

2223
```
2324
composer require mathematicator-core/engine
2425
```
2526

26-
### What is this package responsible for?
27+
## Features
2728

2829
This package contains set of tools that other [mathematicator-core](https://github.com/mathematicator-core)
2930
packages have in common.
@@ -141,8 +142,31 @@ one to the most abstract one:
141142
</tr>
142143
</table>
143144

145+
**Third-party packages:**
146+
147+
⚠️ Not guaranteed!
148+
149+
<table>
150+
<tr>
151+
<td>
152+
<b>
153+
<a href="https://github.com/cothema/math-php-api">
154+
REST API
155+
</a>
156+
</b>
157+
</td>
158+
<td>
159+
Install the whole pack as a REST API service
160+
on your server (Docker ready) or
161+
access it via public cloud REST API.
162+
</td>
163+
</tr>
164+
</table>
165+
144166
## Contribution
145167

168+
> Please help to improve this documentation by sending a Pull request.
169+
146170
### Tests
147171

148172
All new contributions should have its unit tests in `/tests` directory.
@@ -154,6 +178,13 @@ This package uses [Nette Tester](https://tester.nette.org/). You can run tests v
154178
composer test
155179
````
156180

181+
For benchmarking, we use [phpbench](https://github.com/phpbench/phpbench).
182+
You can run benchmarks this way:
183+
```bash
184+
composer global require phpbench/phpbench @dev # only the first time
185+
phpbench run
186+
````
187+
157188
Before PR, please run complete code check via command:
158189
```bash
159190
composer cs:install # only first time

benchmarks/.gitkeep

Whitespace-only changes.

common.neon

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,3 @@ services:
1616

1717
extensions:
1818
psr11: Contributte\Psr11\DI\Psr11ContainerExtension
19-
20-
orm.annotations:
21-
paths:
22-
Mathematicator: %appDir%/../vendor/mathematicator-core/engine/src

composer.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@
1717
],
1818
"require": {
1919
"php": ">=7.2",
20-
"baraja-core/localization": "^1.0",
2120
"contributte/psr11-container-interface": "^0.4.1",
22-
"mathematicator-core/numbers": "^2.0@dev",
23-
"mathematicator-core/tokenizer": "^2.0@dev",
21+
"mathematicator-core/numbers": "^2.1@dev",
22+
"mathematicator-core/tokenizer": "^2.1@dev",
2423
"nette/di": "^3.0",
2524
"nette/utils": "^3.0",
2625
"symfony/yaml": "^5.0",
27-
"symfony/translation": "^4.0 || ^5.0"
26+
"symfony/translation": "^5.0"
2827
},
2928
"require-dev": {
30-
"baraja-core/doctrine": "^2.0",
3129
"brainmaestro/composer-git-hooks": "^2.8",
3230
"nette/bootstrap": "^3.0.1",
3331
"nette/tester": "^2.3",
@@ -56,12 +54,12 @@
5654
"composer create-project nette/coding-standard temp/coding-standard ^2 --no-progress"
5755
],
5856
"cs:check": [
59-
"php temp/code-checker/code-checker --short-arrays --strict-types --no-progress",
60-
"php temp/coding-standard/ecs check src --config temp/coding-standard/coding-standard-php71.yml"
57+
"php temp/code-checker/code-checker -d src -d tests -d benchmarks --short-arrays --strict-types --no-progress",
58+
"php temp/coding-standard/ecs check src tests benchmarks --config temp/coding-standard/coding-standard-php71.yml"
6159
],
6260
"cs:fix": [
63-
"php temp/code-checker/code-checker -d src -d tests --short-arrays --strict-types --fix --no-progress",
64-
"php temp/coding-standard/ecs check src --config temp/coding-standard/coding-standard-php71.yml --fix"
61+
"php temp/code-checker/code-checker -d src -d tests -d benchmarks --short-arrays --strict-types --fix --no-progress",
62+
"php temp/coding-standard/ecs check src tests benchmarks --config temp/coding-standard/coding-standard-php71.yml --fix"
6563
],
6664
"phpstan": "vendor/bin/phpstan analyse src -c phpstan.neon --level 8 --no-progress",
6765
"fix": [
@@ -79,7 +77,7 @@
7977
},
8078
"extra": {
8179
"branch-alias": {
82-
"dev-master": "2.0.x-dev"
80+
"dev-master": "2.1.x-dev"
8381
},
8482
"hooks": {
8583
"post-merge": "composer install",

phpbench.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"bootstrap": "vendor/autoload.php",
3+
"path": "benchmarks"
4+
}

tests/bootstrap.php renamed to tests/Bootstrap.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ public static function boot(): Container
2626

2727
$configurator->createRobotLoader()
2828
->addDirectory(__DIR__ . '/../src')
29-
->addDirectory(__DIR__ . '/Mocks')
3029
->register();
3130

3231
$configurator
33-
// TODO make this work: ->addConfig(__DIR__ . '/../common.neon')
34-
->addConfig(__DIR__ . '/test.common.neon');
32+
->addConfig(__DIR__ . '/../common.neon')
33+
->addConfig(__DIR__ . '/../vendor/mathematicator-core/tokenizer/common.neon');
3534

3635
$container = $configurator->createContainer();
3736

tests/EngineTests/EngineTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
namespace Mathematicator\Engine\Tests;
66

77

8-
use Mathematicator\Engine\Entity\Box;
98
use Mathematicator\Engine\Engine;
9+
use Mathematicator\Engine\Entity\Box;
1010
use Mathematicator\Engine\Entity\EngineMultiResult;
1111
use Mathematicator\Engine\Entity\EngineSingleResult;
1212
use Nette\DI\Container;
1313
use Tester\Assert;
1414
use Tester\TestCase;
1515

16-
require __DIR__ . '/../bootstrap.php';
16+
require __DIR__ . '/../Bootstrap.php';
1717

1818
class EngineTest extends TestCase
1919
{

tests/EngineTests/Entity/BoxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Tester\Assert;
1515
use Tester\TestCase;
1616

17-
require __DIR__ . '/../../bootstrap.php';
17+
require __DIR__ . '/../../Bootstrap.php';
1818

1919
class BoxTest extends TestCase
2020
{

tests/EngineTests/Entity/ContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Tester\Assert;
1414
use Tester\TestCase;
1515

16-
require __DIR__ . '/../../bootstrap.php';
16+
require __DIR__ . '/../../Bootstrap.php';
1717

1818
class ContextTest extends TestCase
1919
{

0 commit comments

Comments
 (0)