Skip to content

Commit

Permalink
Merge branch 'release/7.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
susannemoog committed Apr 17, 2021
2 parents 3337835 + 3a79ee7 commit 75c97d4
Show file tree
Hide file tree
Showing 49 changed files with 3,851 additions and 1,983 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on: [push]

jobs:
ci:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Show PHP version
run: php -v

- name: Show composer version
run: composer --version

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install
run: |
composer install --no-progress --no-suggest --no-interaction
env:
COMPOSER_AUTH: '{
"http-basic": {
"repo.packagist.com": {
"username": "token",
"password": "${{ secrets.PACKAGIST_AUTH_TOKEN }}"
}
},
"github-oauth": {
"github.com": "${{ secrets.ACTIONS_TOKEN }}"
}
}'

- name: CGL
run: |
composer t3g:cgl
env:
COMPOSER_PROCESS_TIMEOUT: 1200

- name: Unit Tests
run: |
php -dpcov.enabled=1 -dpcov.directory="Classes/" ./bin/phpunit -c build/phpunit.xml --log-junit var/log/junit/phpunit-src.xml --coverage-clover var/log/junit/coverage-src.xml
env:
COMPOSER_PROCESS_TIMEOUT: 1200

- name: Upload coverage results to Coveralls
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require twinh/php-coveralls --no-progress --no-suggest --no-interaction
/home/runner/.composer/vendor/bin/php-coveralls -c build/.coveralls.yml -vvv --json_path=var/log/coveralls-upload.json
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Releases

on: push

jobs:
build:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: intl, zip, zlib
ini-values: memory_limit=1G, phar.readonly=0

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install
run: |
composer install --no-progress --no-suggest --no-interaction
env:
COMPOSER_AUTH: '{
"http-basic": {
"repo.packagist.com": {
"username": "token",
"password": "${{ secrets.PACKAGIST_AUTH_TOKEN }}"
}
},
"github-oauth": {
"github.com": "${{ secrets.ACTIONS_TOKEN }}"
}
}'

- name: Box
run: |
echo "${{ secrets.PHAR_SIGNING_KEY }}" >> phar.pem
composer global config minimum-stability dev
composer global require humbug/box
box validate || exit 1
box compile || exit 1
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
elasticorn.phar
elasticorn.phar.pubkey
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ composer.phar
/.env
/bin/
/phar-private.pem.passphrase-protected
/phar-private.pem
/phar.pem
/phar-private-nopassphrase.pem
/elasticorn.phar.pubkey
/elasticorn.phar
Expand All @@ -20,3 +20,7 @@ composer.phar
/elasticorn-old.phar
/elasticorn-old.phar.pubkey
/.TestClient/
.php_cs.cache
build/.phpunit.result.cache
Tests/Fixtures/Configuration/mysuperindex/
var/
8 changes: 0 additions & 8 deletions Build/behat.yml

This file was deleted.

20 changes: 0 additions & 20 deletions Build/phpunit.xml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ CHANGELOG
Features and Bugfixes per version
---------------------------------

### 7.0.0

- Compatibility with PHP 8.0
- Compatibility with Elasticsearch 7.x
- Upgrade Symfony Dependencies 3.x >> 5.x
- [!!!] Removed document types - take care of adjusting your config, elasticsearch now requests one index per type
- [!!!] Removed compatibility to PHP < 7.4

### 5.3.1
- Make ES connection in behat tests configurable via env variables
- Update README, fix test instructions
Expand Down
13 changes: 10 additions & 3 deletions Classes/Bootstrap/DependencyInjectionContainer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);

/*
* This file is part of the package t3g/elasticorn.
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\Elasticorn\Bootstrap;

use Elastica\Client;
Expand All @@ -13,7 +21,6 @@

class DependencyInjectionContainer
{

public function init()
{
$container = new ContainerBuilder();
Expand Down Expand Up @@ -72,4 +79,4 @@ private function getElasticaConfiguration()
'password' => getenv('ELASTICA_PASSWORD'),
]);
}
}
}
12 changes: 9 additions & 3 deletions Classes/Commands/BaseCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package t3g/elasticorn.
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\Elasticorn\Commands;

use Psr\Log\LogLevel;
Expand All @@ -14,7 +21,6 @@

class BaseCommand extends Command
{

/**
* @var IndexService
*/
Expand All @@ -35,7 +41,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
global $container;
$verbosityLevelMap = [
LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,
LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,
];
$container->setParameter('logger.output', $output);
$container->setParameter('logger.verbosityMap', $verbosityLevelMap);
Expand Down Expand Up @@ -82,4 +88,4 @@ private function askForConfigDir(InputInterface $input, OutputInterface $output)
$answer = $helper->ask($input, $output, $question);
putenv('configurationPath=' . $answer);
}
}
}
34 changes: 22 additions & 12 deletions Classes/Commands/Index/CornifyCommand.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<?php
declare(strict_types = 1);
namespace T3G\Elasticorn\Commands\Index;

declare(strict_types=1);

/*
* This file is part of the package t3g/elasticorn.
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\Elasticorn\Commands\Index;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -10,17 +17,14 @@
use T3G\Elasticorn\Commands\BaseCommand;

/**
* Class CornifyCommand
* Class CornifyCommand.
*
* Converts an existing index with mapping configuration and data to an elasticorn index
*
* @package T3G\Elasticorn\Commands\Index
*/
class CornifyCommand extends BaseCommand
{

/**
* Configure the cornify command
* Configure the cornify command.
*
* @return void
*/
Expand All @@ -35,9 +39,10 @@ protected function configure()
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*
* @return int|void|null
*/
public function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -48,7 +53,7 @@ public function execute(InputInterface $input, OutputInterface $output)
try {
$continue = $this->compareConfiguration($input, $output, $helper, $indexName);
} catch (\InvalidArgumentException $e) {
if ($e->getCode() === 666) {
if (666 === $e->getCode()) {
$continue = $this->createConfiguration($input, $output, $helper, $indexName);
}
}
Expand All @@ -62,27 +67,31 @@ public function execute(InputInterface $input, OutputInterface $output)
}

/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param $helper
* @param $indexName
*
* @return bool
*/
private function createConfiguration(InputInterface $input, OutputInterface $output, $helper, $indexName)
{
$question = new ConfirmationQuestion('Configuration does not exist. Shall I create it? [Y/n]', true);
if (!$helper->ask($input, $output, $question)) {
$output->writeln('Cannot continue without configuration.');

return false;
}
$this->configurationService->createConfigurationFromExistingIndex($indexName, $this->indexService->getIndex());

return true;
}

/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param $helper
*
* @return bool
*/
private function compareConfiguration(InputInterface $input, OutputInterface $output, $helper, $indexName)
Expand All @@ -91,6 +100,7 @@ private function compareConfiguration(InputInterface $input, OutputInterface $ou
$question = new ConfirmationQuestion('Continue? [Y/n]', true);
if (!$helper->ask($input, $output, $question)) {
$output->writeln('User aborted.');

return false;
} else {
return true;
Expand Down
Loading

0 comments on commit 75c97d4

Please sign in to comment.