Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 74 additions & 38 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,33 @@ on:
pull_request:
branches: [ main ]

env:
PACKAGE_FOLDER: Shel.Neos.Terminal

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions:
- '8.2'
neosVersion:
- '8.3'
- '9.0'

services:
mariadb:
# see https://mariadb.com/kb/en/mariadb-server-release-dates/
# this should be a current release, e.g. the LTS version
image: mariadb:10.8
env:
MYSQL_USER: neos
MYSQL_PASSWORD: neos
MYSQL_DATABASE: neos_functional_testing
MYSQL_ROOT_PASSWORD: neos
ports:
- "3306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

name: 'Terminal with Neos ${{ matrix.neosVersion }} test'

Expand All @@ -23,40 +42,57 @@ jobs:
FLOW_FOLDER: ../neos-base-distribution

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.neosVersion }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.neosVersion }}-

- name: Prepare Flow distribution
run: |
git clone https://github.com/neos/neos-base-distribution.git -b ${NEOS_TARGET_VERSION} ${FLOW_FOLDER}
cd ${FLOW_FOLDER}
composer require --no-update --no-interaction shel/neos-terminal

- name: Install distribution
run: |
cd ${FLOW_FOLDER}
composer config --no-plugins allow-plugins.neos/composer-plugin true
composer install --no-interaction --no-progress
rm -rf Packages/Plugins/Shel.Neos.Terminal
cp -r ../Shel.Neos.Terminal Packages/Plugins/Shel.Neos.Terminal

- name: Run Functional tests
run: |
cd ${FLOW_FOLDER}
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Plugins/Shel.Neos.Terminal/Tests/Functional/*
- uses: actions/checkout@v3

- name: Set package branch name
run: echo "PACKAGE_TARGET_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
working-directory: .

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql
tools: composer:v2

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Prepare Flow distribution
run: |
git clone https://github.com/neos/neos-base-distribution.git -b ${NEOS_TARGET_VERSION} ${FLOW_FOLDER}
cd ${FLOW_FOLDER}

git -C ../${{ env.PACKAGE_FOLDER }} checkout -b build
composer config repositories.package '{ "type": "path", "url": "../${{ env.PACKAGE_FOLDER }}", "options": { "symlink": false } }'
composer require --no-update --no-interaction shel/neos-terminal:"dev-build as dev-${PACKAGE_TARGET_VERSION}"
composer require --no-update --no-interaction neos/contentgraph-doctrinedbaladapter:"~9.0.0"

- name: Composer Install
run: |
cd ${FLOW_FOLDER}
composer update --no-interaction --no-progress

- name: Setup Flow configuration
run: |
cd ${FLOW_FOLDER}
rm -f Configuration/Testing/Settings.yaml
cat <<EOF >> Configuration/Testing/Settings.yaml
Neos:
Flow:
persistence:
backendOptions:
host: '127.0.0.1'
driver: pdo_mysql
user: 'neos'
password: 'neos'
dbname: 'neos_functional_testing'
EOF

- name: Run Functional tests
run: |
cd ${FLOW_FOLDER}
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Plugins/Shel.Neos.Terminal/Tests/Functional/*
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

823 changes: 0 additions & 823 deletions .yarn/releases/yarn-3.3.1.cjs

This file was deleted.

942 changes: 942 additions & 0 deletions .yarn/releases/yarn-4.9.2.cjs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
compressionLevel: mixed

enableGlobalCache: true

nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.3.1.cjs

pnpMode: loose

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-4.9.2.cjs
7 changes: 2 additions & 5 deletions Classes/Command/EvaluateEelExpressionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@

class EvaluateEelExpressionCommand implements TerminalCommandInterface
{
/**
* @Flow\Inject
* @var EelEvaluationService
*/
protected $eelEvaluationService;
#[Flow\Inject]
protected EelEvaluationService $eelEvaluationService;

public static function getCommandName(): string
{
Expand Down
49 changes: 32 additions & 17 deletions Classes/Command/FlushCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cache\CacheManager;
use Neos\Flow\I18n\Exception\IndexOutOfBoundsException;
use Neos\Flow\I18n\Exception\InvalidFormatPlaceholderException;
use Neos\Flow\I18n\Translator;
use Shel\Neos\Terminal\Domain\CommandContext;
use Shel\Neos\Terminal\Domain\CommandInvocationResult;
Expand All @@ -26,17 +28,11 @@
class FlushCacheCommand implements TerminalCommandInterface
{

/**
* @Flow\Inject
* @var CacheManager
*/
protected $cacheManager;
#[Flow\Inject]
protected CacheManager $cacheManager;

/**
* @Flow\Inject
* @var Translator
*/
protected $translator;
#[Flow\Inject]
protected Translator $translator;

public static function getCommandName(): string
{
Expand Down Expand Up @@ -77,16 +73,19 @@ public function invokeCommand(string $argument, CommandContext $commandContext):
if ($cacheIdentifier) {
if ($this->cacheManager->hasCache($cacheIdentifier)) {
$this->cacheManager->getCache($cacheIdentifier)->flush();
$result = $this->translator->translateById('command.flushCache.flushedOne',
['cacheIdentifier' => $cacheIdentifier], null, null, 'Main', 'Shel.Neos.Terminal');
$result = $this->translateById(
'command.flushCache.flushedOne',
['cacheIdentifier' => $cacheIdentifier]
);
} else {
$success = false;
$result = $this->translator->translateById('command.flushCache.cacheDoesNotExist',
['cacheIdentifier' => $cacheIdentifier], null, null, 'Main', 'Shel.Neos.Terminal');
$result = $this->translateById(
'command.flushCache.cacheDoesNotExist',
['cacheIdentifier' => $cacheIdentifier]
);
}
} else {
$result = $this->translator->translateById('command.flushCache.flushedAll', [], null, null, 'Main',
'Shel.Neos.Terminal');
$result = $this->translateById('command.flushCache.flushedAll');
$this->cacheManager->flushCaches();
}

Expand All @@ -97,7 +96,23 @@ public function invokeCommand(string $argument, CommandContext $commandContext):
echo json_encode([
'success' => $success,
'result' => $result,
]);
], JSON_THROW_ON_ERROR);
exit;
}

protected function translateById(string $identifier, array $arguments = []): ?string
{
try {
return $this->translator->translateById(
$identifier,
$arguments, null,
null,
'Main',
'Shel.Neos.Terminal'
);
} catch (\Exception) {
// Noop
}
return $identifier;
}
}
Loading