Skip to content

Commit 2988e74

Browse files
authored
Merge pull request #7 from BluePsyduck/feature/support-symfony-6.0
feature/support-symfony-6.0
2 parents ec58d2c + 9566c41 commit 2988e74

File tree

4 files changed

+34
-144
lines changed

4 files changed

+34
-144
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -6,131 +6,12 @@ on:
66
- cron: "0 0 * * 0"
77

88
jobs:
9-
10-
unit-tests:
11-
name: Unit Tests
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
php-version:
16-
- "7.2"
17-
- "7.3"
18-
- "7.4"
19-
- "8.0"
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v2
24-
25-
- name: Setup PHP
26-
uses: shivammathur/setup-php@v2
27-
with:
28-
php-version: ${{ matrix.php-version }}
29-
coverage: xdebug
30-
31-
- name: Get composer cache directory
32-
id: composer-cache
33-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
34-
35-
- name: Cache composer dependencies
36-
uses: actions/cache@v2
37-
with:
38-
path: ${{ steps.composer-cache.outputs.dir }}
39-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
40-
restore-keys: ${{ runner.os }}-composer-
41-
42-
- name: Setup problem matchers
43-
run: |
44-
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
45-
echo "::add-matcher::.github/problem-matchers/coverage-check.json"
46-
47-
- name: Update dependencies
48-
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
49-
50-
- name: Run phpunit
51-
run: vendor/bin/phpunit --testsuite unit-test --coverage-clover=coverage.xml
52-
53-
- name: Check coverage.xml existence
54-
id: check-coverage-file
55-
uses: andstor/file-existence-action@v1
56-
with:
57-
files: coverage.xml
58-
59-
- name: Run coverage-check
60-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
61-
run: vendor/bin/coverage-check coverage.xml 100
62-
63-
- name: Upload coverage as artifacts
64-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
65-
uses: actions/upload-artifact@v2
66-
with:
67-
name: coverage-${{ matrix.php-version }}
68-
path: coverage.xml
69-
70-
- name: Upload coverage to Codecov
71-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
72-
uses: codecov/codecov-action@v1
73-
with:
74-
name: coverage-${{ matrix.php-version }}
75-
file: coverage.xml
76-
77-
coding-guidelines:
78-
name: Coding Guidelines
79-
runs-on: ubuntu-latest
80-
steps:
81-
- name: checkout
82-
uses: actions/checkout@v2
83-
84-
- name: Setup PHP
85-
uses: shivammathur/setup-php@v2
86-
with:
87-
php-version: 8.0
88-
tools: cs2pr
89-
coverage: none
90-
91-
- name: Get composer cache directory
92-
id: composer-cache
93-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
94-
95-
- name: Cache composer dependencies
96-
uses: actions/cache@v2
97-
with:
98-
path: ${{ steps.composer-cache.outputs.dir }}
99-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
100-
restore-keys: ${{ runner.os }}-composer-
101-
102-
- name: Update dependencies
103-
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
104-
105-
- name: Run phpcs
106-
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
107-
108-
type-checker:
109-
name: Type Checker
110-
runs-on: ubuntu-latest
111-
steps:
112-
- name: Checkout
113-
uses: actions/checkout@v2
114-
115-
- name: Setup PHP
116-
uses: shivammathur/setup-php@v2
117-
with:
118-
php-version: 8.0
119-
coverage: none
120-
121-
- name: Get composer cache directory
122-
id: composer-cache
123-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
124-
125-
- name: Cache composer dependencies
126-
uses: actions/cache@v2
127-
with:
128-
path: ${{ steps.composer-cache.outputs.dir }}
129-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
130-
restore-keys: ${{ runner.os }}-composer-
131-
132-
- name: Update dependencies
133-
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
134-
135-
- name: Run phpstan
136-
run: vendor/bin/phpstan analyse --no-interaction
9+
call-workflow-ci-php-general:
10+
name: General
11+
uses: BluePsyduck/github-workflows/.github/workflows/ci-php-general.yaml@v1
12+
13+
call-workflow-ci-php-tests:
14+
name: Tests
15+
uses: BluePsyduck/github-workflows/.github/workflows/ci-php-tests.yaml@v1
16+
with:
17+
php-versions: "8.1 8.0 7.4 7.3 7.2"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.3.3 - 2021-12-03
4+
5+
### Added
6+
7+
- Support for symfony/process 6.x to be used with the process manager.
8+
39
## 1.3.2 - 2020-12-03
410

511
### Added

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"minimum-stability": "stable",
1515
"require": {
1616
"php": "^7.2 || ^8.0",
17-
"symfony/process": "^3.0 || ^4.0 || ^5.0"
17+
"symfony/process": "^3.0 || ^4.0 || ^5.0 || ^6.0"
1818
},
1919
"require-dev": {
2020
"bluepsyduck/test-helper": "^1.0",
21-
"phpstan/phpstan": "^0.12",
22-
"phpstan/phpstan-phpunit": "^0.12",
23-
"phpstan/phpstan-strict-rules": "^0.12",
21+
"phpstan/phpstan": "^1.0",
22+
"phpstan/phpstan-phpunit": "^1.0",
23+
"phpstan/phpstan-strict-rules": "^1.0",
2424
"phpunit/phpunit": "^8.0 || ^9.0",
2525
"rregeer/phpunit-coverage-check": "^0.3",
2626
"squizlabs/php_codesniffer": "^3.3"

src/ProcessManager.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ProcessManager implements ProcessManagerInterface
3535

3636
/**
3737
* The processes currently waiting to be executed.
38-
* @var array<mixed>
38+
* @var array<array{Process<string>, callable|null, array<mixed>}>
3939
*/
4040
protected $pendingProcessData = [];
4141

@@ -198,17 +198,20 @@ protected function executeNextPendingProcess(): void
198198
if ($this->canExecuteNextPendingRequest()) {
199199
$this->sleep($this->processStartDelay);
200200

201-
[$process, $callback, $env] = array_shift($this->pendingProcessData);
202-
/* @var Process $process */
203-
$this->invokeCallback($this->processStartCallback, $process);
204-
$process->start($callback, $env);
205-
206-
$pid = $process->getPid();
207-
if ($pid === null) {
208-
// The process finished before we were able to check its process id.
209-
$this->checkRunningProcess($pid, $process);
210-
} else {
211-
$this->runningProcesses[$pid] = $process;
201+
$data = array_shift($this->pendingProcessData);
202+
if ($data !== null) {
203+
[$process, $callback, $env] = $data;
204+
/* @var Process $process */
205+
$this->invokeCallback($this->processStartCallback, $process);
206+
$process->start($callback, $env);
207+
208+
$pid = $process->getPid();
209+
if ($pid === null) {
210+
// The process finished before we were able to check its process id.
211+
$this->checkRunningProcess($pid, $process);
212+
} else {
213+
$this->runningProcesses[$pid] = $process;
214+
}
212215
}
213216
}
214217
}

0 commit comments

Comments
 (0)