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

adjust test matrix #20

Merged
merged 5 commits into from
Nov 14, 2024
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
25 changes: 14 additions & 11 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.4.0 ]
include:
- pimcore: ~11.0.0
template_tag: v11.0.0
- pimcore: ~11.4.0
template_tag: 2024.3
steps:
- uses: actions/checkout@v2
- uses: nanasess/setup-chromedriver@v2
- uses: actions/checkout@v4
with:
path: lib/test-bundle

Expand Down Expand Up @@ -98,20 +99,22 @@ jobs:

- name: Setup Chromium
run: |
nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 &
export DISPLAY=:99
chromedriver --url-base=/wd/hub --port=9515 &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &

- name: Start Webserver and Chrome
- name: Start Symfony Server
run: |
curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=$HOME/.symfony/bin
~/.symfony/bin/symfony server:start --port=8080 --dir=public --allow-http --no-tls --daemon

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer Downloads
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -136,7 +139,7 @@ jobs:
vendor/bin/codecept run --env github -c ${{ github.workspace }}/lib/test-bundle

- name: Log Output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Logs (PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Symfony ${{ matrix.symfony }})"
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.4.0 ]
include:
- pimcore: ~11.0.0
template_tag: v11.0.0
- pimcore: ~11.4.0
template_tag: 2024.3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: lib/test-bundle

Expand Down Expand Up @@ -88,10 +88,10 @@ jobs:
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer Downloads
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -114,4 +114,4 @@ jobs:
continue-on-error: true
run: |
bin/console cache:warmup --env=test
vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src/JobsBundle --config ${{ github.workspace }}/lib/test-bundle/ecs.php
vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src/ --config ${{ github.workspace }}/lib/test-bundle/ecs.php
20 changes: 12 additions & 8 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.4.0 ]
include:
- pimcore: ~11.0.0
template_tag: v11.0.0
- pimcore: ~11.4.0
template_tag: 2024.3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: lib/test-bundle

Expand Down Expand Up @@ -88,10 +88,10 @@ jobs:
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer Downloads
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -110,6 +110,10 @@ jobs:
run: |
bin/console assets:install public --relative --symlink

- name: Validate Container
run: |
bin/console lint:container

- name: Php Stan
run: |
bin/console cache:warmup --env=test
Expand Down
3 changes: 3 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Upgrade Notes

## 3.0.1
- [BUGFIX] Fix connector env setup [#19](https://github.com/dachcom-digital/pimcore-jobs/issues/19)

## Migrating from Version 2.x to Version 3.0.0

### Global Changes
Expand Down
7 changes: 0 additions & 7 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ pimcore:
map:
jobConnectorContext: JobsBundle\CoreExtension\JobConnectorContext

doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
entity_managers:
default:
auto_mapping: true

doctrine_migrations:
migrations_paths:
'JobsBundle\Migrations': '@JobsBundle/src/Migrations'
28 changes: 28 additions & 0 deletions src/DependencyInjection/Compiler/ConnectorEnvironmentPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace JobsBundle\DependencyInjection\Compiler;

use JobsBundle\Service\EnvironmentService;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

final class ConnectorEnvironmentPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
$feedHost = $container->getParameter('jobs.feed_host');
$dataClass = $container->getParameter('jobs.data_class');

if (empty($feedHost)) {
$pimcoreConfig = $container->getParameter('pimcore.config');
$feedHost = $pimcoreConfig['general']['domain'];
if (!str_contains($feedHost, 'http')) {
$feedHost = sprintf('https://%s', $feedHost);
}
}

$connectorServiceDefinition = $container->getDefinition(EnvironmentService::class);
$connectorServiceDefinition->setArgument('$dataClass', $dataClass);
$connectorServiceDefinition->setArgument('$feedHost', $feedHost);
}
}
19 changes: 2 additions & 17 deletions src/DependencyInjection/JobsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace JobsBundle\DependencyInjection;

use JobsBundle\Service\EnvironmentService;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -41,26 +40,12 @@ public function load(array $configs, ContainerBuilder $container): void

$container->setParameter('jobs.connectors.available', $availableConnectorsNames);
$container->setParameter('jobs.logs.expiration_days', $config['log_expiration_days']);
$container->setParameter('jobs.feed_host', is_string($config['feed_host']) ? $config['feed_host'] : '');
$container->setParameter('jobs.data_class', is_string($config['data_class']) ? $config['data_class'] : '');

$this->setupEnvironment($container, $config);
$this->checkGoogleConnectorDependencies($container, $loader, $availableConnectorsNames);
}

protected function setupEnvironment(ContainerBuilder $container, array $config): void
{
$feedHost = is_string($config['feed_host']) ? $config['feed_host'] : '';
$dataClass = is_string($config['data_class']) ? $config['data_class'] : '';

if (empty($feedHost)) {
$pimcoreConfig = $container->getParameter('pimcore.config');
$feedHost = $pimcoreConfig['general']['domain'];
}

$connectorServiceDefinition = $container->getDefinition(EnvironmentService::class);
$connectorServiceDefinition->setArgument('$dataClass', $dataClass);
$connectorServiceDefinition->setArgument('$feedHost', $feedHost);
}

/**
* @throws \Exception
*/
Expand Down
2 changes: 2 additions & 0 deletions src/JobsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use JobsBundle\DependencyInjection\Compiler\ConnectorDefinitionPass;
use JobsBundle\DependencyInjection\Compiler\ConnectorEnvironmentPass;
use JobsBundle\DependencyInjection\Compiler\ContextItemsResolverPass;
use JobsBundle\Tool\Install;
use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
Expand All @@ -25,6 +26,7 @@ public function build(ContainerBuilder $container): void
{
$this->configureDoctrineExtension($container);

$container->addCompilerPass(new ConnectorEnvironmentPass());
$container->addCompilerPass(new ConnectorDefinitionPass());
$container->addCompilerPass(new ContextItemsResolverPass());
}
Expand Down
5 changes: 3 additions & 2 deletions tests/_envs/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ modules:
port: 9515
restart: true
wait: 1
window_size: 1280x1024
capabilities:
chromeOptions:
args: ['--no-sandbox', '--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1024,768']
'goog:chromeOptions':
args: ['--no-sandbox', '--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1280,1024']
prefs:
download.default_directory: '%TEST_BUNDLE_TEST_DIR%/_data/downloads'
2 changes: 1 addition & 1 deletion tests/_envs/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ modules:
wait: 1
capabilities:
chromeOptions:
args: ['--no-sandbox', '--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1024,768']
args: ['--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1280,1024']
4 changes: 4 additions & 0 deletions tests/_etc/config/app/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ services:
- [setContainer, ['@service_container']]

doctrine:
orm:
entity_managers:
default:
connection: default
dbal:
connections:
default:
Expand Down
Loading