Skip to content

Commit

Permalink
Merge 98aba43 into b1b91c4
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Apr 10, 2024
2 parents b1b91c4 + 98aba43 commit 862a075
Show file tree
Hide file tree
Showing 25 changed files with 1,019 additions and 105 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
test-current-versions:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
ext-parallel: [ '', 'parallel' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -45,10 +48,13 @@ jobs:

- name: Setup PHP
uses: shivammathur/setup-php@v2
id: setup-php
with:
php-version: 8.3
coverage: xdebug
extensions: ast
extensions: ast, ${{ matrix.ext-parallel }}
env:
phpts: zts

- name: Build project
run: make build --no-print-directory
Expand Down
12 changes: 9 additions & 3 deletions .phan.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@
'directory_list' => [
'src',

'vendor/jbzoo/ci-report-converter/src',
'vendor/jbzoo/cli/src',
'vendor/jbzoo/data/src',
'vendor/jbzoo/cli/src',
'vendor/jbzoo/utils/src',
'vendor/league/csv/src',
'vendor/jbzoo/ci-report-converter/src',

'vendor/symfony/console',
'vendor/symfony/finder',
'vendor/symfony/yaml',

'vendor/league/csv/src',
'vendor/markrogoyski/math-php/src',
'vendor/respect/validation',
'vendor/fidry/cpu-core-counter',
],
'autoload_internal_extension_signatures' => [
'parallel' => 'tests/stubs/parallel.stub_php',
],
]);
15 changes: 14 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@

namespace JBZoo\Codestyle\PhpCsFixer;

return (new PhpCsFixerCodingStandard(__DIR__))->getFixerConfig(null, [
use Symfony\Component\Finder\Finder;

$finder = (new Finder())
->files()
->followLinks()
->ignoreVCS(true)
->ignoreDotFiles(false)
->in(__DIR__)
->exclude('vendor')
->exclude('docker') // preload.php!
->exclude('build')
->name('/\.php$/');

return (new PhpCsFixerCodingStandard(__DIR__))->getFixerConfig($finder, [
'binary_operator_spaces' => [
'operators' => [
'=' => 'single_space',
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ COPY . /tmp
RUN make build-version

########################################################################################
FROM php:8.3-cli-alpine
FROM php:8.3-zts-alpine

# Install PHP extensions
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions opcache @composer
RUN install-php-extensions opcache parallel @composer

# Install application
# run `make build-version` before!
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ You can find launch examples in the [workflow demo](https://github.com/JBZoo/Csv
# Add flag `--profile` if you want to see profiling info. Add details with `-vvv`.
# Add flag `--debug` if you want to see more really deep details.
# Add flag `--dump-schema` if you want to see the final schema after all includes and inheritance.
# Default value: 'options: --ansi -v'
# Default value: 'options: --ansi'
# You can skip it.
extra: 'options: --ansi -v'
extra: 'options: --ansi'
```
<!-- auto-update:/github-actions-yml -->

Expand Down Expand Up @@ -1466,6 +1466,10 @@ Options:
--debug Intended solely for debugging and advanced profiling purposes.
Activating this option provides detailed process insights,
useful for troubleshooting and performance analysis.
-p, --parallel[=PARALLEL] Experimental! Launches the process in parallel mode (if possible). Works only with ext-parallel.
You can specify the number of threads.
If you do not specify a value, the number of threads will be equal to the number of CPU cores.
By default, the process is launched in a single-threaded mode. [default: "1"]
--no-progress Disable progress bar animation for logs. It will be used only for text output format.
--mute-errors Mute any sort of errors. So exit code will be always "0" (if it's possible).
It has major priority then --non-zero-on-error. It's on your own risk!
Expand Down Expand Up @@ -1522,6 +1526,10 @@ Options:
--debug Intended solely for debugging and advanced profiling purposes.
Activating this option provides detailed process insights,
useful for troubleshooting and performance analysis.
-p, --parallel[=PARALLEL] Experimental! Launches the process in parallel mode (if possible). Works only with ext-parallel.
You can specify the number of threads.
If you do not specify a value, the number of threads will be equal to the number of CPU cores.
By default, the process is launched in a single-threaded mode. [default: "1"]
--no-progress Disable progress bar animation for logs. It will be used only for text output format.
--mute-errors Mute any sort of errors. So exit code will be always "0" (if it's possible).
It has major priority then --non-zero-on-error. It's on your own risk!
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ inputs:
Add flag `--profile` if you want to see profiling info. Add details with `-vvv`.
Add flag `--debug` if you want to see more really deep details.
Add flag `--dump-schema` if you want to see the final schema after all includes and inheritance.
default: 'options: --ansi -v'
default: 'options: --ansi'

runs:
using: 'docker'
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"respect/validation" : "^2.3.6",
"giggsey/libphonenumber-for-php-lite" : "^8.13.34",
"giggsey/locale" : "^2.5",
"symfony/polyfill-mbstring" : "^1.29.0"
"symfony/polyfill-mbstring" : "^1.29.0",
"fidry/cpu-core-counter" : "^1.1.0"
},

"require-dev" : {
Expand Down
135 changes: 68 additions & 67 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion csv-blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@

namespace JBZoo\CsvBlueprint;

use JBZoo\CsvBlueprint\Workers\WorkerPool;

if ('cli' !== \PHP_SAPI) {
throw new \RuntimeException('This script must be run from the command line.');
}

\define('PATH_ROOT', __DIR__);
require_once __DIR__ . '/vendor/autoload.php';
$autoloader = __DIR__ . '/vendor/autoload.php';
require_once $autoloader;

WorkerPool::setBootstrap($autoloader);

// Fix for GitHub actions. See action.yml
$_SERVER['argv'] = Utils::fixArgv($_SERVER['argv'] ?? []);
Expand Down
4 changes: 4 additions & 0 deletions docker/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ memory_limit=2G
realpath_cache_size = 64M
realpath_cache_ttl = 100000

;error_reporting = E_ALL
;display_errors = On
;display_startup_errors = On

;opcache.preload=/app/docker/preload.php
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@
</errorLevel>
</TooManyArguments>
</issueHandlers>
<stubs>
<file name="tests/stubs/parallel.stub_php" />
</stubs>
</psalm>
Loading

0 comments on commit 862a075

Please sign in to comment.