mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
refact: requests from PR
This commit is contained in:
@@ -10,7 +10,7 @@ inputs:
|
||||
|
||||
rabbitmq:
|
||||
required: true
|
||||
default: "rabbitmq:3.9"
|
||||
default: "rabbitmq:3.11"
|
||||
description: "Rabbit MQ version to use."
|
||||
|
||||
redis:
|
||||
@@ -138,8 +138,8 @@ runs:
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
shell: bash
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
echo -e '\033[32mRun Memory Tests\033[0m'
|
||||
php ../../../vendor/bin/phpunit
|
||||
--configuration phpunit.xml.dist
|
||||
@@ -147,7 +147,6 @@ runs:
|
||||
--log-junit=test-results.xml
|
||||
--coverage-html=coverage
|
||||
--testsuite 'Memory Usage Tests'
|
||||
--filter 'AdminAnalytics'
|
||||
"
|
||||
|
||||
- name: Run Magento Integration Tests
|
||||
@@ -155,8 +154,8 @@ runs:
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
shell: bash
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
echo -e '\033[32mRun Magento Integration Tests\033[0m'
|
||||
php ../../../vendor/bin/phpunit
|
||||
--configuration phpunit.xml.dist
|
||||
@@ -171,8 +170,8 @@ runs:
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
shell: bash
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm /bin/bash -c "cd ./dev/tests/integration
|
||||
echo -e '\033[32mRun Magento Integration Tests Real Suite\033[0m'
|
||||
php ../../../vendor/bin/phpunit
|
||||
--configuration phpunit.xml.dist
|
||||
|
||||
@@ -10,12 +10,12 @@ inputs:
|
||||
|
||||
php_version:
|
||||
required: true
|
||||
default: "8.1"
|
||||
default: "8.2"
|
||||
description: "PHP version used in warden container."
|
||||
|
||||
composer_version:
|
||||
required: true
|
||||
default: "2.3.0"
|
||||
default: "2.2.22"
|
||||
description: "The version of composer to use."
|
||||
|
||||
database:
|
||||
@@ -30,12 +30,12 @@ inputs:
|
||||
|
||||
varnish:
|
||||
required: true
|
||||
default: "varnish:7.1"
|
||||
default: "varnish:7.3"
|
||||
description: "Varnish version to use."
|
||||
|
||||
rabbitmq:
|
||||
required: true
|
||||
default: "rabbitmq:3.9"
|
||||
default: "rabbitmq:3.11"
|
||||
description: "Rabbit MQ version to use."
|
||||
|
||||
redis:
|
||||
@@ -86,8 +86,8 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Checkout Den Repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout Warden Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: wardenenv/warden
|
||||
path: warden
|
||||
@@ -200,16 +200,16 @@ runs:
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
shell: bash
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} svc up
|
||||
${DEN} env up
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} svc up
|
||||
${WARDEN} env up
|
||||
|
||||
- name: Change Directory Permissions
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
shell: bash
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm sudo chmod -R 777 .
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm sudo chmod -R 777 .
|
||||
|
||||
- name: Wait for environment to be ready
|
||||
working-directory: ${{ inputs.base_directory }}
|
||||
@@ -217,7 +217,7 @@ runs:
|
||||
env:
|
||||
SEARCH: ${{ inputs.search }}
|
||||
run: |
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
case "${SEARCH}" in
|
||||
elasticsearch:*)
|
||||
SEARCH_HOST="elasticsearch"
|
||||
@@ -228,7 +228,7 @@ runs:
|
||||
esac
|
||||
HEALTHY=1
|
||||
for ((i=1; i<=24; i++)); do
|
||||
SEARCH_STATUS=$(${DEN} env exec -T php-fpm bash -c "curl --write-out %{http_code} --silent --output /dev/null http://${SEARCH_HOST}:9200/_cat/health?h=st; exit 0")
|
||||
SEARCH_STATUS=$(${WARDEN} env exec -T php-fpm bash -c "curl --write-out %{http_code} --silent --output /dev/null http://${SEARCH_HOST}:9200/_cat/health?h=st; exit 0")
|
||||
echo "search status: ${SEARCH_STATUS}"
|
||||
if [ ${SEARCH_STATUS} -eq "200" ]; then
|
||||
HEALTHY=0
|
||||
@@ -246,11 +246,11 @@ runs:
|
||||
RUN_INSTALL: ${{ inputs.run_composer_install }}
|
||||
run: |
|
||||
if [ $RUN_INSTALL == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
wget https://getcomposer.org/download/${{ inputs.composer_version }}/composer.phar -O composer.phar 1>/dev/null 2>&1 && chmod +x composer.phar
|
||||
${DEN} env exec -T php-fpm ls -la | grep composer
|
||||
${DEN} env exec -T php-fpm php composer.phar -v
|
||||
${DEN} env exec -T php-fpm php composer.phar install --no-interaction --no-progress
|
||||
${WARDEN} env exec -T php-fpm ls -la | grep composer
|
||||
${WARDEN} env exec -T php-fpm php composer.phar -v
|
||||
${WARDEN} env exec -T php-fpm php composer.phar install --no-interaction --no-progress
|
||||
else
|
||||
echo "Skipping composer install"
|
||||
fi
|
||||
@@ -264,10 +264,57 @@ runs:
|
||||
RABBITMQ: ${{ inputs.rabbitmq }}
|
||||
VARNISH: ${{ inputs.varnish }}
|
||||
RUN_SETUP_INSTALL: ${{ inputs.run_setup_install }}
|
||||
DEN: /home/runner/work/mageos-magento2/mageos-magento2/warden/bin/warden
|
||||
run: |
|
||||
if [ $RUN_SETUP_INSTALL == "1" ]; then
|
||||
bash build_scripts/run_setup_install.sh "$SEARCH" "$REDIS" "$VARNISH" "$RABBITMQ" "$DEN"
|
||||
SEARCH_ENGINE_VERSION=${SEARCH##*:}
|
||||
case "$SEARCH" in
|
||||
elasticsearch:*)
|
||||
SEARCH_HOST="elasticsearch"
|
||||
;;&
|
||||
elasticsearch:5*)
|
||||
SEARCH_TYPE="elasticsearch5"
|
||||
;;
|
||||
elasticsearch:6*)
|
||||
SEARCH_TYPE="elasticsearch6"
|
||||
;;
|
||||
elasticsearch:7* | elasticsearch:8*)
|
||||
SEARCH_TYPE="elasticsearch7"
|
||||
;;
|
||||
opensearch:*)
|
||||
SEARCH_TYPE="opensearch"
|
||||
SEARCH_HOST="opensearch"
|
||||
;;
|
||||
*)
|
||||
# Default values
|
||||
SEARCH_TYPE="elasticsearch7"
|
||||
SEARCH_HOST="elasticsearch"
|
||||
;;
|
||||
esac
|
||||
|
||||
declare -a PARAMETERS
|
||||
PARAMETERS+=(--backend-frontname=admin --db-host=db --db-name=magento --db-user=magento --db-password=magento)
|
||||
|
||||
if [[ -n $REDIS ]]; then
|
||||
PARAMETERS+=(--session-save=redis --session-save-redis-host=redis --session-save-redis-port=6379 --session-save-redis-db=2 --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0 --cache-backend-redis-port=6379 --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=1 --page-cache-redis-port=6379)
|
||||
fi
|
||||
|
||||
if [[ -n $VARNISH ]]; then
|
||||
PARAMETERS+=(--http-cache-hosts=varnish:80)
|
||||
fi
|
||||
|
||||
if [[ -n $RABBITMQ ]]; then
|
||||
PARAMETERS+=(--amqp-host=rabbitmq --amqp-port=5672 --amqp-user=guest --amqp-password=guest)
|
||||
fi
|
||||
|
||||
if [[ $SEARCH_TYPE == "opensearch" ]]; then
|
||||
PARAMETERS+=(--opensearch-host=$SEARCH_HOST --opensearch-port=9200 --opensearch-index-prefix=magento2 --opensearch-enable-auth=0 --opensearch-timeout=15)
|
||||
else
|
||||
PARAMETERS+=(--search-engine=$SEARCH_TYPE --elasticsearch-host=$SEARCH_HOST --elasticsearch-port=9200 --elasticsearch-enable-auth=0 --elasticsearch-index-prefix=magento2)
|
||||
fi
|
||||
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm bin/magento setup:install "${PARAMETERS[@]}"
|
||||
|
||||
else
|
||||
echo "Skipping setup:install"
|
||||
fi
|
||||
@@ -277,8 +324,8 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_admin_user_creation }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm php bin/magento admin:user:create \
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm php bin/magento admin:user:create \
|
||||
--admin-user=admin \
|
||||
--admin-password=abcABC123 \
|
||||
--admin-email=user-email-dummy@mage-os-awesome.com \
|
||||
@@ -293,14 +340,14 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_magento_config_preset }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_adminhtml 1
|
||||
${DEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
||||
${DEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
||||
${DEN} env exec -T php-fpm bin/magento config:set cms/wysiwyg/enabled disabled
|
||||
${DEN} env exec -T php-fpm bin/magento config:set admin/security/admin_account_sharing 1
|
||||
${DEN} env exec -T php-fpm bin/magento config:set admin/security/use_form_key 0
|
||||
${DEN} env exec -T php-fpm bin/magento config:set web/seo/use_rewrites 1
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_adminhtml 1
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set --lock-env web/secure/use_in_frontend 1
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set cms/wysiwyg/enabled disabled
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set admin/security/admin_account_sharing 1
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set admin/security/use_form_key 0
|
||||
${WARDEN} env exec -T php-fpm bin/magento config:set web/seo/use_rewrites 1
|
||||
else
|
||||
echo "Skipping magento config preset"
|
||||
fi
|
||||
@@ -310,10 +357,9 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_setup_upgrade }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm bin/magento cache:flush
|
||||
${DEN} env exec -T php-fpm bin/magento setup:upgrade
|
||||
${DEN} env exec -T php-fpm bin/magento setup:db:status
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm bin/magento setup:upgrade
|
||||
${WARDEN} env exec -T php-fpm bin/magento setup:db:status
|
||||
else
|
||||
echo "Skipping setup:upgrade"
|
||||
fi
|
||||
@@ -323,8 +369,8 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_production_deploy_mode }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm bin/magento deploy:mode:set production
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm bin/magento deploy:mode:set production
|
||||
else
|
||||
echo "Skipping deploy:mode:set production"
|
||||
fi
|
||||
@@ -334,8 +380,8 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_reindex }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm bin/magento indexer:reindex
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm bin/magento indexer:reindex
|
||||
else
|
||||
echo "Skipping indexer:reindex"
|
||||
fi
|
||||
@@ -345,8 +391,8 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ${{ inputs.run_setup_install }} == "1" ]; then
|
||||
export DEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${DEN} env exec -T php-fpm php bin/magento
|
||||
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
|
||||
${WARDEN} env exec -T php-fpm php bin/magento
|
||||
else
|
||||
echo "Skipping php bin/magento test command"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user