Skip to content

Commit

Permalink
Merge pull request #1 from teufelaudio/task/WEBDEV-9176-migrate-spryk…
Browse files Browse the repository at this point in the history
…er-harness

DRAFT: WEBDEV-9176: Migrate Spryker harness
  • Loading branch information
hgajjar authored Dec 17, 2024
2 parents 032b847 + a4c1bcb commit 67b7c9c
Show file tree
Hide file tree
Showing 63 changed files with 51,055 additions and 241 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
10 changes: 10 additions & 0 deletions _twig/docker-compose.yml/service/buggregator.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
buggregator:
image: {{ @('services.buggregator.image') }}
networks:
- private
- shared
labels:
- traefik.backend={{ @('services.buggregator.host') }}-{{ @('workspace.name') }}
- traefik.frontend.rule=Host:{{ @('services.buggregator.external_host') }}
- traefik.docker.network=my127ws
- traefik.port={{ @('services.buggregator.api_port') }}
8 changes: 2 additions & 6 deletions _twig/docker-compose.yml/service/chrome.yml.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
chrome:
{% if host_architecture() == 'amd64' %}
image: yukinying/chrome-headless-browser:latest
command: ["--no-sandbox", "--disable-gpu", "--headless", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--user-data-dir=/data"]
{% else %}
image: quay.io/inviqa_images/chromium:latest
{% endif %}
image: {{ @('services.chrome.image') }}
command: ["--ignore-certificate-errors", "--no-sandbox", "--disable-gpu", "--headless", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--user-data-dir=/data"]
labels:
# deprecated, a later workspace release will disable by default
- traefik.enable=false
Expand Down
4 changes: 2 additions & 2 deletions _twig/docker-compose.yml/service/console.yml.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set syncvolume = false %}
{% if @('host.os') == 'darwin' and bool(@('mutagen')) %}
{% if @('host.os') == 'darwin' and @('mutagen') == 'yes' %}
{% set syncvolume = true %}
{% endif %}

Expand All @@ -16,11 +16,11 @@
- ./.my127ws/application:/home/build/application
- ./.my127ws/docker/image/console/root/lib/task:/lib/task
- ./.my127ws:/.my127ws
- ./.bash_history:/home/build/.bash_history
{% else %}
image: {{ @('services.console.image') }}
{% endif %}
labels:
# deprecated, a later workspace release will disable by default
- traefik.enable=false
environment: {{ to_nice_yaml(deep_merge([
@('services.php-base.environment'),
Expand Down
13 changes: 9 additions & 4 deletions _twig/docker-compose.yml/service/elasticsearch.yml.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
elasticsearch:
image: {{ @('services.elasticsearch.image') }}
{% if @('app.build') == 'dynamic' %}
build:
context: ./
dockerfile: .my127ws/docker/image/elasticsearch/Dockerfile
{% else %}
image: {{ @('elasticsearch.image') ~':' ~ @('elasticsearch.tag') }}
{% endif %}
labels:
# deprecated, a later workspace release will disable by default
- traefik.enable=false
environment:
ES_JAVA_OPTS: -Xms512m -Xmx512m
discovery.type: single-node
ES_JAVA_OPTS: "-Xmx512m -Xms512m"
discovery.type: "single-node"
networks:
- private
{% if @('app.build') != 'static' and @('docker.port_forward.enabled') %}
Expand Down
12 changes: 3 additions & 9 deletions _twig/docker-compose.yml/service/nginx.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{% set syncvolume = true %}
{% endif %}
{% set hostnames = [@('hostname')] %}
{% set hostnames = hostnames|merge(@('hostname_aliases')|map(alias => "#{alias}." ~ @('domain'))) %}
{% set traefikRules = hostnames|map(hostname => "Host(`" ~ hostname ~ "`)") %}
{% set hostnames = hostnames|merge(@('hostname_aliases')|filter(v => v is not empty)|map(alias => "#{alias}." ~ @('domain'))) %}

nginx:
build: .my127ws/docker/image/nginx
{% if @('app.build') == 'dynamic' %}
Expand All @@ -15,19 +15,13 @@
{% endif %}
labels:
{% if @('services.varnish.enabled') %}
# deprecated, a later workspace release will disable by default
- traefik.enable=false
{% else %}
# Traefik 1, deprecated
- traefik.backend={{ @('workspace.name') }}
- traefik.frontend.rule=Host:{{ hostnames|join(',') }}
- traefik.frontend.redirect.entryPoint=https
- traefik.docker.network=my127ws
- traefik.port=80
# Traefik 2
- traefik.enable=true
# - traefik.docker.network=my127ws
- traefik.http.routers.{{ @('workspace.name') }}-nginx.rule={{ traefikRules | join(' || ') }}
- traefik.http.services.{{ @('workspace.name') }}-nginx.loadbalancer.server.port=80
{% endif %}
environment: {{ to_nice_yaml(deep_merge([
@('services.nginx.environment'),
Expand Down
6 changes: 6 additions & 0 deletions _twig/docker-compose.yml/service/playwright.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
playwright:
image: mcr.microsoft.com/playwright:v1.39.0-jammy
volumes:
- .:/app
networks:
- private
3 changes: 2 additions & 1 deletion _twig/docker-compose.yml/service/postgres.yml.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
postgres:
image: {{ @('services.postgres.image') }}
labels:
# deprecated, a later workspace release will disable by default
- traefik.enable=false
volumes:
- ./.my127ws/docker/image/postgres/root/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
environment: {{ to_nice_yaml(deep_merge([
@('services.postgres.environment'),
@('services.postgres.environment_dynamic'),
Expand Down
12 changes: 6 additions & 6 deletions _twig/docker-compose.yml/service/redis.yml.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% set command = @('services.redis.options')
| filter(v => v is not empty)
| map((value, var) => '--' ~ var ~ ' ' ~ value|join(' --' ~ var ~ ' '))
| reduce((carry, v) => carry|merge([v]), []) %}
redis:
image: {{ @('services.redis.image') }}
command: {{ to_nice_yaml(command, 2, 6) }}
# evict any least recently used key even if they don't have a TTL
command: redis-server --maxmemory {{ @('redis.max_memory') }} --maxmemory-policy allkeys-lru --save 3600 1 --save 300 100 --save 60 10000
labels:
# deprecated, a later workspace release will disable by default
- traefik.enable=false
networks:
- private
{% if @('app.build') != 'static' and @('docker.port_forward.enabled') %}
ports:
- "127.0.0.1:0:6379"
{% endif %}
94 changes: 90 additions & 4 deletions application/skeleton/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,97 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$array of function array_filter expects array, string given\\.$#"
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/Pyz/Yves/ProductSetWidget/Widget/ProductSetIdsWidget.php
path: src/Pyz/Zed/DataImport/Business/Model/NavigationNode/NavigationNodeWriterStep.php

-
message: "#^Parameter \\#2 \\$default of method Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\:\\:get\\(\\) expects bool\\|float\\|int\\|string\\|null, array given\\.$#"
message: "#^Method Pyz\\\\Zed\\\\ExampleStateMachine\\\\ExampleStateMachineDependencyProvider\\:\\:provideBusinessLayerDependencies\\(\\) should return Spryker\\\\Zed\\\\Kernel\\\\Container but return statement is missing\\.$#"
count: 1
path: src/Pyz/Yves/ProductSetWidget/Widget/ProductSetIdsWidget.php
path: src/Pyz/Zed/ExampleStateMachine/ExampleStateMachineDependencyProvider.php

-
message: "#^Method Pyz\\\\Zed\\\\ExampleStateMachine\\\\ExampleStateMachineDependencyProvider\\:\\:provideCommunicationLayerDependencies\\(\\) should return Spryker\\\\Zed\\\\Kernel\\\\Container but return statement is missing\\.$#"
count: 1
path: src/Pyz/Zed/ExampleStateMachine/ExampleStateMachineDependencyProvider.php

-
message: "#^Method Teufel\\\\Client\\\\ProductAssetStorage\\\\Expander\\\\AssetExpander\\\\BundleProductAssetGalleryExpander\\:\\:findContentImageFromAssetsByIdContent\\(\\) should return Generated\\\\Shared\\\\Transfer\\\\ProductAssetViewTransfer but return statement is missing\\.$#"
count: 1
path: src/Teufel/Client/ProductAssetStorage/Expander/AssetExpander/BundleProductAssetGalleryExpander.php

-
message: "#^Method Teufel\\\\Client\\\\ProductAssetStorage\\\\Expander\\\\AssetExpander\\\\SimpleProductAssetGalleryExpander\\:\\:findContentImageFromAssetsByIdContent\\(\\) should return Generated\\\\Shared\\\\Transfer\\\\ProductAssetViewTransfer but return statement is missing\\.$#"
count: 1
path: src/Teufel/Client/ProductAssetStorage/Expander/AssetExpander/SimpleProductAssetGalleryExpander.php

-
message: "#^Anonymous function never returns null so it can be removed from the return typehint\\.$#"
count: 1
path: src/Teufel/Yves/ContentImage/Twig/ContentImageTwigFunction.php

-
message: "#^Anonymous function never returns null so it can be removed from the return typehint\\.$#"
count: 1
path: src/Teufel/Yves/ContentPdf/Twig/ContentPdfTwigFunction.php

-
message: "#^Anonymous function never returns null so it can be removed from the return typehint\\.$#"
count: 1
path: src/Teufel/Yves/ContentVideo/Twig/ContentVideoTwigFunction.php

-
message: "#^Variable \\$bundledProductView in PHPDoc tag @var does not match any variable in the foreach loop\\: \\$magazineReviewView$#"
count: 1
path: src/Teufel/Yves/MagazineReview/Plugin/MagazineReviewRendererPlugin.php

-
message: "#^PHPDoc tag @var for variable \\$pyzSlotContentBlock contains unknown class Orm\\\\Zed\\\\CmsBlock\\\\Persistence\\\\PyzSlotContentBlock\\.$#"
count: 1
path: src/Teufel/Zed/Cms/Business/Version/Mapper/VersionDataMapper.php

-
message: "#^Method Teufel\\\\Zed\\\\ContentManagementStorage\\\\ContentManagementStorageDependencyProvider\\:\\:provideBusinessLayerDependencies\\(\\) should return Spryker\\\\Zed\\\\Kernel\\\\Container but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/ContentManagementStorage/ContentManagementStorageDependencyProvider.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/Teufel/Zed/ErpDataExport/Business/Exporter/XmlExporter.php

-
message: "#^Method Teufel\\\\Zed\\\\Newsletter\\\\Communication\\\\Console\\\\RegisterConsole\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/Newsletter/Communication/Console/RegisterConsole.php

-
message: "#^Method Teufel\\\\Zed\\\\PayInStore\\\\Communication\\\\Plugin\\\\Oms\\\\Command\\\\ExportCommand\\:\\:run\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/PayInStore/Communication/Plugin/Oms/Command/ExportCommand.php

-
message: "#^Method Teufel\\\\Zed\\\\PayInStore\\\\Communication\\\\Plugin\\\\Oms\\\\Command\\\\PrepareForCashRegisterCommand\\:\\:run\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/PayInStore/Communication/Plugin/Oms/Command/PrepareForCashRegisterCommand.php

-
message: "#^Method Teufel\\\\Zed\\\\ProcessBuilder\\\\Plugin\\\\ProcessConfigurationPlugin\\:\\:getProcessName\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/ProcessBuilder/Plugin/ProcessConfigurationPlugin.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/Teufel/Zed/ProcessBuilder/Plugin/ProcessConfigurationPlugin.php

-
message: "#^Method Teufel\\\\Zed\\\\SaferpayPayment\\\\Communication\\\\Plugin\\\\Oms\\\\Commands\\\\AssertPaymentCommand\\:\\:run\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/SaferpayPayment/Communication/Plugin/Oms/Commands/AssertPaymentCommand.php

-
message: "#^Method Teufel\\\\Zed\\\\SaferpayPayment\\\\Communication\\\\Plugin\\\\Oms\\\\Commands\\\\CapturePaymentCommand\\:\\:run\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: src/Teufel/Zed/SaferpayPayment/Communication/Plugin/Oms/Commands/CapturePaymentCommand.php

77 changes: 70 additions & 7 deletions application/skeleton/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,23 +1,86 @@
includes:
- phpstan-baseline.neon
- vendor/spryker-sdk/phpstan-spryker/extension.neon
- %currentWorkingDirectory%/phpstan-baseline.neon
- %currentWorkingDirectory%/vendor/jangregor/phpstan-prophecy/extension.neon

parameters:
level: 6
paths:
- %currentWorkingDirectory%/src/Teufel
- %currentWorkingDirectory%/config/Shared
fileExtensions:
- php
parallel:
processTimeout: 1000.0
jobSize: 250
maximumNumberOfProcesses: 100
minimumNumberOfJobsPerProcess: 2
phpVersion: 80100 # PHP 8.1
excludePaths:
analyse:
- %rootDir%/../../../src/Generated/*
- %rootDir%/../../../src/Orm/*
- %rootDir%/../../../src/Pyz/Zed/DataImport/Business/*
- %currentWorkingDirectory%/src/Teufel/Shared/ErpDataExport/Models/*
- %currentWorkingDirectory%/src/Teufel/Zed/DataExport/Business/CmsBlockXml/CmsBlockXmlExporter.php
- %currentWorkingDirectory%/src/Teufel/*/*Repository.php
- %currentWorkingDirectory%/src/Teufel/*/*QueryContainer.php
- %currentWorkingDirectory%/src/Generated/*
- %currentWorkingDirectory%/src/Orm/*
- %currentWorkingDirectory%/src/Pyz/*
- %currentWorkingDirectory%/src/Teufel/Client/Catalog/Plugin/Elasticsearch/Query/ProductCatalogSearchQueryPlugin.php

bootstrapFiles:
- %rootDir%/../../../phpstan-bootstrap.php
- %currentWorkingDirectory%/phpstan-bootstrap.php

ignoreErrors:
- '#Call to an undefined method Propel\\Runtime\\Collection\\Collection::delete\(\)#'
- '#Call to an undefined method .+Criteria::.+\(\).#'
- '#Parameter .* of class .* expects .*, PHPUnit\\Framework\\MockObject\\MockObject given.*#'
- '#Method .* should return .* but returns PHPUnit\\Framework\\MockObject\\MockObject.*#'
- '#Property Pyz\\Tests\\Integration\\.* does not accept Spryker\\Zed\\Kernel\\Business\\AbstractFacade.#'
- '#Call to an undefined method Generated\\Zed\\Ide\\AutoCompletion|Spryker\\Shared\\Kernel\\LocatorLocatorInterface::.*#'
- '#Function oci_.+ not found.#'
- '#Constant OCI_.+ not found.#'
- '#Declaration of Teufel\\Zed\\.*::.* should be compatible with Spryker\\Zed\\.*\Base\.*#'
- '#Method Teufel\\.*::.* should return array<.*> but returns array<int,.*>#'
- '#Method Teufel\\.*Factory::.*Client\(\) should return .*Interface but returns mixed#'
- '#Method Teufel\\.*Factory::get.* should return .*Interface but returns mixed#'
- '#Method Teufel\\.*Factory::get.* should return .*> but returns mixed#'
- '#Method Teufel\\.*Config::get.* should return .* but returns mixed#'
- '#Parameter .* Teufel\\.* constructor expects array.*, mixed given.#'
- '#Parameter .* \$callback of function .* expects callable\(mixed\): mixed, Closure.* given.#'
- '#Parameter .* \$separator of function explode expects non-empty-string, string given.#'
- '#Cannot cast mixed to *#'
- '#PHPDoc tag.* with type array.* is not subtype of native type ArrayObject#'
- '#ArrayObject.* does not accept array.#'
- '#ArrayObject.* does not accept .*Transfer.#'
- '#Method Teufel.*QueryPlugin\(\) should return .*QueryInterface but returns Teufel.*QueryPlugin.#'
- '#Method .*getTwigEnvironment\(\) should return Twig\\Environment but returns mixed.#'
- '#Method Teufel\\.*Factory::getStore\(\) should return Spryker\\Shared\\Kernel\\Store but returns mixed.#'

#see ADR 0017_salutation_type
-
message: "#^Method Teufel\\\\Zed\\\\Customer\\\\Communication\\\\CustomerCommunicationFactory\\:\\:createCustomerFormDataProvider\\(\\) should return Spryker\\\\Zed\\\\Customer\\\\Communication\\\\Form\\\\DataProvider\\\\CustomerFormDataProvider but returns Teufel\\\\Zed\\\\Customer\\\\Communication\\\\Form\\\\DataProvider\\\\CustomerFormDataProvider\\.$#"
count: 1
path: src/Teufel/Zed/Customer/Communication/CustomerCommunicationFactory.php
-
message: "#^Method Teufel\\\\Zed\\\\Customer\\\\Communication\\\\CustomerCommunicationFactory\\:\\:createCustomerUpdateFormDataProvider\\(\\) should return Spryker\\\\Zed\\\\Customer\\\\Communication\\\\Form\\\\DataProvider\\\\CustomerUpdateFormDataProvider but returns Teufel\\\\Zed\\\\Customer\\\\Communication\\\\Form\\\\DataProvider\\\\CustomerUpdateFormDataProvider\\.$#"
count: 1
path: src/Teufel/Zed/Customer/Communication/CustomerCommunicationFactory.php
-
message: "#^Method Teufel\\\\Service\\\\UtilDateTime\\\\UtilDateTimeService\\:\\:formatDateByLocale\\(\\) has parameter \\$date with no type specified#"
count: 1
path: src/Teufel/Service/UtilDateTime/UtilDateTimeService.php
-
message: "#^Method Teufel\\\\Service\\\\Emarsys\\\\Client\\\\FakeEmarsysClient\\:\\:addToStack\\(\\) has parameter \\$item with no type specified#"
count: 1
path: src/Teufel/Service/Emarsys/Client/FakeEmarsysClient.php
-
message: '#Variable \$config might not be defined.#'
path: %currentWorkingDirectory%/config/Shared/config_propel.php

reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

dynamicConstantNames:
- APPLICATION
- APPLICATION_ENV
- APPLICATION_STORE
- APPLICATION_CODE_BUCKET
1 change: 0 additions & 1 deletion docker-compose.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% if @('host.os') == 'darwin' and bool(@('mutagen')) %}
{% set syncvolume = true %}
{% endif %}
version: '{{ @('docker.compose.file_version') }}'
services:
{% for serviceName, service in @('services') %}
{% if service['enabled'] %}
Expand Down
28 changes: 2 additions & 26 deletions docker/image/console/Dockerfile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@ STOPSIGNAL SIGTERM

COPY .my127ws/docker/image/console/root /
RUN chown -R build:build /home/build /app \
# installing tools in the image is deprecated
&& ([ -e /sbin/tini ] || curl --fail --silent --show-error --location --output /sbin/tini "https://github.com/krallin/tini/releases/download/v0.19.0/tini-$(dpkg --print-architecture)") \
&& chmod +x /sbin/tini \
&& mkdir -p /tmp/php-file-cache \
&& chown -R build:build /tmp/php-file-cache
{%- if @('php.composer.major_version') != '1' %} \
&& composer self-update --{{ @('php.composer.major_version') }} \
&& rm -f /root/.composer/*.phar
{%- endif %}
&& pecl install xhprof
{%- set install_extensions=@('php.install_extensions')|merge(@('php.cli.install_extensions'))|filter(v => v is not empty) %}
{%- if install_extensions %} \
&& cd /root/installer \
RUN cd /root/installer \
&& ./enable.sh \
{{ install_extensions|join(" \\\n ") }}
{% endif %}
Expand All @@ -40,18 +32,6 @@ ENV APP_MODE={{ @('app.mode') }} \

USER build

{% if @('node.version') is not null %}
RUN . /home/build/.nvm/nvm.sh \
&& nvm install {{ @('node.version') }} \
&& nvm use {{ @('node.version') }} \
&& nvm alias default {{ @('node.version') }} \
&& npm install -g yarn
{% endif %}

{% if @('php.composer.major_version') != '1' %}
RUN composer --no-plugins global remove hirak/prestissimo
{% endif %}

{% if @('app.build') == 'static' %}
COPY --chown=build:build .my127ws/application /home/build/application
COPY --chown=build:build ./ /app
Expand All @@ -63,10 +43,6 @@ VOLUME /home/build/application

USER root

{% if version_compare(@('php.ext-xdebug.version'), '3', '>=') and version_compare(@('php.version'), '7', '>=') and version_compare(@('php.version'), '8', '<') %}
RUN pecl -q upgrade xdebug
{% endif %}

RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["sleep", "infinity"]
Loading

0 comments on commit 67b7c9c

Please sign in to comment.