Skip to content

Commit

Permalink
Merge branch 'main' into ECP-8715
Browse files Browse the repository at this point in the history
  • Loading branch information
candemiralp authored Dec 3, 2024
2 parents e323e44 + 96b34fb commit 67e74e0
Show file tree
Hide file tree
Showing 41 changed files with 2,626 additions and 87 deletions.
58 changes: 58 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-apache
LABEL maintainer="Adyen <[email protected]>"

ENV MAGENTO_HOST="<will be defined>" \
DB_SERVER="<will be defined>" \
DB_PORT=3306 \
DB_NAME=magento \
DB_USER=magento \
DB_PASSWORD=magento \
DB_PREFIX=m2_ \
OPENSEARCH_SERVER="<will be defined>" \
OPENSEARCH_PORT=9200 \
OPENSEARCH_INDEX_PREFIX=magento2 \
OPENSEARCH_TIMEOUT=15 \
ADMIN_NAME=admin \
ADMIN_LASTNAME=admin \
[email protected] \
ADMIN_USERNAME=admin \
ADMIN_PASSWORD=admin123 \
ADMIN_URLEXT=admin \
MAGENTO_LANGUAGE=en_US \
MAGENTO_CURRENCY=EUR \
MAGENTO_TZ=Europe/Amsterdam \
DEPLOY_SAMPLEDATA=0 \
USE_SSL=1

RUN apt-get update \
&& apt-get install -y libjpeg62-turbo-dev \
libpng-dev \
libfreetype6-dev \
libxml2-dev \
libzip-dev \
libssl-dev \
libxslt-dev \
default-mysql-client \
ssl-cert \
wget \
cron \
unzip

RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) bcmath gd intl pdo_mysql simplexml soap sockets xsl zip
RUN a2enmod ssl
RUN a2ensite default-ssl.conf #can be removed if not needed
WORKDIR /var/www/html
COPY config/php.ini /usr/local/etc/php/
COPY scripts/install_magento.sh /tmp/install_magento.sh

RUN if [ -x "$(command -v apache2-foreground)" ]; then a2enmod rewrite; fi

ARG MAGENTO_VERSION
ADD "https://github.com/magento/magento2/archive/refs/tags/${MAGENTO_VERSION}.tar.gz" /tmp/magento.tar.gz
ADD "https://github.com/magento/magento2-sample-data/archive/refs/tags/${MAGENTO_VERSION}.tar.gz" /tmp/sample-data.tar.gz

RUN chmod +x /tmp/install_magento.sh

CMD ["bash", "/tmp/install_magento.sh"]
64 changes: 64 additions & 0 deletions .github/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Install N98-Magerun
n98-magerun2.phar:
wget -q https://files.magerun.net/n98-magerun2.phar
chmod +x ./n98-magerun2.phar

# Check Magento installation
sys-check: n98-magerun2.phar
./n98-magerun2.phar sys:check

# Install Magento (without starting Apache)
magento:
sed '/exec /d' /tmp/install_magento.sh | bash

# Plugin install
install:
composer config --json repositories.local '{"type": "path", "url": "/data/extensions/workdir", "options": { "symlink": false } }'
composer require "adyen/adyen-magento2-expresscheckout:*"
vendor/bin/phpcs --standard=Magento2 --extensions=php,phtml --error-severity=10 --ignore-annotations -n -p vendor/adyen/adyen-magento2-expresscheckout
bin/magento module:enable --all
bin/magento setup:upgrade
bin/magento setup:di:compile

# Configuration
configure: n98-magerun2.phar
bin/magento config:set payment/adyen_abstract/demo_mode 1
bin/magento adyen:enablepaymentmethods:run
bin/magento config:set payment/adyen_abstract/merchant_account "${ADYEN_MERCHANT}"
bin/magento config:set payment/adyen_abstract/client_key_test "${ADYEN_CLIENT_KEY}"
bin/magento config:set payment/adyen_abstract/payment_methods_active 1
bin/magento config:set payment/adyen_googlepay/express_show_on "1,2,3"
bin/magento config:set payment/adyen_applepay/express_show_on "1,2,3"
bin/magento config:set payment/adyen_paypal_express/express_show_on "1,2,3"
./n98-magerun2.phar config:store:set --encrypt payment/adyen_abstract/notification_password '1234' > /dev/null
./n98-magerun2.phar config:store:set --encrypt payment/adyen_abstract/api_key_test "${ADYEN_API_KEY}" > /dev/null

# Clear cache
flush:
bin/magento cache:flush

# Full plugin setup
plugin: install configure flush

