Skip to content

Commit a5d7dac

Browse files
committed
Updated github actions
1 parent afc63a4 commit a5d7dac

File tree

6 files changed

+52
-13
lines changed

6 files changed

+52
-13
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Override for the ES port to use for the docker container
2-
ELASTICSEARCH_PORT=9201
2+
ELASTICSEARCH_PORT=9205
33

44
# Override for the ES version to use for the docker container
55
#ELASTICSEARCH_VERSION=8.8.0

.github/workflows/phpunit-tests.yml

+19-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ concurrency:
77
on: ['push', 'pull_request', 'workflow_dispatch']
88

99
env:
10-
ELASTICSEARCH_PORT: 9201
10+
ELASTICSEARCH_PORT: 9205
1111

1212
jobs:
1313
static_code_analysis:
@@ -26,7 +26,7 @@ jobs:
2626
run: composer validate
2727

2828
- name: 'Install dependencies with Composer'
29-
uses: 'ramsey/composer-install@v2'
29+
uses: ramsey/composer-install@v3
3030
with:
3131
dependency-versions: 'highest'
3232
composer-options: '--prefer-dist'
@@ -105,7 +105,7 @@ jobs:
105105
run: composer require --no-update symfony/framework-bundle:${{ matrix.symfony }}
106106

107107
- name: 'Install dependencies with Composer'
108-
uses: 'ramsey/composer-install@v2'
108+
uses: ramsey/composer-install@v3
109109
with:
110110
dependency-versions: '${{ matrix.dependencies }}'
111111
composer-options: '--prefer-dist'
@@ -123,13 +123,25 @@ jobs:
123123
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml
124124
125125
- name: Upload coverage results to Coveralls
126-
env:
127-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
128-
run: |
129-
vendor/bin/php-coveralls --coverage_clover=tests/App/build/clover.xml --json_path=tests/App/build/coveralls.json -v
126+
uses: coverallsapp/github-action@v2
127+
with:
128+
github-token: ${{ secrets.GITHUB_TOKEN }}
129+
file: tests/App/build/clover.xml
130+
parallel: true
130131

131132
# Enable tmate debugging on failure for 15 minutes
132133
- name: Setup tmate session
133134
if: ${{ !env.ACT && failure() }}
134135
uses: mxschmitt/action-tmate@v3
135136
timeout-minutes: 15
137+
138+
finalize:
139+
needs: [phpunit]
140+
runs-on: ubuntu-20.04
141+
steps:
142+
- name: Finalize Coveralls Parallel Build
143+
uses: coverallsapp/github-action@v2
144+
with:
145+
github-token: ${{ secrets.GITHUB_TOKEN }}
146+
parallel-finished: true
147+

composer.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"knplabs/knp-paginator-bundle": "^4.0 || ^5.0",
3939
"friendsofphp/php-cs-fixer": "^3.34",
4040
"php-coveralls/php-coveralls": "^2.1",
41-
"escapestudios/symfony2-coding-standard": "^3.0",
4241
"jchook/phpunit-assert-throws": "^1.0",
4342
"dms/phpunit-arraysubset-asserts": "^0.2.1",
4443
"phpstan/phpstan": "^1.12",
@@ -64,5 +63,20 @@
6463
},
6564
"config": {
6665
"prepend-autoloader": false
66+
},
67+
"scripts": {
68+
"run-tests": [
69+
"XDEBUG_MODE=coverage vendor/bin/simple-phpunit --coverage-text"
70+
],
71+
"check-code": [
72+
"vendor/bin/phpstan",
73+
"vendor/bin/rector --dry-run",
74+
"vendor/bin/php-cs-fixer check"
75+
],
76+
"fix-code": [
77+
"vendor/bin/phpstan",
78+
"vendor/bin/rector",
79+
"vendor/bin/php-cs-fixer fix"
80+
]
6781
}
6882
}

phpstan-baseline.neon

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^PHPDoc tag @throws with type Elasticsearch\\\\Common\\\\Exceptions\\\\ElasticsearchException is not subtype of Throwable$#"
5+
count: 1
6+
path: src/Manager/IndexManager.php
7+
8+
-
9+
message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#"
10+
count: 1
11+
path: src/Manager/IndexManager.php

phpstan.dist.neon

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
includes:
2+
- phpstan-baseline.neon
23
- vendor/phpstan/phpstan-symfony/extension.neon
34
- vendor/phpstan/phpstan-symfony/rules.neon
45
# - vendor/phpstan/phpstan-phpunit/extension.neon

src/Manager/IndexManager.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ public function dropIndex(): void
351351
*/
352352
public function rebuildIndex(bool $deleteOld = false, bool $cancelExistingRebuild = false): void
353353
{
354+
$newIndex = null;
354355
try {
355356
if (false === $this->getUseAliases()) {
356357
throw new Exception(\sprintf('Index rebuilding is not supported for "%s", unless you use aliases', $this->getBaseIndexName()));
@@ -386,19 +387,19 @@ public function rebuildIndex(bool $deleteOld = false, bool $cancelExistingRebuil
386387
// Delete the old index
387388
if ($deleteOld) {
388389
$this->getConnection()->getClient()->indices()->delete(['index' => $oldIndex]);
389-
$this->getConnection()->getLogger()->notice(\sprintf('Deleted old index %s', $oldIndex));
390+
$this->getConnection()->getLogger()?->notice(\sprintf('Deleted old index %s', $oldIndex));
390391
}
391392
} catch (\Exception $e) {
392393
// Do not log BulkRequestException here as they are logged in the connection manager
393394
// Do not log ElasticsearchException either, as they are logged inside the elasticsearch bundle
394395
if (!($e instanceof BulkRequestException) && !($e instanceof ElasticsearchException)) {
395-
$this->getConnection()->getLogger()->error($e->getMessage());
396+
$this->getConnection()->getLogger()?->error($e->getMessage());
396397
}
397398

398399
// Try to delete the new incomplete index
399-
if (isset($newIndex)) {
400+
if (null !== $newIndex) {
400401
$this->getConnection()->getClient()->indices()->delete(['index' => $newIndex]);
401-
$this->getConnection()->getLogger()->notice(\sprintf('Deleted incomplete index "%s"', $newIndex));
402+
$this->getConnection()->getLogger()?->notice(\sprintf('Deleted incomplete index "%s"', $newIndex));
402403
}
403404

404405
// Rethrow exception to be further handled

0 commit comments

Comments
 (0)