Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update some actions version #184

Merged
merged 5 commits into from Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
114 changes: 57 additions & 57 deletions .github/workflows/ci.yml
Expand Up @@ -2,30 +2,30 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
schedule:
- cron: '0 0 * * MON'
- cron: "0 0 * * MON"

jobs:
check-cs:
name: Check Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php --diff --dry-run
args: --config=.php-cs-fixer.php --diff --dry-run

phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand All @@ -35,9 +35,9 @@ jobs:
- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
REQUIRE_DEV: true
REQUIRE_DEV: true
with:
args: analyse
args: analyse

tests_es:
name: Test PHP ${{ matrix.php-version }} & Symfony ${{ matrix.symfony-version }} ${{ matrix.composer-flags }} & Elasticsearch ${{ matrix.es-version }}
Expand All @@ -49,33 +49,33 @@ jobs:
matrix:
include:
# Every lowest supported version
- php-version: '8.0'
symfony-version: '5.4.*'
composer-flags: '--prefer-lowest'
es-version: '7.17.3'
- php-version: "8.0"
symfony-version: "5.4.*"
composer-flags: "--prefer-lowest"
es-version: "7.17.3"
# Every lowest supported version && Symfony 6
- php-version: '8.1'
symfony-version: '6.2.*'
composer-flags: ''
es-version: '7.17.3'
- php-version: "8.1"
symfony-version: "6.2.*"
composer-flags: ""
es-version: "7.17.3"
# PHP 8.1, latest SF 6, ES 7
- php-version: '8.1'
symfony-version: '6.*'
composer-flags: ''
es-version: '7.17.3'
- php-version: "8.1"
symfony-version: "6.*"
composer-flags: ""
es-version: "7.17.3"
# PHP 8.2, latest SF 6, ES 8
- php-version: '8.2'
symfony-version: '6.*'
composer-flags: ''
es-version: '8.2.0'
- php-version: "8.2"
symfony-version: "6.*"
composer-flags: ""
es-version: "8.2.0"
# PHP 8.3, latest SF 7, ES 8
- php-version: '8.3'
symfony-version: '7.*'
composer-flags: ''
es-version: '8.2.0'
- php-version: "8.3"
symfony-version: "7.*"
composer-flags: ""
es-version: "8.2.0"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand All @@ -94,24 +94,24 @@ jobs:

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144

- name: Runs Elasticsearch ${{ matrix.es-version }}
uses: elastic/elastic-github-actions/elasticsearch@master
with:
security-enabled: false
stack-version: ${{ matrix.es-version }}
port: 9999
security-enabled: false
stack-version: ${{ matrix.es-version }}
port: 9999

- name: Wait for ES to be ready
run: |
while ! curl -s -X GET http://127.0.0.1:9999/_cluster/health\?wait_for_status\=green\&timeout\=60s | grep -q '"status":"green"'
do
echo "==> Waiting for cluster green status" && sleep 1
done
while ! curl -s -X GET http://127.0.0.1:9999/_cluster/health\?wait_for_status\=green\&timeout\=60s | grep -q '"status":"green"'
do
echo "==> Waiting for cluster green status" && sleep 1
done

- name: Run Tests
run: make test
Expand All @@ -125,19 +125,19 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '8.3'
symfony-version: '6.*'
composer-flags: ''
- php-version: "8.3"
symfony-version: "6.*"
composer-flags: ""
os-version: 1.3.6
os-image: opensearchproject/opensearch:1.3.6
- php-version: '8.3'
symfony-version: '6.*'
composer-flags: ''
- php-version: "8.3"
symfony-version: "6.*"
composer-flags: ""
os-version: 2.3.0
os-image: opensearchproject/opensearch:2.3.0
- php-version: '8.3'
symfony-version: '7.*'
composer-flags: ''
- php-version: "8.3"
symfony-version: "7.*"
composer-flags: ""
os-version: 2.3.0
os-image: opensearchproject/opensearch:2.3.0
services:
Expand All @@ -151,7 +151,7 @@ jobs:
http.port: 9999
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand All @@ -170,17 +170,17 @@ jobs:

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144

- name: Wait for OpenSearch to be ready
run: |
while ! curl -s -X GET http://127.0.0.1:9999/_cluster/health\?wait_for_status\=green\&timeout\=60s | grep -q '"status":"green"'
do
echo "==> Waiting for cluster green status" && sleep 1
done
while ! curl -s -X GET http://127.0.0.1:9999/_cluster/health\?wait_for_status\=green\&timeout\=60s | grep -q '"status":"green"'
do
echo "==> Waiting for cluster green status" && sleep 1
done

- name: Run Tests
run: make test
5 changes: 4 additions & 1 deletion composer.json
Expand Up @@ -51,6 +51,9 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true
}
}
}
20 changes: 5 additions & 15 deletions phpstan-baseline.neon
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1
path: src/Bridge/Symfony/DependencyInjection/Configuration.php

-
message: "#^Method JoliCode\\\\Elastically\\\\Index\\:\\:getClient\\(\\) should return JoliCode\\\\Elastically\\\\Client but returns Elastica\\\\Client\\.$#"
count: 1
Expand All @@ -9,18 +14,3 @@ parameters:
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ResponseEvent\\:\\:isMasterRequest\\(\\)\\.$#"
count: 1
path: src/Messenger/IndexationRequestSpoolSubscriber.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1
path: src/Bridge/Symfony/DependencyInjection/Configuration.php