# Production mode
production:
bin/magento deploy:mode:set production

# Setup permissions
fs:
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chmod 777 -R var
chown -R www-data:www-data .
chmod u+x bin/magento
echo "memory_limit = -1" > /usr/local/etc/php/conf.d/memory.ini

MAGENTO_ROOT=/var/www/html
GRAPHQL_XML=${MAGENTO_ROOT}/dev/tests/api-functional/phpunit_graphql.xml.dist
GRAPHQL_PHP=/data/extensions/workdir/Test/phpunit_graphql.php
GRAPHQL_SUITE=${MAGENTO_ROOT}/vendor/adyen/adyen-magento2-expresscheckout/Test/api-functional/GraphQl

# GraphQL tests
graphql:
@cd ${MAGENTO_ROOT}/dev/tests/api-functional && \
${MAGENTO_ROOT}/vendor/bin/phpunit --prepend ${GRAPHQL_PHP} --configuration ${GRAPHQL_XML} ${GRAPHQL_SUITE}
8 changes: 8 additions & 0 deletions .github/config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
memory_limit = 2G
; Error reporting in production mode
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = On
post_max_size = 20M
upload_max_filesize = 20M
date.timezone = Europe/Amsterdam
30 changes: 30 additions & 0 deletions .github/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
playwright:
image: mcr.microsoft.com/playwright:v1.49.0
shm_size: 1gb
ipc: host
cap_add:
- SYS_ADMIN
networks:
- backend
environment:
- INTEGRATION_TESTS_BRANCH
- MAGENTO_BASE_URL
- MAGENTO_ADMIN_USERNAME
- MAGENTO_ADMIN_PASSWORD
- PAYPAL_USERNAME
- PAYPAL_PASSWORD
- ADYEN_API_KEY
- ADYEN_CLIENT_KEY
- ADYEN_MERCHANT
- GOOGLE_USERNAME
- GOOGLE_PASSWORD
- WEBHOOK_USERNAME
- WEBHOOK_PASSWORD
- CI
volumes:
- ./scripts/e2e.sh:/e2e.sh
- ../test-report:/tmp/test-report
networks:
backend:
65 changes: 65 additions & 0 deletions .github/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: '3'

services:
db:
image: mariadb:10.4
container_name: mariadb
networks:
- backend
environment:
MARIADB_ROOT_PASSWORD: root_password
MARIADB_DATABASE: magento
MARIADB_USER: magento
MARIADB_PASSWORD: magento
opensearch:
image: bitnami/opensearch:2
container_name: opensearch-container
networks:
- backend
ports:
- 9200:9200
- 9300:9300
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms750m -Xmx750m"
web:
build:
context: .
args:
- PHP_VERSION=${PHP_VERSION}
- MAGENTO_VERSION=${MAGENTO_VERSION}
container_name: magento2-container
extra_hosts:
- "magento2.test.com:127.0.0.1"
networks:
backend:
aliases:
- magento2.test.com
environment:
DB_SERVER: mariadb
OPENSEARCH_SERVER: opensearch-container
MAGENTO_HOST: magento2.test.com
VIRTUAL_HOST: magento2.test.com
COMPOSER_MEMORY_LIMIT: -1
DEPLOY_SAMPLEDATA:
DONATION_ACCOUNT:
ADMIN_USERNAME:
ADMIN_PASSWORD:
ADYEN_MERCHANT:
ADYEN_API_KEY:
ADYEN_CLIENT_KEY:
PHP_VERSION:
MAGENTO_VERSION:
depends_on:
- db
- opensearch
volumes:
- ../:/data/extensions/workdir
- ./Makefile:/var/www/html/Makefile
- composer:/usr/local/bin
- magento:/var/www/html
networks:
backend:
volumes:
magento:
composer:
29 changes: 29 additions & 0 deletions .github/scripts/e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Base configuration and installation
set -euo pipefail
cd /tmp
git clone https://github.com/Adyen/adyen-integration-tools-tests.git
cd adyen-integration-tools-tests
git checkout $INTEGRATION_TESTS_BRANCH
rm -rf package-lock.json
npm i
npx playwright install

option="$1"

# Run the desired group of tests
case $option in
"standard")
echo "Running Standard Set of E2E Tests."
npm run test:ci:magento
;;
"express-checkout")
echo "Running Express Checkout E2E Tests."
npm run test:ci:magento:express-checkout
;;
"all")
echo "Running All Magento E2E Tests"
npm run test:ci:magento:all
;;
esac
Loading

0 comments on commit 67e74e0

Please sign in to comment.