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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use extension verifier #315

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 16 additions & 16 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"image": "ghcr.io/shopwarelabs/devcontainer/symfony-flex:6.6.8-8.3",
"workspaceFolder": "/var/www/html",
"overrideCommand": false,
"updateRemoteUserUID": false,
"forwardPorts": [8000],
"portsAttributes": {
"8000": {
"label": "Shopware",
"onAutoForward": "notify"
},
"8080": {
"label": "Administration Watcher",
"onAutoForward": "notify"
}
},
"onCreateCommand": "install-activate-plugin"
"image": "ghcr.io/shopwarelabs/devcontainer/symfony-flex:6.6.8-8.3",
"workspaceFolder": "/var/www/html",
"overrideCommand": false,
"updateRemoteUserUID": false,
"forwardPorts": [8000],
"portsAttributes": {
"8000": {
"label": "Shopware",
"onAutoForward": "notify"
},
"8080": {
"label": "Administration Watcher",
"onAutoForward": "notify"
}
},
"onCreateCommand": "install-activate-plugin"
}
33 changes: 26 additions & 7 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,29 @@ on:

jobs:
cs:
if: github.event_name != 'schedule'
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
phpstan:
uses: shopware/github-actions/.github/workflows/phpstan.yml@main
with:
extensionName: FroshTools
shopwareVersion: v6.6.0.0-rc1
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Pull verifier
run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest

- name: Run CS
run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run

check:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
version-selection: [ 'lowest', 'highest']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Pull verifier
run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest

- name: Run Check
run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }}
86 changes: 43 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{
"name": "frosh/tools",
"version": "2.6.0",
"description": "Provides some basic things for managing the Shopware Installation",
"type": "shopware-platform-plugin",
"license": "MIT",
"autoload": {
"psr-4": {
"Frosh\\Tools\\": "src/"
}
},
"authors": [
{
"name": "FriendsOfShopware",
"homepage": "https://friendsofshopware.com"
}
],
"extra": {
"shopware-plugin-class": "Frosh\\Tools\\FroshTools",
"label": {
"de-DE": "Tools",
"en-GB": "Tools"
},
"description": {
"de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.",
"en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status."
},
"manufacturerLink": {
"de-DE": "https://github.com/FriendsOfShopware/FroshTools",
"en-GB": "https://github.com/FriendsOfShopware/FroshTools"
},
"supportLink": {
"de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues",
"en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues"
}
"name": "frosh/tools",
"version": "2.6.0",
"description": "Provides some basic things for managing the Shopware Installation",
"type": "shopware-platform-plugin",
"license": "MIT",
"autoload": {
"psr-4": {
"Frosh\\Tools\\": "src/"
}
},
"authors": [
{
"name": "FriendsOfShopware",
"homepage": "https://friendsofshopware.com"
}
],
"extra": {
"shopware-plugin-class": "Frosh\\Tools\\FroshTools",
"label": {
"de-DE": "Tools",
"en-GB": "Tools"
},
"require": {
"shopware/core": "~6.6.0"
"description": {
"de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.",
"en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status."
},
"config": {
"allow-plugins": {
"symfony/runtime": true
}
"manufacturerLink": {
"de-DE": "https://github.com/FriendsOfShopware/FroshTools",
"en-GB": "https://github.com/FriendsOfShopware/FroshTools"
},
"scripts": {
"cs-fix": "docker run --rm -v $(pwd):$(pwd) -w $(pwd) oskarstark/php-cs-fixer-ga [email protected],no_unused_imports .",
"phpstan": "docker run --rm -v $(pwd):/app aragon999/phpstan-shopware:v6.6.0 analyse --level max ."
"supportLink": {
"de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues",
"en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues"
}
},
"require": {
"shopware/core": "~6.6.0"
},
"config": {
"allow-plugins": {
"symfony/runtime": true
}
},
"scripts": {
"format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext",
"check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext"
}
}
4 changes: 0 additions & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ parameters:
level: 8
paths:
- src
type_coverage:
return_type: 100
param_type: 98
property_type: 100
12 changes: 0 additions & 12 deletions qodana.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Command/EnvGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$var = $file->get($variable);

if (!$var instanceof EnvironmentKeyValue) {
throw new \RuntimeException(sprintf('Cannot find variable with name: %s', $variable));
throw new \RuntimeException(\sprintf('Cannot find variable with name: %s', $variable));
}

if ($mode === 'json') {
Expand Down
4 changes: 3 additions & 1 deletion src/Command/EnvListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand('frosh:env:list')]
class EnvListCommand extends EnvGetCommand {}
class EnvListCommand extends EnvGetCommand
{
}
12 changes: 6 additions & 6 deletions src/Components/CacheAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface
{
if ($adapter instanceof CacheDecorator) {
// Do not declare function as static
$func = \Closure::bind(fn() => $adapter->decorated, $adapter, $adapter::class);
$func = \Closure::bind(fn () => $adapter->decorated, $adapter, $adapter::class);

return $this->getCacheAdapter($func());
}

if ($adapter instanceof TagAwareAdapter || $adapter instanceof TraceableAdapter) {
// Do not declare function as static
$func = \Closure::bind(fn() => $adapter->pool, $adapter, $adapter::class);
$func = \Closure::bind(fn () => $adapter->pool, $adapter, $adapter::class);

return $this->getCacheAdapter($func());
}
Expand All @@ -132,25 +132,25 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface
private function getRedis(AdapterInterface $adapter): \Redis
{
if ($adapter instanceof RedisTagAwareAdapter) {
$redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisTagAwareAdapter::class);
$redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisTagAwareAdapter::class);
} else {
// @phpstan-ignore-next-line
$redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisAdapter::class);
$redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisAdapter::class);
}

return $redisProxyGetter();
}

private function getPathFromFilesystemAdapter(FilesystemAdapter $adapter): string
{
$getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class);
$getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class);