- # We need https://github.com/ruflin/Elastica/pull/2176
message: "#^Method JoliCode\\\\Elastically\\\\IndexBuilder\\:\\:slowDownRefresh\\(\\) has Elastica\\\\Exception\\\\ExceptionInterface in PHPDoc @throws tag but it's not thrown\\.$#"
count: 1
path: src/IndexBuilder.php

- # We need https://github.com/ruflin/Elastica/pull/2176
message: "#^Method JoliCode\\\\Elastically\\\\IndexBuilder\\:\\:speedUpRefresh\\(\\) has Elastica\\\\Exception\\\\ExceptionInterface in PHPDoc @throws tag but it's not thrown\\.$#"
count: 1
path: src/IndexBuilder.php
2 changes: 1 addition & 1 deletion src/Client.php
Expand Up @@ -31,7 +31,7 @@ class Client extends ElasticaClient
private ResultSetBuilder $resultSetBuilder;
private IndexNameMapper $indexNameMapper;

public function __construct($config = [], callable $callback = null, LoggerInterface $logger = null, ResultSetBuilder $resultSetBuilder = null, IndexNameMapper $indexNameMapper = null)
public function __construct($config = [], ?callable $callback = null, ?LoggerInterface $logger = null, ?ResultSetBuilder $resultSetBuilder = null, ?IndexNameMapper $indexNameMapper = null)
{
parent::__construct($config, $callback, $logger);

Expand Down
2 changes: 1 addition & 1 deletion src/Index.php
Expand Up @@ -39,7 +39,7 @@ public function getModel($id)
return $this->resultSetBuilder->buildModelFromDocument($document);
}

public function createSearch($query = '', $options = null, BuilderInterface $builder = null): Search
public function createSearch($query = '', $options = null, ?BuilderInterface $builder = null): Search
{
return parent::createSearch($query, $options, $builder ?? $this->resultSetBuilder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Indexer.php
Expand Up @@ -30,7 +30,7 @@ class Indexer

private ?Bulk $currentBulk = null;

public function __construct(Client $client, SerializerInterface $serializer, int $bulkMaxSize = 100, array $bulkRequestParams = [], ContextBuilderInterface $contextBuilder = null)
public function __construct(Client $client, SerializerInterface $serializer, int $bulkMaxSize = 100, array $bulkRequestParams = [], ?ContextBuilderInterface $contextBuilder = null)
{
// TODO: on the destruct, maybe throw an exception for non empty indexer queues?

Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/YamlProvider.php
Expand Up @@ -20,7 +20,7 @@ final class YamlProvider implements MappingProviderInterface
private string $configurationDirectory;
private Parser $parser;

public function __construct(string $configurationDirectory, Parser $parser = null)
public function __construct(string $configurationDirectory, ?Parser $parser = null)
{
$this->configurationDirectory = $configurationDirectory;
$this->parser = $parser ?? new Parser();
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Document.php
Expand Up @@ -18,14 +18,14 @@ class Document extends ElasticaDocument
{
private ?object $model;

public function __construct(?string $id, object $model = null, array|string $data = [], Index|string $index = '')
public function __construct(?string $id, ?object $model = null, array|string $data = [], Index|string $index = '')
{
parent::__construct($id, $data, $index);

$this->model = $model;
}

public static function createFromDocument(ElasticaDocument $document, object $model = null): self
public static function createFromDocument(ElasticaDocument $document, ?object $model = null): self
{
return new self($document->getId(), $model, $document->getData(), $document->getIndex());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Transport/HttpClientTransport.php
Expand Up @@ -44,7 +44,7 @@ class HttpClientTransport extends AbstractTransport
*/
private string $scheme;

public function __construct(HttpClientInterface $client, string $scheme = 'http', Connection $connection = null)
public function __construct(HttpClientInterface $client, string $scheme = 'http', ?Connection $connection = null)
{
parent::__construct($connection);

Expand Down
4 changes: 2 additions & 2 deletions tests/BaseTestCase.php
Expand Up @@ -24,7 +24,7 @@ protected function setUp(): void
$this->getFactory()->buildClient()->request('*', 'DELETE');
}

protected function getFactory(string $path = null, array $config = []): Factory
protected function getFactory(?string $path = null, array $config = []): Factory
{
return new Factory($config + [
Factory::CONFIG_MAPPINGS_DIRECTORY => $path ?? __DIR__ . '/configs',
Expand All @@ -33,7 +33,7 @@ protected function getFactory(string $path = null, array $config = []): Factory
]);
}

protected function getClient(string $path = null, array $config = []): Client
protected function getClient(?string $path = null, array $config = []): Client
{
return $this->getFactory($path, $config)->buildClient();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/IndexBuilderTest.php
Expand Up @@ -281,7 +281,7 @@ public function testMigrate(): void
$this->assertInstanceOf(ElasticaDocument::class, $document);
}

private function getIndexBuilder(string $path = null, array $config = []): IndexBuilder
private function getIndexBuilder(?string $path = null, array $config = []): IndexBuilder
{
return $this->getFactory($path, $config)->buildIndexBuilder();
}
Expand Down