forked from pmishev/ElasticsearchBundle
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github actions workflow and code style fixes
- Loading branch information
Showing
48 changed files
with
569 additions
and
424 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Override for the ES port to use for the docker container | ||
ELASTICSEARCH_PORT=9201 | ||
|
||
# Override for the ES version to use for the docker container | ||
#ELASTICSEARCH_VERSION=8.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: tests | ||
|
||
concurrency: | ||
group: phpunit-tests-${{ github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
on: ['push', 'pull_request', 'workflow_dispatch'] | ||
|
||
env: | ||
ELASTICSEARCH_PORT: 9201 | ||
|
||
jobs: | ||
static_code_analysis: | ||
runs-on: 'ubuntu-20.04' | ||
name: 'Static code analysis' | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Validate composer.json and composer.lock' | ||
run: composer validate | ||
|
||
- name: 'Install dependencies with Composer' | ||
uses: 'ramsey/composer-install@v2' | ||
with: | ||
dependency-versions: 'highest' | ||
composer-options: '--prefer-dist' | ||
|
||
- name: Check PHP coding standards | ||
run: php vendor/bin/php-cs-fixer fix --verbose --dry-run | ||
|
||
phpunit: | ||
needs: [ static_code_analysis ] | ||
runs-on: 'ubuntu-20.04' | ||
name: 'PHPUnit (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ES ${{ matrix.elasticsearch }})' | ||
timeout-minutes: 30 | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
matrix: | ||
experimental: | ||
- false | ||
dependencies: | ||
- 'highest' | ||
php: | ||
- '8.1' | ||
- '8.2' | ||
elasticsearch: | ||
- '7.17.13' | ||
symfony: | ||
- '~5.0' | ||
include: | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.0.1' | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.1.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.1.html#breaking-changes-8.1 | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~5.0' | ||
elasticsearch: '8.8.0' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html | ||
experimental: false | ||
- php: '8.1' | ||
symfony: '~6.0' | ||
elasticsearch: '8.10.2' # newest version | ||
experimental: false | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '${{ matrix.php }}' | ||
coverage: 'pcov' | ||
tools: 'composer:v2' | ||
extensions: 'curl, json, mbstring, openssl' | ||
ini-values: 'memory_limit=256M' | ||
|
||
- name: 'Fix symfony/framework-bundle version' | ||
run: composer require --no-update symfony/framework-bundle:${{ matrix.symfony }} | ||
|
||
- name: 'Install dependencies with Composer' | ||
uses: 'ramsey/composer-install@v2' | ||
with: | ||
dependency-versions: '${{ matrix.dependencies }}' | ||
composer-options: '--prefer-dist' | ||
|
||
- name: 'Dump composer autoloader' | ||
run: composer dump-autoload --classmap-authoritative --no-ansi --no-interaction --no-scripts | ||
|
||
- name: 'Setup Elasticsearch' | ||
env: | ||
ELASTICSEARCH_VERSION: ${{ matrix.elasticsearch }} | ||
run: docker compose up --detach --wait ; curl -XGET 'http://localhost:'"$ELASTICSEARCH_PORT" | ||
|
||
- name: 'Run phpunit tests' | ||
run: | | ||
vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml 2>/dev/null | ||
- name: Upload coverage results to Coveralls | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | ||
run: | | ||
vendor/bin/php-coveralls --coverage_clover=tests/App/build/clover.xml --json_path=tests/App/build/coveralls.json -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
services: | ||
elasticsearch: | ||
image: "docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.17.13}" | ||
container_name: sfes_elasticsearch | ||
environment: | ||
- discovery.type=single-node | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms${ELASTICSEARCH_JAVA_MEM:-2048m} -Xmx${ELASTICSEARCH_JAVA_MEM:-2048m}" | ||
- cluster.name=sfes | ||
- node.name=sfes1 | ||
- xpack.security.enabled=false | ||
- indices.id_field_data.enabled=true # TODO: temporary requirement for ES8 until tests are fixed to not do sorting/aggregations on _id (https://github.com/elastic/elasticsearch/issues/43599) | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
volumes: | ||
- elasticsearch-data:/usr/share/elasticsearch/data | ||
ports: | ||
- "${ELASTICSEARCH_PORT:-9200}:9200" | ||
networks: | ||
- elastic | ||
healthcheck: | ||
test: curl -s http://sfes_elasticsearch:$${ELASTICSEARCH_PORT:-9200} > /dev/null || exit 1 | ||
interval: 1s | ||
timeout: 5s | ||
retries: 120 | ||
|
||
volumes: | ||
elasticsearch-data: | ||
|
||
networks: | ||
elastic: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Annotation used for the meta _id field | ||
* | ||
* @Annotation | ||
* | ||
* @Target("PROPERTY") | ||
*/ | ||
final class Id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.