Skip to content

Commit

Permalink
Merge pull request #95 from kununu/KUNENABLE-161
Browse files Browse the repository at this point in the history
KUNENABLE-161 Add support for Symfony 6.4 to kununu/elasticsearch-bundle
  • Loading branch information
hugo-goncalves-kununu committed Apr 11, 2024
2 parents 6330239 + 8744d88 commit 87b8f2e
Show file tree
Hide file tree
Showing 75 changed files with 1,057 additions and 955 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ updates:
# Disable automatic rebasing to prevent overloading our CICD system
rebase-strategy: "disabled"
versioning-strategy: auto
# By default Dependabot has a limit of the number of open PR for version updates
# By default, Dependabot has a limit of the number of open PR for version updates
# and security updates.
# See other defaults in here: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
131 changes: 67 additions & 64 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,84 @@
name: Continuous Integration

on:
push:
branches:
- master
- 6.0
- 5.0
- 4.0
- 3.0
- 2.5
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches:
- master
- '6.0'
- '5.0'
- '4.0'
- '3.0'
- '2.5'

pull_request:
types: [ opened, synchronize, reopened ]

env:
fail-fast: true
fail-fast: true

jobs:
build:
name: PHPUnit
runs-on: ubuntu-20.04
strategy:
matrix:
php-version:
- 8.0
dependencies:
- lowest
- highest
build:
name: PHPUnit
runs-on: ubuntu-22.04
strategy:
matrix:
php-version:
- 8.1
- 8.2
- 8.3
dependencies:
- lowest
- highest

steps:
- name: Checkout
uses: actions/checkout@v2
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: ${{ matrix.extensions }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: ${{ matrix.extensions }}

- name: Install Composer Dependencies
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-stable"
- name: Install Composer Dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-stable"

- name: Run PHPUnit
run: vendor/bin/phpunit
- name: Run PHPUnit
run: vendor/bin/phpunit

- name: Upload coverage files
uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}-${{ matrix.php-version }}-coverage
path: tests/.results/
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.php-version }}-${{ matrix.dependencies }}-coverage
path: tests/.results/

sonarcloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
sonarcloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- uses: actions/download-artifact@v2
with:
name: build-8-coverage
path: tests/.results/
- uses: actions/download-artifact@v4
with:
name: build-8.1-highest-coverage
path: tests/.results/