return $getter();
}

private function getPathOfFilesAdapter(PhpFilesAdapter $adapter): string
{
$getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class);
$getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class);

return $getter();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/CacheHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function removeDir(string $path): void
$blankDir = sys_get_temp_dir() . '/' . uniqid() . '/';

if (!mkdir($blankDir, 0o755, true) && !is_dir($blankDir)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $blankDir));
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $blankDir));
}

$process = new Process(['rsync', '-qa', '--delete', $blankDir, $path . '/']);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/CacheRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function all(): array
public function get(string $name): CacheAdapter
{
if (!isset($this->adapters[$name])) {
throw new \OutOfBoundsException(sprintf('Cannot find adapter by name %s', $name));
throw new \OutOfBoundsException(\sprintf('Cannot find adapter by name %s', $name));
}

return $this->adapters[$name];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
public function __construct(
#[Autowire(param: 'frosh_tools.elasticsearch.enabled')]
private bool $elasticsearchEnabled,
) {}
) {
}

public function __invoke(ResponseEvent $event): void
{
if ($event->getRequest()->attributes->get('_route') !== 'api.info.config') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

class DisabledElasticsearchManager extends ElasticsearchManager
{
public function __construct() {}
public function __construct()
{
}

public function isEnabled(): bool
{
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Elasticsearch/ElasticsearchManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function __construct(
private readonly Connection $connection,
#[Autowire(service: 'shopware.increment.gateway.registry')]
private readonly IncrementGatewayRegistry $gatewayRegistry,
) {}
) {
}

public function isEnabled(): bool
{
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Environment/EnvironmentFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class EnvironmentFile implements \Stringable
/**
* @param list<EnvironmentLine> $items
*/
public function __construct(private array $items) {}
public function __construct(private array $items)
{
}

public function __toString(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Environment/EnvironmentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function read(string $path): EnvironmentFile
{
$content = file_get_contents($path);
if ($content === false) {
throw new \RuntimeException(sprintf('Cannot read file %s', $path));
throw new \RuntimeException(\sprintf('Cannot read file %s', $path));
}

/** @var array<string> $lines */
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Health/Checker/HealthChecker/DebugChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function __construct(
private readonly array $kernelBundles,
#[Autowire(param: 'kernel.debug')]
private readonly bool $kernelDebug,
) {}
) {
}

public function collect(HealthCollection $collection): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag('frosh_tools.health_checker')]
interface HealthCheckerInterface {}
interface HealthCheckerInterface
{
}
6 changes: 4 additions & 2 deletions src/Components/Health/Checker/HealthChecker/MysqlChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

class MysqlChecker implements HealthCheckerInterface, CheckerInterface
{
public function __construct(private readonly Connection $connection) {}
public function __construct(private readonly Connection $connection)
{
}

public function collect(HealthCollection $collection): void
{
Expand Down Expand Up @@ -117,7 +119,7 @@ private static function getVersionNumber(string $versionString): string
$versionString,
$versionParts,
)) {
throw new \RuntimeException(sprintf('Invalid version string: %s', $versionString));
throw new \RuntimeException(\sprintf('Invalid version string: %s', $versionString));
}

return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch'];
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Health/Checker/HealthChecker/PhpChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function checkPcreJitActive(HealthCollection $collection): void

private function parseQuantity(string $val): float
{
//TODO: remove condition and own calculation when min php version is 8.2
// TODO: remove condition and own calculation when min php version is 8.2
if (\function_exists('ini_parse_quantity')) {
return (float) \ini_parse_quantity($val);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class ProductionChecker implements HealthCheckerInterface, CheckerInterface
public function __construct(
#[Autowire(param: 'kernel.environment')]
private readonly string $environment,
) {}
) {
}

public function collect(HealthCollection $collection): void
{
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Health/Checker/HealthChecker/QueueChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class QueueChecker implements HealthCheckerInterface, CheckerInterface
public function __construct(
private readonly Connection $connection,
private readonly SystemConfigService $configService,
) {}
) {
}

public function collect(HealthCollection $collection): void
{
Expand Down
Loading
Loading