- name: Fix Code Coverage Paths
working-directory: tests/.results/
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-clover.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-junit.xml
- name: Fix Code Coverage Paths
working-directory: tests/.results/
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-clover.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-junit.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ deploy.prop
log/
.env
.env.test
.phpunit.result.cache
.phpunit.cache
.phpunit.result
tests/.results
composer.lock
.php-cs-fixer.cache
phpunit.log
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ to [Semantic Versioning](http://semver.org/).

### Deprecated

## [7.0.0](https://github.com/kununu/elasticsearch/compare/v7.0.0...v6.0.1)

### Backward Compatibility Breaks

* Drop support for PHP 8.0 - PHP 8.1 is now the minimum version.

### Bugfixes

### Added

### Improvements

* Upgraded PHPUnit to version 10.5
* Refactor some code to take advantage of PHP 8.1 features (read-only properties)
* Fix tests that used deprecated/removed features on PHPUnit 10.5
* Refactor tests to be more PHPUnit 10.5 compliant (e.g. using attributes for data providers, make all data providers static, etc.)
* Updated versions of continuous integration components

### Deprecated

## [6.0.1](https://github.com/kununu/elasticsearch/compare/v6.0.1...v6.0.0)

### Backward Compatibility Breaks
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

Contributions are more than **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/kununu/elasticsearch).
We accept contributions via Pull Requests on [GitHub](https://github.com/kununu/elasticsearch).

## Pull Requests

- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
- **[kununu Coding Standards](https://github.com/kununu/kununu-scripts)** - The kununu coding standards are an extension of the [PSR-12](https://www.php-fig.org/psr/psr-12/). Check out [kununu Coding Standards](https://github.com/kununu/kununu-scripts) for more details. In development mode the package [kununu-scripts](https://github.com/kununu/kununu-scripts) is already a dependency that expose commands that you can use to meet our standards.

- **Add tests!** - to ensure a high quality code base, your code patch can't be accepted if it doesn't have tests.
- **Add tests!** - to ensure a high quality code base, your code patch can't be accepted if it does not have tests.

- **Document any change in behaviour** - Make sure the [CHANGELOG.md](CHANGELOG.md), [README.md](README.md) and any other relevant documentation are kept up-to-date.

Expand Down
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# kununu/elasticsearch

## Purpose

This package aims to
1. reduce cognitive load when interacting with Elasticsearch by providing an intuitive query language with a fluent interface while staying very close to Elasticsearch terminology
2. make your project independent of the underlying client library

## Quickstart
It does not take a lot to get you up and running with Elasticsearch. All that's required is a `Repository` which can be used to execute requests (e.g. to save a document, query for documents, etc.)

```php
<?php
declare(strict_types=1);

use Elasticsearch\ClientBuilder;
use Kununu\Elasticsearch\Query\Criteria\Filter;
use Kununu\Elasticsearch\Query\Criteria\Search;
use Kununu\Elasticsearch\Query\Query;
use Kununu\Elasticsearch\Repository\Repository;

// create very minimal client
$client = \Elasticsearch\ClientBuilder::create()->build();
$client = ClientBuilder::create()->build();

// create a new repository and bind it to my_index/my_type
$repository = new Repository(
Expand Down Expand Up @@ -43,16 +54,17 @@ $repository->delete('the_document_id');
```

## Technical Concept

The key features of this package are:
- Repositories
- Queries
- IndexManager

### Repositories

Very similar
to [Entity Repositories in Doctrine](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/working-with-objects.html)
, a `Repository` in this package is a class which capsules Elasticsearch specific logic - for a specific index.
Very similar to [Entity Repositories in Doctrine](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/working-with-objects.html), a `Repository` in this package is a class which encapsulates
Elasticsearch specific logic - for a specific index.

Repositories execute queries against the index (and type) they are bound to.

[More explanation and examples](doc/REPOSITORY.md)
Expand All @@ -73,7 +85,7 @@ This package contains two implementations of the `QueryInterface`:

### IndexManager

This package provides easy access to a a few commonly used Elasticsearch index management features like creating indices
This package provides easy access to a few commonly used Elasticsearch index management features like creating indices
and managing aliases.

[More explanation and examples](doc/INDEX_MANAGER.md)
Expand All @@ -90,6 +102,7 @@ library. Any other version may or may not work.
| 4.x | 7.x | 7.9 | \>=8.0 |
| 5.x | 7.x | 7.9 | \>=8.0 |
| 6.x | 7.x | 7.9 | \>=8.0 |
| 7.x | 7.x | 7.9 | \>=8.1 |

See also https://github.com/elastic/elasticsearch-php#version-matrix

Expand Down
18 changes: 11 additions & 7 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# Security Policy

## For external contributors

## Reporting a Vulnerability
If you want to report any security vulnerabilities please do so by creating an [issue](https://github.com/kununu/elasticsearch/issues).
Additionally, if you have a fix then please create a pull request and link it to the issue you have created.

Jira is our entrypoint to report security vulnerabilities. Having this mind a KUNSECU user story (type Vulnerability) needs to be created.
## For kununu developers

### How to fill the user story?
### Reporting a Vulnerability

Follow this [documentation](https://confluence.xing.hh/pages/viewpage.action?pageId=381133070).
Jira is our entrypoint to report security vulnerabilities. Having this mind a KUNSECU user story (type Vulnerability) needs to be created.

#### How to fill the user story?

### To which team do I assign the user story?
Follow this [documentation](https://new-work.atlassian.net/wiki/spaces/kununu/pages/47846323/Vulnerability+Issue+Type+Jira).

Follow the [component ownership matrix](https://confluence.xing.hh/display/kununu/Component+ownership+and+support) and assign it to the corresponding team.
#### To which team do I assign the user story?

Follow the [domain ownership matrix](https://new-work.atlassian.net/wiki/spaces/kununu/pages/113148000/Domain+ownership+matrix) and assign it to the corresponding team.

## Reporting the update of dependencies

This is the benefit of having Dependabot. It will open pull requests for security and version updates. For more information check the Github [documentation](https://docs.github.com/en/github/administering-a-repository/managing-pull-requests-for-dependency-updates).
This is the benefit of having Dependabot. It will open pull requests for security and version updates. For more information check the GitHub [documentation](https://docs.github.com/en/github/administering-a-repository/managing-pull-requests-for-dependency-updates).
17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"license": "proprietary",
"minimum-stability": "stable",
"require": {
"php": ">=8.0",
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-mbstring": "*",
"elasticsearch/elasticsearch": "^7.0.0",
"psr/log": "~1.0"
"elasticsearch/elasticsearch": "^7.0",
"psr/log": "^1.0|^2.0|^3.0"
},
"require-dev": {
"kununu/scripts": ">=4.0",
"phpunit/phpunit": "^9.6"
"kununu/scripts": ">=5.0",
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
Expand All @@ -28,8 +28,8 @@
}
},
"scripts": {
"test": "phpunit --no-coverage tests",
"test-coverage": "XDEBUG_MODE=coverage phpunit --coverage-clover tests/.results/coverage.xml --coverage-html tests/.results/html/ tests"
"test": "phpunit --log-events-text phpunit.log --no-coverage --no-logging --no-progress --testsuite Full",
"test-coverage": "XDEBUG_MODE=coverage phpunit --log-events-text phpunit.log --no-progress --testsuite Full"
},
"scripts-descriptions": {
"test": "Run all tests",
Expand All @@ -39,9 +39,6 @@
"allow-plugins": {
"kununu/scripts": true
},
"preferred-install": {
"*": "dist"
},
"sort-packages": true
}
}
18 changes: 10 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/9.6/ -->
<!-- https://phpunit.readthedocs.io/en/10.5/ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd" bootstrap="vendor/autoload.php"
colors="true" beStrictAboutChangesToGlobalState="true" testdox="true">
<coverage includeUncoveredFiles="true">
<include>
<directory>src</directory>
</include>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php"
colors="true" beStrictAboutChangesToGlobalState="true" cacheDirectory=".phpunit.cache" testdox="true">
<coverage>
<report>
<clover outputFile="tests/.results/tests-clover.xml"/>
<html outputDirectory="tests/.results/html/"/>
Expand All @@ -17,11 +14,16 @@
<ini name="display_errors" value="true"/>
</php>
<testsuites>
<testsuite name="Elasticsearch Test Suite">
<testsuite name="Full">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="tests/.results/tests-junit.xml"/>
</logging>
<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit 87b8f2e

Please sign in to comment.