Compare commits
1 Commits
update-plu
...
4.31.0
Author | SHA1 | Date | |
---|---|---|---|
9025243766 |
@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Fetch the versions of WooCommerce from the WordPress API
|
|
||||||
VERSIONS=$(curl -s https://api.wordpress.org/plugins/info/1.0/woocommerce.json | jq -r '.versions | keys_unsorted | .[]' | grep -v 'trunk')
|
|
||||||
LATEST_VERSION=""
|
|
||||||
|
|
||||||
# Find the latest version
|
|
||||||
for version in $VERSIONS; do
|
|
||||||
LATEST_VERSION=$version
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if the latest version is a beta/RC version
|
|
||||||
if [[ $LATEST_VERSION != *'beta'* && $LATEST_VERSION != *'rc'* ]]; then
|
|
||||||
echo "No WooCommerce beta/RC version found."
|
|
||||||
echo "LATEST_BETA="
|
|
||||||
else
|
|
||||||
echo "Latest WooCommerce beta/RC version: $LATEST_VERSION"
|
|
||||||
echo "LATEST_BETA=$LATEST_VERSION"
|
|
||||||
fi
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Fetch the WordPress releases RSS feed
|
|
||||||
RSS_FEED=$(curl -s https://wordpress.org/news/category/releases/feed/)
|
|
||||||
|
|
||||||
# Extract the latest version from the feed and convert it to lowercase
|
|
||||||
LAST_VERSION=$(echo "$RSS_FEED" | grep -o '<title>WordPress [^<]*</title>' | sed -E 's/<\/?title>//g' | head -n 1 | tr [:upper:] [:lower:])
|
|
||||||
|
|
||||||
# Check if a beta or RC version is found
|
|
||||||
if [[ $LAST_VERSION == *'beta'* ]]; then
|
|
||||||
# Extract titles containing beta versions from the feed
|
|
||||||
VERSION_LINE=$(echo "$RSS_FEED" | grep -o '<code>wp core update [^<]*</code>' | sed -E 's/<\/?code>//g' | head -n 1 | grep 'beta')
|
|
||||||
LATEST_BETA=$(echo "$VERSION_LINE" | sed -E 's/.*--version=([0-9\.]+-beta[0-9]+).*/\1/')
|
|
||||||
|
|
||||||
echo "Latest WordPress beta version: $LATEST_BETA"
|
|
||||||
echo "LATEST_BETA=$LATEST_BETA"
|
|
||||||
|
|
||||||
elif [[ $LAST_VERSION == *'release candidate'* ]]; then
|
|
||||||
# Extract titles containing RC versions from the feed
|
|
||||||
VERSION_LINE=$(echo "$RSS_FEED" | grep -o '<code>wp core update [^<]*</code>' | sed -E 's/<\/?code>//g' | head -n 1 | grep 'RC')
|
|
||||||
LATEST_BETA=$(echo "$VERSION_LINE" | sed -E 's/.*--version=([0-9\.]+-RC[0-9]+).*/\1/')
|
|
||||||
|
|
||||||
echo "Latest WordPress RC version: $LATEST_BETA"
|
|
||||||
echo "LATEST_BETA=$LATEST_BETA"
|
|
||||||
else
|
|
||||||
echo "No WordPress beta/RC version found."
|
|
||||||
echo "LATEST_BETA="
|
|
||||||
fi
|
|
@ -2,7 +2,6 @@ version: 2.1
|
|||||||
|
|
||||||
orbs:
|
orbs:
|
||||||
slack: circleci/slack@4.2.0
|
slack: circleci/slack@4.2.0
|
||||||
jq: circleci/jq@3.0.0
|
|
||||||
|
|
||||||
slack-fail-post-step: &slack-fail-post-step
|
slack-fail-post-step: &slack-fail-post-step
|
||||||
post-steps:
|
post-steps:
|
||||||
@ -94,28 +93,28 @@ executors:
|
|||||||
wpcli_php_oldest:
|
wpcli_php_oldest:
|
||||||
<<: *default_job_config
|
<<: *default_job_config
|
||||||
docker:
|
docker:
|
||||||
- image: mailpoet/wordpress:7.4_20231129.1
|
- image: mailpoet/wordpress:7.3_20230518.1
|
||||||
|
|
||||||
wpcli_php_max_wporg:
|
wpcli_php_max_wporg:
|
||||||
<<: *default_job_config
|
<<: *default_job_config
|
||||||
docker:
|
docker:
|
||||||
- image: mailpoet/wordpress:8.1_20230307.1 # We need to use 8.1 to emulate the WP.org environment
|
- image: mailpoet/wordpress:7.4_20210122.1
|
||||||
|
|
||||||
wpcli_php_latest:
|
wpcli_php_latest:
|
||||||
<<: *default_job_config
|
<<: *default_job_config
|
||||||
docker:
|
docker:
|
||||||
- image: mailpoet/wordpress:8.2_20241126.1
|
- image: mailpoet/wordpress:8.1_20230307.1
|
||||||
|
|
||||||
wpcli_php_mysql_oldest:
|
wpcli_php_mysql_oldest:
|
||||||
<<: *default_job_config
|
<<: *default_job_config
|
||||||
docker:
|
docker:
|
||||||
- image: mailpoet/wordpress:7.4_20231129.1
|
- image: mailpoet/wordpress:7.3_20230518.1
|
||||||
- image: cimg/mysql:5.7
|
- image: cimg/mysql:5.7
|
||||||
|
|
||||||
wpcli_php_mysql_latest:
|
wpcli_php_mysql_latest:
|
||||||
<<: *default_job_config
|
<<: *default_job_config
|
||||||
docker:
|
docker:
|
||||||
- image: mailpoet/wordpress:8.2_20241126.1
|
- image: mailpoet/wordpress:8.1_20230307.1
|
||||||
- image: cimg/mysql:8.0
|
- image: cimg/mysql:8.0
|
||||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_520_ci
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_520_ci
|
||||||
|
|
||||||
@ -141,8 +140,6 @@ jobs:
|
|||||||
key: composer-{{ checksum "tasks/code_sniffer/composer.json" }}-{{ checksum "tasks/code_sniffer/composer.lock" }}
|
key: composer-{{ checksum "tasks/code_sniffer/composer.json" }}-{{ checksum "tasks/code_sniffer/composer.lock" }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
||||||
- restore_cache:
|
|
||||||
key: composer-{{ checksum "../tests_env/composer.json" }}-{{ checksum "../tests_env/composer.lock" }}
|
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
@ -157,9 +154,9 @@ jobs:
|
|||||||
./tools/vendor/composer.phar validate --no-check-all --no-check-publish --working-dir=prefixer
|
./tools/vendor/composer.phar validate --no-check-all --no-check-publish --working-dir=prefixer
|
||||||
touch .env
|
touch .env
|
||||||
./do install
|
./do install
|
||||||
./do compile:all --env production --skip-tests
|
./do compile:all --env production
|
||||||
./do doctrine:generate-cache
|
./do doctrine:generate-cache
|
||||||
../tests_env/vendor/bin/codecept build
|
vendor/bin/codecept build
|
||||||
./do twig:generate-cache
|
./do twig:generate-cache
|
||||||
- run:
|
- run:
|
||||||
name: 'Check Prettier formatting'
|
name: 'Check Prettier formatting'
|
||||||
@ -180,10 +177,6 @@ jobs:
|
|||||||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
||||||
paths:
|
paths:
|
||||||
- vendor
|
- vendor
|
||||||
- save_cache:
|
|
||||||
key: composer-{{ checksum "../tests_env/composer.json" }}-{{ checksum "../tests_env/composer.lock" }}
|
|
||||||
paths:
|
|
||||||
- ../tests_env/vendor
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
||||||
paths:
|
paths:
|
||||||
@ -197,10 +190,11 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: Download additional WP Plugins for tests
|
name: Download additional WP Plugins for tests
|
||||||
command: |
|
command: |
|
||||||
./do download:woo-commerce-zip 9.6.1
|
./do download:woo-commerce-zip latest
|
||||||
./do download:woo-commerce-subscriptions-zip 7.1.0
|
./do download:woo-commerce-subscriptions-zip 4.9.1
|
||||||
./do download:woo-commerce-memberships-zip 1.26.5
|
./do download:woo-commerce-memberships-zip 1.24.0
|
||||||
./do download:automate-woo-zip 6.1.5
|
./do download:woo-commerce-blocks-zip 9.6.2
|
||||||
|
./do download:automate-woo-zip 6.0.5
|
||||||
- run:
|
- run:
|
||||||
name: Dump tests ENV variables for acceptance tests
|
name: Dump tests ENV variables for acceptance tests
|
||||||
command: |
|
command: |
|
||||||
@ -256,12 +250,12 @@ jobs:
|
|||||||
|
|
||||||
static_analysis:
|
static_analysis:
|
||||||
executor: wpcli_php_latest
|
executor: wpcli_php_latest
|
||||||
resource_class: medium+
|
resource_class: medium
|
||||||
working_directory: /home/circleci/mailpoet/mailpoet
|
working_directory: /home/circleci/mailpoet/mailpoet
|
||||||
parameters:
|
parameters:
|
||||||
php_version:
|
php_version:
|
||||||
type: integer
|
type: integer
|
||||||
default: 70400
|
default: 70200
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: /home/circleci
|
at: /home/circleci
|
||||||
@ -271,7 +265,7 @@ jobs:
|
|||||||
security_analysis:
|
security_analysis:
|
||||||
working_directory: /home/circleci/mailpoet/mailpoet
|
working_directory: /home/circleci/mailpoet/mailpoet
|
||||||
machine:
|
machine:
|
||||||
image: default
|
image: ubuntu-2204:2022.10.2
|
||||||
docker_layer_caching: false
|
docker_layer_caching: false
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -336,7 +330,6 @@ jobs:
|
|||||||
name: 'JS Newsletter Editor Tests'
|
name: 'JS Newsletter Editor Tests'
|
||||||
command: |
|
command: |
|
||||||
mkdir test-results/mocha
|
mkdir test-results/mocha
|
||||||
./do compile:js --env production --only-tests
|
|
||||||
./do t:newsletter-editor test-results/mocha/newsletter_editor_junit.xml
|
./do t:newsletter-editor test-results/mocha/newsletter_editor_junit.xml
|
||||||
- run:
|
- run:
|
||||||
name: 'JS Tests'
|
name: 'JS Tests'
|
||||||
@ -351,7 +344,7 @@ jobs:
|
|||||||
parallelism: 20
|
parallelism: 20
|
||||||
working_directory: /home/circleci/mailpoet/mailpoet
|
working_directory: /home/circleci/mailpoet/mailpoet
|
||||||
machine:
|
machine:
|
||||||
image: default
|
image: ubuntu-2204:2022.10.2
|
||||||
docker_layer_caching: false
|
docker_layer_caching: false
|
||||||
parameters:
|
parameters:
|
||||||
multisite:
|
multisite:
|
||||||
@ -381,121 +374,85 @@ jobs:
|
|||||||
woo_memberships_version:
|
woo_memberships_version:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
|
woo_blocks_version:
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
automate_woo_version:
|
automate_woo_version:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
blockbased_theme:
|
enable_cot:
|
||||||
type: integer
|
type: integer
|
||||||
default: 0
|
default: 0
|
||||||
enable_hpos:
|
enable_cot_sync:
|
||||||
type: integer
|
type: integer
|
||||||
default: 0
|
default: 0
|
||||||
enable_hpos_sync:
|
|
||||||
type: integer
|
|
||||||
default: 0
|
|
||||||
disable_hpos:
|
|
||||||
type: integer
|
|
||||||
default: 0
|
|
||||||
use_wordpress_beta:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
use_woocommerce_beta:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
wordpress_version:
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
environment:
|
environment:
|
||||||
MYSQL_COMMAND: << parameters.mysql_command >>
|
MYSQL_COMMAND: << parameters.mysql_command >>
|
||||||
MYSQL_IMAGE: << parameters.mysql_image >>
|
MYSQL_IMAGE: << parameters.mysql_image >>
|
||||||
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
||||||
WORDPRESS_IMAGE_VERSION: << parameters.wordpress_image_version >>
|
WORDPRESS_IMAGE_VERSION: << parameters.wordpress_image_version >>
|
||||||
WORDPRESS_VERSION: << parameters.wordpress_version >>
|
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: /home/circleci
|
at: /home/circleci
|
||||||
- run:
|
- run:
|
||||||
name: 'Set up virtual host'
|
name: 'Set up virtual host'
|
||||||
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
|
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
|
||||||
- run:
|
|
||||||
name: Check for Latest WordPress Beta Version
|
|
||||||
command: |
|
|
||||||
if [ "<< parameters.use_wordpress_beta >>" == "true" ]; then
|
|
||||||
LATEST_WP_BETA=$(../.circleci/check_wordpress_beta.sh | grep 'LATEST_BETA' | cut -d'=' -f2)
|
|
||||||
if [ -z "$LATEST_WP_BETA" ]; then
|
|
||||||
echo "No latest beta version found. Ending job early."
|
|
||||||
circleci-agent step halt
|
|
||||||
else
|
|
||||||
echo "export WORDPRESS_VERSION=$LATEST_WP_BETA" >> $BASH_ENV
|
|
||||||
echo "Using WordPress Beta Version: $LATEST_WP_BETA"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Not using WordPress Beta Version"
|
|
||||||
fi
|
|
||||||
- run:
|
|
||||||
name: Check for Latest WooCommerce Beta Version
|
|
||||||
command: |
|
|
||||||
if [ "<< parameters.use_woocommerce_beta >>" == "true" ]; then
|
|
||||||
LATEST_WC_BETA=$(../.circleci/check_woocommerce_beta.sh | grep 'LATEST_BETA' | cut -d'=' -f2)
|
|
||||||
if [ -z "$LATEST_WC_BETA" ]; then
|
|
||||||
echo "No WooCommerce Beta version found. Ending job early."
|
|
||||||
circleci-agent step halt
|
|
||||||
else
|
|
||||||
echo "export WOOCOMMERCE_VERSION=$LATEST_WC_BETA" >> $BASH_ENV
|
|
||||||
echo "Using WooCommerce Beta Version: $LATEST_WC_BETA"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "export WOOCOMMERCE_VERSION=<< parameters.woo_core_version >>" >> $BASH_ENV
|
|
||||||
echo "Not using WooCommerce Beta Version"
|
|
||||||
fi
|
|
||||||
- run:
|
- run:
|
||||||
name: 'Pull test docker images'
|
name: 'Pull test docker images'
|
||||||
# Pull docker images with 3 retries
|
# Pull docker images with 3 retries
|
||||||
command: i='0';while ! docker compose -f ../tests_env/docker/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
command: i='0';while ! docker-compose -f tests/docker/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
||||||
- run:
|
- run:
|
||||||
name: Create docker containers for test
|
name: Create docker containers for test
|
||||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose create || docker compose create
|
docker-compose create || docker-compose create
|
||||||
- run:
|
- run:
|
||||||
# Some tools we use may need different version based on PHP version used in docker
|
# Some tools we use may need different version based on PHP version used in docker
|
||||||
name: Ensure correct versions of tools
|
name: Ensure correct versions of tools
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_acceptance
|
docker-compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_acceptance
|
||||||
- when:
|
- when:
|
||||||
condition: ${WOOCOMMERCE_VERSION}
|
condition: << parameters.woo_core_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Core
|
name: Download WooCommerce Core
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-zip ${WOOCOMMERCE_VERSION}" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-zip << parameters.woo_core_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.woo_subscriptions_version >>
|
condition: << parameters.woo_subscriptions_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Subscriptions
|
name: Download WooCommerce Subscriptions
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-subscriptions-zip << parameters.woo_subscriptions_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-subscriptions-zip << parameters.woo_subscriptions_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.woo_memberships_version >>
|
condition: << parameters.woo_memberships_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Memberships
|
name: Download WooCommerce Memberships
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-memberships-zip << parameters.woo_memberships_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-memberships-zip << parameters.woo_memberships_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
||||||
|
- when:
|
||||||
|
condition: << parameters.woo_blocks_version >>
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: Download WooCommerce Blocks
|
||||||
|
command: |
|
||||||
|
cd tests/docker
|
||||||
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-blocks-zip << parameters.woo_blocks_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.automate_woo_version >>
|
condition: << parameters.automate_woo_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download AutomateWoo
|
name: Download AutomateWoo
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:automate-woo-zip << parameters.automate_woo_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
docker-compose run --rm -w /project --entrypoint "./do download:automate-woo-zip << parameters.automate_woo_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_acceptance
|
||||||
- run:
|
- run:
|
||||||
name: Group acceptance tests
|
name: Group acceptance tests
|
||||||
command: |
|
command: |
|
||||||
@ -515,7 +472,7 @@ jobs:
|
|||||||
name: Run acceptance tests
|
name: Run acceptance tests
|
||||||
command: |
|
command: |
|
||||||
mkdir -m 777 -p tests/_output/exceptions
|
mkdir -m 777 -p tests/_output/exceptions
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
args=(
|
args=(
|
||||||
--steps
|
--steps
|
||||||
--debug
|
--debug
|
||||||
@ -524,15 +481,12 @@ jobs:
|
|||||||
--xml
|
--xml
|
||||||
-g circleci_split_group
|
-g circleci_split_group
|
||||||
)
|
)
|
||||||
docker compose run -e SKIP_DEPS=1 \
|
docker-compose run -e SKIP_DEPS=1 \
|
||||||
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
|
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
|
||||||
-e CIRCLE_JOB=${CIRCLE_JOB} \
|
-e CIRCLE_JOB=${CIRCLE_JOB} \
|
||||||
-e MULTISITE=<< parameters.multisite >> \
|
-e MULTISITE=<< parameters.multisite >> \
|
||||||
-e BLOCKBASED_THEME=<< parameters.blockbased_theme >> \
|
-e ENABLE_COT=<< parameters.enable_cot >> \
|
||||||
-e ENABLE_HPOS=<< parameters.enable_hpos >> \
|
-e ENABLE_COT_SYNC=<< parameters.enable_cot_sync >> \
|
||||||
-e ENABLE_HPOS_SYNC=<< parameters.enable_hpos_sync >> \
|
|
||||||
-e DISABLE_HPOS=<< parameters.disable_hpos >> \
|
|
||||||
-e WORDPRESS_VERSION=${WORDPRESS_VERSION} \
|
|
||||||
codeception_acceptance "${args[@]}"
|
codeception_acceptance "${args[@]}"
|
||||||
- run:
|
- run:
|
||||||
name: Check exceptions
|
name: Check exceptions
|
||||||
@ -548,7 +502,7 @@ jobs:
|
|||||||
performance_tests:
|
performance_tests:
|
||||||
working_directory: /home/circleci/mailpoet/mailpoet
|
working_directory: /home/circleci/mailpoet/mailpoet
|
||||||
machine:
|
machine:
|
||||||
image: default
|
image: ubuntu-2204:2022.10.2
|
||||||
docker_layer_caching: false
|
docker_layer_caching: false
|
||||||
parameters:
|
parameters:
|
||||||
mysql_command:
|
mysql_command:
|
||||||
@ -563,9 +517,6 @@ jobs:
|
|||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
default: 'http://localhost:9500'
|
default: 'http://localhost:9500'
|
||||||
us:
|
|
||||||
type: string
|
|
||||||
default: 'admin'
|
|
||||||
pw:
|
pw:
|
||||||
type: string
|
type: string
|
||||||
default: 'password'
|
default: 'password'
|
||||||
@ -583,13 +534,13 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: 'Pull test docker images'
|
name: 'Pull test docker images'
|
||||||
# Pull docker images with 3 retries
|
# Pull docker images with 3 retries
|
||||||
command: i='0';while ! docker compose -f tests/performance/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
command: i='0';while ! docker-compose -f tests/performance/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
||||||
- run:
|
- run:
|
||||||
name: Create docker containers for test
|
name: Create docker containers for test
|
||||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||||
command: |
|
command: |
|
||||||
cd tests/performance
|
cd tests/performance
|
||||||
docker compose create || docker compose create
|
docker-compose create || docker-compose create
|
||||||
- run:
|
- run:
|
||||||
name: Run performance tests
|
name: Run performance tests
|
||||||
command: |
|
command: |
|
||||||
@ -647,21 +598,16 @@ jobs:
|
|||||||
integration_tests:
|
integration_tests:
|
||||||
working_directory: /home/circleci/mailpoet/mailpoet
|
working_directory: /home/circleci/mailpoet/mailpoet
|
||||||
machine:
|
machine:
|
||||||
image: default
|
image: ubuntu-2204:2022.10.2
|
||||||
docker_layer_caching: false
|
docker_layer_caching: false
|
||||||
environment:
|
environment:
|
||||||
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
||||||
MYSQL_COMMAND: << parameters.mysql_command >>
|
MYSQL_COMMAND: << parameters.mysql_command >>
|
||||||
MYSQL_IMAGE: << parameters.mysql_image >>
|
MYSQL_IMAGE: << parameters.mysql_image >>
|
||||||
WORDPRESS_IMAGE_VERSION: << parameters.wordpress_image_version >>
|
|
||||||
WORDPRESS_VERSION: << parameters.wordpress_version >>
|
|
||||||
parameters:
|
parameters:
|
||||||
codeception_image_version:
|
codeception_image_version:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
wordpress_image_version:
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
group:
|
group:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
@ -671,13 +617,10 @@ jobs:
|
|||||||
skip_plugins:
|
skip_plugins:
|
||||||
type: integer
|
type: integer
|
||||||
default: 0
|
default: 0
|
||||||
enable_hpos:
|
enable_cot:
|
||||||
type: integer
|
type: integer
|
||||||
default: 0
|
default: 0
|
||||||
enable_hpos_sync:
|
enable_cot_sync:
|
||||||
type: integer
|
|
||||||
default: 0
|
|
||||||
disable_hpos:
|
|
||||||
type: integer
|
type: integer
|
||||||
default: 0
|
default: 0
|
||||||
multisite:
|
multisite:
|
||||||
@ -698,105 +641,76 @@ jobs:
|
|||||||
woo_memberships_version:
|
woo_memberships_version:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
automate_woo_version:
|
woo_blocks_version:
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
use_wordpress_beta:
|
automate_woo_version:
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
use_woocommerce_beta:
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
wordpress_version:
|
|
||||||
type: string
|
type: string
|
||||||
default: ''
|
default: ''
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: /home/circleci
|
at: /home/circleci
|
||||||
- run:
|
|
||||||
name: Check for Latest WordPress Beta Version
|
|
||||||
command: |
|
|
||||||
if [ "<< parameters.use_wordpress_beta >>" == "true" ]; then
|
|
||||||
LATEST_WP_BETA=$(../.circleci/check_wordpress_beta.sh | grep 'LATEST_BETA' | cut -d'=' -f2)
|
|
||||||
if [ -z "$LATEST_WP_BETA" ]; then
|
|
||||||
echo "No latest beta version found. Ending job early."
|
|
||||||
circleci-agent step halt
|
|
||||||
else
|
|
||||||
echo "export WORDPRESS_VERSION=$LATEST_WP_BETA" >> $BASH_ENV
|
|
||||||
echo "Using WordPress Beta Version: $LATEST_WP_BETA"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Not using WordPress Beta Version"
|
|
||||||
fi
|
|
||||||
- run:
|
|
||||||
name: Check for Latest WooCommerce Beta Version
|
|
||||||
command: |
|
|
||||||
if [ "<< parameters.use_woocommerce_beta >>" == "true" ]; then
|
|
||||||
LATEST_WC_BETA=$(../.circleci/check_woocommerce_beta.sh | grep 'LATEST_BETA' | cut -d'=' -f2)
|
|
||||||
if [ -z "$LATEST_WC_BETA" ]; then
|
|
||||||
echo "No WooCommerce Beta version found. Ending job early."
|
|
||||||
circleci-agent step halt
|
|
||||||
else
|
|
||||||
echo "export WOOCOMMERCE_VERSION=$LATEST_WC_BETA" >> $BASH_ENV
|
|
||||||
echo "Using WooCommerce Beta Version: $LATEST_WC_BETA"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "export WOOCOMMERCE_VERSION=<< parameters.woo_core_version >>" >> $BASH_ENV
|
|
||||||
echo "Not using WooCommerce Beta Version"
|
|
||||||
fi
|
|
||||||
- run:
|
- run:
|
||||||
name: 'Pull test docker images'
|
name: 'Pull test docker images'
|
||||||
# Pull docker images with 3 retries
|
# Pull docker images with 3 retries
|
||||||
command: i='0';while ! docker compose -f ../tests_env/docker/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
command: i='0';while ! docker-compose -f tests/docker/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
|
||||||
- run:
|
- run:
|
||||||
name: Create docker containers for test
|
name: Create docker containers for test
|
||||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose create || docker compose create
|
docker-compose create || docker-compose create
|
||||||
- run:
|
- run:
|
||||||
# Some tools we use may need different version based on PHP version used in docker
|
# Some tools we use may need different version based on PHP version used in docker
|
||||||
name: Ensure correct versions of tools
|
name: Ensure correct versions of tools
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_integration
|
docker-compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_integration
|
||||||
- when:
|
- when:
|
||||||
condition: ${WOOCOMMERCE_VERSION}
|
condition: << parameters.woo_core_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Core
|
name: Download WooCommerce Core
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-zip ${WOOCOMMERCE_VERSION}" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-zip << parameters.woo_core_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.woo_subscriptions_version >>
|
condition: << parameters.woo_subscriptions_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Subscriptions
|
name: Download WooCommerce Subscriptions
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-subscriptions-zip << parameters.woo_subscriptions_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-subscriptions-zip << parameters.woo_subscriptions_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.woo_memberships_version >>
|
condition: << parameters.woo_memberships_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download WooCommerce Memberships
|
name: Download WooCommerce Memberships
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:woo-commerce-memberships-zip << parameters.woo_memberships_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-memberships-zip << parameters.woo_memberships_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
||||||
|
- when:
|
||||||
|
condition: << parameters.woo_blocks_version >>
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: Download WooCommerce Blocks
|
||||||
|
command: |
|
||||||
|
cd tests/docker
|
||||||
|
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-blocks-zip << parameters.woo_blocks_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.automate_woo_version >>
|
condition: << parameters.automate_woo_version >>
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Download AutomateWoo
|
name: Download AutomateWoo
|
||||||
command: |
|
command: |
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
docker compose run --rm -w /project --entrypoint "./do download:automate-woo-zip << parameters.automate_woo_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
docker-compose run --rm -w /project --entrypoint "./do download:automate-woo-zip << parameters.automate_woo_version >>" --no-deps -e WP_GITHUB_USERNAME=${WP_GITHUB_USERNAME} -e WP_GITHUB_TOKEN=${WP_GITHUB_TOKEN} codeception_integration
|
||||||
- run:
|
- run:
|
||||||
name: 'PHP Integration tests'
|
name: 'PHP Integration tests'
|
||||||
command: |
|
command: |
|
||||||
mkdir -m 777 -p tests/_output/exceptions
|
mkdir -m 777 -p tests/_output/exceptions
|
||||||
cd ../tests_env/docker
|
cd tests/docker
|
||||||
args=(
|
args=(
|
||||||
--steps
|
--steps
|
||||||
--debug
|
--debug
|
||||||
@ -810,7 +724,7 @@ jobs:
|
|||||||
if [[ -n '<< parameters.skip_group >>' ]]; then
|
if [[ -n '<< parameters.skip_group >>' ]]; then
|
||||||
args+=(--skip-group << parameters.skip_group >>)
|
args+=(--skip-group << parameters.skip_group >>)
|
||||||
fi
|
fi
|
||||||
docker compose run -e SKIP_DEPS=1 \
|
docker-compose run -e SKIP_DEPS=1 \
|
||||||
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
|
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
|
||||||
-e CIRCLE_JOB=${CIRCLE_JOB} \
|
-e CIRCLE_JOB=${CIRCLE_JOB} \
|
||||||
-e SKIP_PLUGINS=<< parameters.skip_plugins >> \
|
-e SKIP_PLUGINS=<< parameters.skip_plugins >> \
|
||||||
@ -827,10 +741,8 @@ jobs:
|
|||||||
-e WP_TEST_MAILER_SMTP_LOGIN=${WP_TEST_MAILER_SMTP_LOGIN} \
|
-e WP_TEST_MAILER_SMTP_LOGIN=${WP_TEST_MAILER_SMTP_LOGIN} \
|
||||||
-e WP_TEST_MAILER_SMTP_PASSWORD=${WP_TEST_MAILER_SMTP_PASSWORD} \
|
-e WP_TEST_MAILER_SMTP_PASSWORD=${WP_TEST_MAILER_SMTP_PASSWORD} \
|
||||||
-e MULTISITE=<< parameters.multisite >> \
|
-e MULTISITE=<< parameters.multisite >> \
|
||||||
-e ENABLE_HPOS=<< parameters.enable_hpos >> \
|
-e ENABLE_COT=<< parameters.enable_cot >> \
|
||||||
-e ENABLE_HPOS_SYNC=<< parameters.enable_hpos_sync >> \
|
-e ENABLE_COT_SYNC=<< parameters.enable_cot_sync >> \
|
||||||
-e DISABLE_HPOS=<< parameters.disable_hpos >> \
|
|
||||||
-e WORDPRESS_VERSION=${WORDPRESS_VERSION} \
|
|
||||||
codeception_integration "${args[@]}"
|
codeception_integration "${args[@]}"
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: tests/_output
|
path: tests/_output
|
||||||
@ -842,7 +754,7 @@ jobs:
|
|||||||
destination: mailhog-data
|
destination: mailhog-data
|
||||||
build_release_zip:
|
build_release_zip:
|
||||||
executor: wpcli_php_mysql_latest
|
executor: wpcli_php_mysql_latest
|
||||||
resource_class: large
|
resource_class: medium+
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: /home/circleci
|
at: /home/circleci
|
||||||
@ -863,30 +775,6 @@ jobs:
|
|||||||
root: /home/circleci/mailpoet
|
root: /home/circleci/mailpoet
|
||||||
paths:
|
paths:
|
||||||
- mailpoet/release_zip_build_number.txt
|
- mailpoet/release_zip_build_number.txt
|
||||||
- mailpoet/mailpoet.zip
|
|
||||||
qit_security_scan:
|
|
||||||
executor: wpcli_php_latest
|
|
||||||
steps:
|
|
||||||
- attach_workspace:
|
|
||||||
at: /home/circleci
|
|
||||||
- run:
|
|
||||||
name: 'Set up environment'
|
|
||||||
command: |
|
|
||||||
# Copy built ZIP to local directory for easier access from QIT
|
|
||||||
cp /home/circleci/mailpoet/mailpoet.zip .
|
|
||||||
# Authenticate in QIT
|
|
||||||
./vendor/bin/qit partner:add --user="${QIT_PARTNER_USER}" --application_password="${QIT_PARTNER_SECRET}"
|
|
||||||
- run:
|
|
||||||
name: 'QIT Security Test'
|
|
||||||
command: ./do qa:qit-security | tee tests/_output/qit-security
|
|
||||||
- run:
|
|
||||||
name: 'Retrieve test results'
|
|
||||||
command: |
|
|
||||||
# Download HTML report from QIT servers
|
|
||||||
grep "Result Url" tests/_output/qit-security | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
|
|
||||||
when: always
|
|
||||||
- store_artifacts:
|
|
||||||
path: tests/_output
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
@ -906,13 +794,13 @@ workflows:
|
|||||||
- static_analysis:
|
- static_analysis:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: static_analysis_php7
|
name: static_analysis_php7
|
||||||
php_version: 70400
|
php_version: 70200
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- static_analysis:
|
- static_analysis:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: static_analysis_php8
|
name: static_analysis_php8
|
||||||
php_version: 80200
|
php_version: 80000
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- security_analysis:
|
- security_analysis:
|
||||||
@ -937,31 +825,42 @@ workflows:
|
|||||||
- build
|
- build
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_tests_base_and_woo
|
name: acceptance_tests_base_and_woo_cot_off
|
||||||
enable_hpos: 1
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_tests_woo_hpos_sync_on
|
name: acceptance_tests_woo_cot_sync
|
||||||
group: woo
|
group: woo
|
||||||
enable_hpos_sync: 1
|
enable_cot: 1
|
||||||
|
enable_cot_sync: 1
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_tests_woo_hpos_off
|
name: acceptance_tests_woo_cot_no_sync
|
||||||
group: woo
|
group: woo
|
||||||
disable_hpos: 1
|
enable_cot: 1
|
||||||
|
enable_cot_sync: 0
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
- acceptance_tests:
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
|
- performance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_tests_blockbased_theme
|
name: performance_tests
|
||||||
group: frontend
|
|
||||||
blockbased_theme: 1
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- js_tests:
|
- js_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
requires:
|
requires:
|
||||||
@ -969,44 +868,59 @@ workflows:
|
|||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
group: woo
|
group: woo
|
||||||
enable_hpos_sync: 1
|
enable_cot: 1
|
||||||
name: integration_test_woo_hpos_sync_on
|
enable_cot_sync: 1
|
||||||
|
name: integration_test_woo_cot_sync
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
group: woo
|
group: woo
|
||||||
name: integration_test_woo_hpos_on
|
enable_cot: 1
|
||||||
enable_hpos: 1
|
enable_cot_sync: 0
|
||||||
|
name: integration_test_woo_cot_no_sync
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
group: woo
|
group: woo
|
||||||
disable_hpos: 1
|
name: integration_test_woo_cot_off
|
||||||
name: integration_test_woo_hpos_off
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
skip_group: woo
|
skip_group: woo
|
||||||
skip_plugins: 1
|
skip_plugins: 1
|
||||||
name: integration_test_base
|
name: integration_test_base
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
<<: *multisite_acceptance_config
|
<<: *multisite_acceptance_config
|
||||||
name: acceptance_tests_multisite
|
name: acceptance_tests_multisite
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
<<: *only_trunk_and_release
|
<<: *only_trunk_and_release
|
||||||
multisite: 1
|
multisite: 1
|
||||||
name: integration_tests_multisite
|
name: integration_tests_multisite
|
||||||
requires:
|
requires:
|
||||||
- build
|
- unit_tests
|
||||||
|
- static_analysis_php7
|
||||||
|
- static_analysis_php8
|
||||||
|
- qa_js
|
||||||
|
- qa_php
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
<<: *only_release
|
<<: *only_release
|
||||||
@ -1029,33 +943,20 @@ workflows:
|
|||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- acceptance_tests_base_and_woo
|
- acceptance_tests_base_and_woo_cot_off
|
||||||
- js_tests
|
- js_tests
|
||||||
- integration_test_base
|
- integration_test_base
|
||||||
- integration_test_woo_hpos_on
|
- integration_test_woo_cot_no_sync
|
||||||
- integration_test_woo_hpos_off
|
- integration_test_woo_cot_off
|
||||||
- integration_test_woo_hpos_sync_on
|
- integration_test_woo_cot_sync
|
||||||
- integration_with_premium_latest
|
- acceptance_tests_woo_cot_sync
|
||||||
- acceptance_tests_woo_hpos_sync_on
|
- acceptance_tests_woo_cot_no_sync
|
||||||
- acceptance_tests_woo_hpos_off
|
- performance_tests
|
||||||
- acceptance_tests_blockbased_theme
|
|
||||||
- static_analysis_php8
|
|
||||||
- static_analysis_php7
|
|
||||||
- unit_tests
|
|
||||||
- qa_js
|
|
||||||
- qa_php
|
|
||||||
- qa_php_oldest
|
|
||||||
- security_analysis
|
|
||||||
- qa_php_max_wporg
|
|
||||||
- qit_security_scan:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
requires:
|
|
||||||
- build_release_zip
|
|
||||||
|
|
||||||
nightly:
|
nightly:
|
||||||
triggers:
|
triggers:
|
||||||
- schedule:
|
- schedule:
|
||||||
cron: '0 1 * * 1-5'
|
cron: '0 22 * * 1-5'
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
@ -1066,38 +967,31 @@ workflows:
|
|||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_latest
|
name: acceptance_latest
|
||||||
mysql_image: mysql:8.3
|
woo_core_version: latest
|
||||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
woo_subscriptions_version: latest
|
||||||
requires:
|
woo_memberships_version: latest
|
||||||
- build
|
woo_blocks_version: latest
|
||||||
- acceptance_tests:
|
automate_woo_version: latest
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: acceptance_latest_blockbased_theme
|
|
||||||
group: frontend
|
|
||||||
blockbased_theme: 1
|
|
||||||
mysql_image: mysql:8.3
|
|
||||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- acceptance_tests:
|
- acceptance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: acceptance_oldest
|
name: acceptance_oldest
|
||||||
woo_core_version: 9.5.2
|
woo_core_version: 8.0.0
|
||||||
woo_subscriptions_version: 7.0.0
|
woo_subscriptions_version: 4.3.0
|
||||||
woo_memberships_version: 1.25.2
|
woo_memberships_version: 1.21.0
|
||||||
automate_woo_version: 6.0.33
|
woo_blocks_version: 6.8.0
|
||||||
mysql_command: --max_allowed_packet=100M
|
automate_woo_version: 5.1.1
|
||||||
|
mysql_command: --max_allowed_packet=100M --default-storage-engine=MYISAM
|
||||||
mysql_image: mysql:5.5
|
mysql_image: mysql:5.5
|
||||||
codeception_image_version: 7.4-cli_20220605.0
|
codeception_image_version: 7.4-cli_20220605.0
|
||||||
wordpress_image_version: 6.1.1-php7.4 # We use image with PHP 7.4 and install required WordPress version via CLI
|
wordpress_image_version: wp-6.2_php8.0_20230425.1
|
||||||
wordpress_version: 6.6.2
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- performance_tests:
|
- performance_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: performance_latest
|
name: performance_latest
|
||||||
url: https://mpperftesting.com
|
url: https://mpperftesting.mystagingwebsite.com
|
||||||
us: $WP_TEST_PERFORMANCE_US
|
|
||||||
pw: $WP_TEST_PERFORMANCE_PW
|
pw: $WP_TEST_PERFORMANCE_PW
|
||||||
scenario: nightlytests
|
scenario: nightlytests
|
||||||
requires:
|
requires:
|
||||||
@ -1116,21 +1010,18 @@ workflows:
|
|||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: integration_latest
|
name: integration_latest
|
||||||
mysql_image: mysql:8.3
|
|
||||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
- integration_tests:
|
- integration_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: integration_oldest
|
name: integration_oldest
|
||||||
woo_core_version: 9.5.2
|
woo_core_version: 7.9.0
|
||||||
woo_subscriptions_version: 7.0.0
|
woo_subscriptions_version: 4.3.0
|
||||||
woo_memberships_version: 1.25.2
|
woo_memberships_version: 1.21.0
|
||||||
automate_woo_version: 6.0.33
|
woo_blocks_version: 6.8.0
|
||||||
codeception_image_version: 7.4-cli_20220605.0
|
automate_woo_version: 5.1.1
|
||||||
wordpress_image_version: 6.1.1-php7.4 # We use image with PHP 7.4 and install required WordPress version via CLI # We use image with PHP 7.4 and install required WordPress version via CLI
|
codeception_image_version: 7.3-cli_20230516.0
|
||||||
wordpress_version: 6.6.2
|
mysql_command: --max_allowed_packet=100M --default-storage-engine=MYISAM
|
||||||
mysql_command: --max_allowed_packet=100M
|
|
||||||
mysql_image: mysql:5.5
|
mysql_image: mysql:5.5
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
@ -1143,36 +1034,6 @@ workflows:
|
|||||||
name: acceptance_with_premium_latest
|
name: acceptance_with_premium_latest
|
||||||
requires:
|
requires:
|
||||||
- build_premium
|
- build_premium
|
||||||
- integration_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: integration_tests_wordpress_beta
|
|
||||||
use_wordpress_beta: true
|
|
||||||
mysql_image: mysql:8.3
|
|
||||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
- integration_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: integration_tests_woocommerce_beta
|
|
||||||
use_woocommerce_beta: true
|
|
||||||
mysql_image: mysql:8.3
|
|
||||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
- acceptance_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: acceptance_tests_wordpress_beta
|
|
||||||
enable_hpos: 1
|
|
||||||
use_wordpress_beta: true
|
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
- acceptance_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: acceptance_tests_woocommerce_beta
|
|
||||||
enable_hpos: 1
|
|
||||||
use_woocommerce_beta: true
|
|
||||||
requires:
|
|
||||||
- build
|
|
||||||
- unit_tests:
|
- unit_tests:
|
||||||
<<: *slack-fail-post-step
|
<<: *slack-fail-post-step
|
||||||
name: unit_with_premium_latest
|
name: unit_with_premium_latest
|
||||||
@ -1183,29 +1044,3 @@ workflows:
|
|||||||
name: integration_with_premium_latest
|
name: integration_with_premium_latest
|
||||||
requires:
|
requires:
|
||||||
- build_premium
|
- build_premium
|
||||||
- acceptance_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: acceptance_with_premium_oldest
|
|
||||||
woo_core_version: 9.5.2
|
|
||||||
woo_subscriptions_version: 7.0.0
|
|
||||||
woo_memberships_version: 1.25.2
|
|
||||||
automate_woo_version: 6.0.33
|
|
||||||
codeception_image_version: 7.4-cli_20220605.0
|
|
||||||
wordpress_image_version: 6.1.1-php7.4 # We use image with PHP 7.4 and install required WordPress version via CLI
|
|
||||||
wordpress_version: 6.6.2
|
|
||||||
requires:
|
|
||||||
- build_premium
|
|
||||||
- integration_tests:
|
|
||||||
<<: *slack-fail-post-step
|
|
||||||
name: integration_with_premium_oldest
|
|
||||||
woo_core_version: 9.5.2
|
|
||||||
woo_subscriptions_version: 7.0.0
|
|
||||||
woo_memberships_version: 1.25.2
|
|
||||||
automate_woo_version: 6.0.33
|
|
||||||
codeception_image_version: 7.4-cli_20220605.0
|
|
||||||
wordpress_image_version: 6.1.1-php7.4 # We use image with PHP 7.4 and install required WordPress version via CLI
|
|
||||||
wordpress_version: 6.6.2
|
|
||||||
mysql_command: --max_allowed_packet=100M
|
|
||||||
mysql_image: mysql:5.5
|
|
||||||
requires:
|
|
||||||
- build_premium
|
|
||||||
|
@ -10,12 +10,6 @@ indent_size = 2
|
|||||||
ij_smart_tabs = false
|
ij_smart_tabs = false
|
||||||
max_line_length = off
|
max_line_length = off
|
||||||
|
|
||||||
[packages/php/email-editor/**]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[packages/js/email-editor/**.{js,jsx,ts,tsx,scss}]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[*.php]
|
[*.php]
|
||||||
ij_php_align_key_value_pairs = false
|
ij_php_align_key_value_pairs = false
|
||||||
ij_php_align_multiline_chained_methods = false
|
ij_php_align_multiline_chained_methods = false
|
||||||
@ -61,5 +55,3 @@ ij_php_space_after_for_semicolon = true
|
|||||||
ij_php_space_after_colon_in_return_type = true
|
ij_php_space_after_colon_in_return_type = true
|
||||||
ij_php_space_before_else_keyword = true
|
ij_php_space_before_else_keyword = true
|
||||||
ij_php_for_statement_new_line_after_left_paren = true
|
ij_php_for_statement_new_line_after_left_paren = true
|
||||||
ij_php_class_brace_style = end_of_line
|
|
||||||
ij_php_comma_after_last_array_element = true
|
|
||||||
|
@ -39,15 +39,3 @@ e66c76133ec3ef667e382203426d91a4b4aa5174
|
|||||||
|
|
||||||
# Prettier autoformatting
|
# Prettier autoformatting
|
||||||
ab27eaee2df740c0add4331a7f8c115a87ecfa2b
|
ab27eaee2df740c0add4331a7f8c115a87ecfa2b
|
||||||
|
|
||||||
# Move email editor to JS packages folder
|
|
||||||
912282f57ccc839491ff951ec5cf7aa10c14f429
|
|
||||||
|
|
||||||
# Switch email editor js packages to WP coding style
|
|
||||||
b2fb96f8793b63db629d5237010d87332330c51e
|
|
||||||
|
|
||||||
# Email editor Prettier autoformatting
|
|
||||||
8c604453b1d82e3a2c731241e1c96ea8b32ec716
|
|
||||||
|
|
||||||
# Move email editor components out of the engine folder
|
|
||||||
1c3ea9cd0a5fc8848a64d840e2fa16a6c7d8c1fe
|
|
||||||
|
212
.github/workflows/email-editor-package.yml
vendored
212
.github/workflows/email-editor-package.yml
vendored
@ -1,212 +0,0 @@
|
|||||||
name: Email Editor Package Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
php-version: ['7.4', '8.2']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Cache Composer vendor dependencies for MailPoet
|
|
||||||
id: composer-mailpoet-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: mailpoet/vendor
|
|
||||||
key: ${{ runner.os }}-composer-mailpoet-${{ matrix.php-version }}-${{ hashFiles('mailpoet/composer.lock') }}-${{ hashFiles('mailpoet/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer vendor-prefixed dependencies for MailPoet
|
|
||||||
id: vendor-prefixed-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: mailpoet/vendor-prefixed
|
|
||||||
key: ${{ runner.os }}-vendor-prefixed-${{ matrix.php-version }}-${{ hashFiles('mailpoet/prefixer/composer.lock') }}-${{ hashFiles('mailpoet/prefixer/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer vendor for test environment
|
|
||||||
id: composer-tests-env-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: tests_env/vendor
|
|
||||||
key: ${{ runner.os }}-composer-mailpoet-${{ matrix.php-version }}-${{ hashFiles('tests_env/composer.lock') }}-${{ hashFiles('tests_env/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies for Email Editor
|
|
||||||
id: composer-email-editor-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: packages/php/email-editor/vendor
|
|
||||||
key: ${{ runner.os }}-composer-email-editor-${{ matrix.php-version }}-${{ hashFiles('packages/php/email-editor/composer.lock') }}-${{ hashFiles('packages/php/email-editor/composer.json') }}
|
|
||||||
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-version }}
|
|
||||||
extensions: gd
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
COMPOSER_DEV_MODE=1 php tools/install.php
|
|
||||||
touch .env
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
# Install Test Environment dependencies only if the cache was not hit
|
|
||||||
- name: Install test environment dependencies
|
|
||||||
if: steps.composer-tests-env-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ../mailpoet/tools/vendor/composer.phar install
|
|
||||||
working-directory: tests_env
|
|
||||||
|
|
||||||
# Install MailPoet dependencies only if the cache was not hit
|
|
||||||
- name: Install mailpoet dependencies
|
|
||||||
if: |
|
|
||||||
steps.composer-mailpoet-cache.outputs.cache-hit != 'true' || steps.vendor-prefixed-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ./tools/vendor/composer.phar install
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
# Install Email Editor dependencies only if the cache was not hit
|
|
||||||
- name: Install email-editor dependencies
|
|
||||||
if: steps.composer-email-editor-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar install
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
# Dump Email Editor autoload
|
|
||||||
# This is needed to refresh classmap autoload when the composer cache is hit
|
|
||||||
- name: Dump email-editor autoload
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar dump-autoload
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
# Dump MailPoet autoload
|
|
||||||
# This is needed to refresh classmap autoload when the composer cache is hit
|
|
||||||
- name: Dump MailPoet autoload
|
|
||||||
run: ./tools/vendor/composer.phar dump-autoload
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
# Run Email Editor unit tests
|
|
||||||
- name: Run email-editor package unit tests
|
|
||||||
run: ../../../tests_env/vendor/bin/codecept build && ../../../mailpoet/tools/vendor/composer.phar unit-test
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
- name: Run email-editor package integration tests
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar integration-test
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
code-style:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.2'
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
COMPOSER_DEV_MODE=1 php tools/install.php
|
|
||||||
touch .env
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
- name: Install composer dependencies
|
|
||||||
run: ../../tools/vendor/composer.phar install
|
|
||||||
working-directory: mailpoet/tasks/code_sniffer
|
|
||||||
|
|
||||||
- name: Run code style check
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar code-style
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
phpstan-static-analysis:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
php-version: ['7.4', '8.2']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Cache Composer vendor dependencies for MailPoet
|
|
||||||
id: composer-mailpoet-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: mailpoet/vendor
|
|
||||||
key: ${{ runner.os }}-composer-mailpoet-${{ matrix.php-version }}-${{ hashFiles('mailpoet/composer.lock') }}-${{ hashFiles('mailpoet/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer vendor-prefixed dependencies for MailPoet
|
|
||||||
id: vendor-prefixed-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: mailpoet/vendor-prefixed
|
|
||||||
key: ${{ runner.os }}-vendor-prefixed-${{ matrix.php-version }}-${{ hashFiles('mailpoet/prefixer/composer.lock') }}-${{ hashFiles('mailpoet/prefixer/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer vendor for test environment
|
|
||||||
id: composer-tests-env-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: tests_env/vendor
|
|
||||||
key: ${{ runner.os }}-composer-mailpoet-${{ matrix.php-version }}-${{ hashFiles('tests_env/composer.lock') }}-${{ hashFiles('tests_env/composer.json') }}
|
|
||||||
|
|
||||||
- name: Cache Composer dependencies for Email Editor
|
|
||||||
id: composer-email-editor-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: packages/php/email-editor/vendor
|
|
||||||
key: ${{ runner.os }}-composer-email-editor-${{ matrix.php-version }}-${{ hashFiles('packages/php/email-editor/composer.lock') }}-${{ hashFiles('packages/php/email-editor/composer.json') }}
|
|
||||||
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php-version }}
|
|
||||||
extensions: gd
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
COMPOSER_DEV_MODE=1 php tools/install.php
|
|
||||||
touch .env
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
# Install Test Environment dependencies only if the cache was not hit
|
|
||||||
- name: Install test environment dependencies
|
|
||||||
if: steps.composer-tests-env-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ../mailpoet/tools/vendor/composer.phar install
|
|
||||||
working-directory: tests_env
|
|
||||||
|
|
||||||
# Install MailPoet dependencies only if the cache was not hit
|
|
||||||
- name: Install mailpoet dependencies
|
|
||||||
if: |
|
|
||||||
steps.composer-mailpoet-cache.outputs.cache-hit != 'true' || steps.vendor-prefixed-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ./tools/vendor/composer.phar install
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
# Install Email Editor dependencies only if the cache was not hit
|
|
||||||
- name: Install email-editor dependencies
|
|
||||||
if: steps.composer-email-editor-cache.outputs.cache-hit != 'true'
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar install
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
- name: Install composer dependencies
|
|
||||||
run: ../../tools/vendor/composer.phar install
|
|
||||||
working-directory: mailpoet/tasks/phpstan
|
|
||||||
|
|
||||||
# Dump Email Editor autoload
|
|
||||||
# This is needed to refresh classmap autoload when the composer cache is hit
|
|
||||||
- name: Dump email-editor autoload
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar dump-autoload
|
|
||||||
working-directory: packages/php/email-editor
|
|
||||||
|
|
||||||
# Dump MailPoet autoload
|
|
||||||
# This is needed to refresh classmap autoload when the composer cache is hit
|
|
||||||
- name: Dump MailPoet autoload
|
|
||||||
run: ./tools/vendor/composer.phar dump-autoload
|
|
||||||
working-directory: mailpoet
|
|
||||||
|
|
||||||
- name: Run code phpstan
|
|
||||||
run: ../../../mailpoet/tools/vendor/composer.phar phpstan -- --php-version=${{ matrix.php-version == '7.4' && '70400' || '80200' }}
|
|
||||||
working-directory: packages/php/email-editor
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/helpers.php';
|
|
||||||
|
|
||||||
$repository = 'woocommerce/automatewoo';
|
|
||||||
$downloadCommand = 'download:automate-woo-zip';
|
|
||||||
$configParameterName = 'automate_woo_version';
|
|
||||||
$versionsFilenameSuffix = 'automate_woo_version.txt';
|
|
||||||
|
|
||||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/helpers.php';
|
|
||||||
|
|
||||||
$repository = 'woocommerce/woocommerce-memberships';
|
|
||||||
$downloadCommand = 'download:woo-commerce-memberships-zip';
|
|
||||||
$configParameterName = 'woo_memberships_version';
|
|
||||||
$versionsFilenameSuffix = 'woocommerce_memberships_version.txt';
|
|
||||||
|
|
||||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/helpers.php';
|
|
||||||
|
|
||||||
$repository = 'woocommerce/woocommerce-subscriptions';
|
|
||||||
$downloadCommand = 'download:woo-commerce-subscriptions-zip';
|
|
||||||
$configParameterName = 'woo_subscriptions_version';
|
|
||||||
$versionsFilenameSuffix = 'woocommerce_subscriptions_version.txt';
|
|
||||||
|
|
||||||
replacePrivatePluginVersion($repository, $downloadCommand, $configParameterName, $versionsFilenameSuffix);
|
|
@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/helpers.php';
|
|
||||||
|
|
||||||
$downloadCommand = 'download:woo-commerce-zip';
|
|
||||||
$configParameterName = 'woo_core_version';
|
|
||||||
$versionsFilenameSuffix = 'woocommerce_version.txt';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We get the official WooCommerce versions from the WordPress API.
|
|
||||||
*/
|
|
||||||
function getWooCommerceVersions(): array {
|
|
||||||
$url = "https://api.wordpress.org/plugins/info/1.0/woocommerce.json";
|
|
||||||
$response = file_get_contents($url);
|
|
||||||
$data = json_decode($response, true);
|
|
||||||
|
|
||||||
if (!isset($data['versions'])) {
|
|
||||||
die("Failed to fetch WooCommerce versions.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_keys($data['versions']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$allVersions = getWooCommerceVersions();
|
|
||||||
$stableVersions = filterStableVersions($allVersions);
|
|
||||||
[$latestVersion, $previousVersion] = getLatestAndPreviousMinorMajorVersions($stableVersions);
|
|
||||||
|
|
||||||
echo "Latest WooCommerce version: $latestVersion\n";
|
|
||||||
echo "Previous WooCommerce version: $previousVersion\n";
|
|
||||||
|
|
||||||
if ($latestVersion) {
|
|
||||||
echo "Replacing the latest version in the config file...\n";
|
|
||||||
replaceLatestVersion($latestVersion, $downloadCommand);
|
|
||||||
} else {
|
|
||||||
echo "No latest version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($previousVersion) {
|
|
||||||
echo "Replacing the previous version in the config file...\n";
|
|
||||||
replacePreviousVersion($previousVersion, $configParameterName);
|
|
||||||
} else {
|
|
||||||
echo "No previous version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
saveVersionsToFiles($latestVersion, $previousVersion, $versionsFilenameSuffix);
|
|
@ -1,123 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/helpers.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We try to get the current available official Docker images for WordPress.
|
|
||||||
*/
|
|
||||||
function getWordpressVersions(int $page = 1, int $pageSize = 100): array {
|
|
||||||
$url = "https://registry.hub.docker.com/v2/repositories/library/wordpress/tags?page_size={$pageSize}&page={$page}";
|
|
||||||
$response = file_get_contents($url);
|
|
||||||
$data = json_decode($response, true);
|
|
||||||
return array_column($data['results'], 'name');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We prefer the latest patch versions of WordPress with specified PHP versions.
|
|
||||||
* For example: 6.5.4-php8.3
|
|
||||||
*/
|
|
||||||
function filterVersions(array $versions): array {
|
|
||||||
return array_filter($versions, fn($version) => preg_match('/^\d+\.\d+\.\d+-php\d+\.\d+$/', $version));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We sort the versions by WordPress version and PHP version.
|
|
||||||
* The expected output is:
|
|
||||||
* - 6.5.4-php8.3
|
|
||||||
* - 6.5.4-php8.2
|
|
||||||
* - 6.5.3-php8.3
|
|
||||||
* - 6.5.3-php8.2
|
|
||||||
*/
|
|
||||||
function sortVersions(&$versions) {
|
|
||||||
usort($versions, function($a, $b) {
|
|
||||||
[$wpA, $phpA] = explode('-php', $a);
|
|
||||||
[$wpB, $phpB] = explode('-php', $b);
|
|
||||||
|
|
||||||
$wpCompare = version_compare($wpB, $wpA);
|
|
||||||
return $wpCompare !== 0 ? $wpCompare : version_compare($phpB, $phpA);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function group docker tags by the WordPress version and returns the latest with the higher PHP version
|
|
||||||
* abd the previous with the lower PHP version.
|
|
||||||
*/
|
|
||||||
function getLatestAndPreviousVersions(array $sortedVersions): array {
|
|
||||||
$uniqueVersions = [];
|
|
||||||
foreach ($sortedVersions as $version) {
|
|
||||||
[$wpVersion] = explode('-php', $version);
|
|
||||||
$majorMinorVersion = preg_replace('/\.\d+$/', '', $wpVersion);
|
|
||||||
$uniqueVersions[$majorMinorVersion][] = $version;
|
|
||||||
}
|
|
||||||
|
|
||||||
krsort($uniqueVersions);
|
|
||||||
$latestVersionGroup = reset($uniqueVersions);
|
|
||||||
$previousVersionGroup = next($uniqueVersions);
|
|
||||||
|
|
||||||
$latestVersion = $latestVersionGroup === false ? null : reset($latestVersionGroup);
|
|
||||||
$previousVersion = $previousVersionGroup === false ? null : end($previousVersionGroup);
|
|
||||||
|
|
||||||
return [$latestVersion, $previousVersion];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We specify the latest WordPress version only in the docker-compose file for the tests.
|
|
||||||
*/
|
|
||||||
function replaceLatestWordPressVersion(string $latestVersion): void {
|
|
||||||
replaceVersionInFile(
|
|
||||||
__DIR__ . './../../../tests_env/docker/docker-compose.yml',
|
|
||||||
'/(wordpress:\${WORDPRESS_IMAGE_VERSION:-\s*)\d+\.\d+\.?\d*-php\d+\.\d+(})/',
|
|
||||||
'${1}' . $latestVersion . '${2}'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We use the previous WordPress version only in the CircleCI config file.
|
|
||||||
*/
|
|
||||||
function replacePreviousWordPressVersion(string $previousVersion): void {
|
|
||||||
replaceVersionInFile(
|
|
||||||
__DIR__ . './../../../.circleci/config.yml',
|
|
||||||
'/(wordpress_version: )\d+\.\d+\.?\d*/',
|
|
||||||
'${1}' . $previousVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$allVersions = [];
|
|
||||||
$page = 1;
|
|
||||||
$maxPages = 8;
|
|
||||||
$latestVersion = null;
|
|
||||||
$previousVersion = null;
|
|
||||||
|
|
||||||
echo "Fetching WordPress versions...\n";
|
|
||||||
|
|
||||||
// We fetch the versions until we find the latest and previous versions. But there is a limit of 4 pages.
|
|
||||||
while (($latestVersion === null || $previousVersion === null) && $page <= $maxPages) {
|
|
||||||
echo "Fetching page $page...\n";
|
|
||||||
$versions = getWordpressVersions($page);
|
|
||||||
$allVersions = array_merge($allVersions, $versions);
|
|
||||||
$allVersions = filterVersions($allVersions);
|
|
||||||
sortVersions($allVersions);
|
|
||||||
[$latestVersion, $previousVersion] = getLatestAndPreviousVersions($allVersions);
|
|
||||||
$page++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Latest version: $latestVersion\n";
|
|
||||||
echo "Previous version: $previousVersion\n";
|
|
||||||
|
|
||||||
if ($latestVersion) {
|
|
||||||
echo "Replacing the latest version in the docker file...\n";
|
|
||||||
replaceLatestWordPressVersion($latestVersion);
|
|
||||||
} else {
|
|
||||||
echo "No latest version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($previousVersion) {
|
|
||||||
echo "Replacing the previous version in the config file...\n";
|
|
||||||
// We install previous WordPress version via CLI so we need a version without PHP in the name.
|
|
||||||
$previousVersion = preg_replace('/-php\d+\.\d+$/', '', $previousVersion);
|
|
||||||
replacePreviousWordPressVersion($previousVersion);
|
|
||||||
} else {
|
|
||||||
echo "No previous version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
saveVersionsToFiles($latestVersion, $previousVersion, 'wordpress_version.txt');
|
|
156
.github/workflows/scripts/helpers.php
vendored
156
.github/workflows/scripts/helpers.php
vendored
@ -1,156 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function replacing versions in a file by the regex pattern.
|
|
||||||
*/
|
|
||||||
function replaceVersionInFile(string $filePath, string $pattern, string $replacement): void {
|
|
||||||
$content = file_get_contents($filePath);
|
|
||||||
|
|
||||||
if ($content === false) {
|
|
||||||
die("Failed to read the file at $filePath.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$updatedContent = preg_replace($pattern, $replacement, $content);
|
|
||||||
|
|
||||||
if ($updatedContent === null || $updatedContent === $content) {
|
|
||||||
echo "Nothing to update in $filePath\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_put_contents($filePath, $updatedContent) === false) {
|
|
||||||
die("Failed to write the updated file at $filePath.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to filter stable versions from a list of versions.
|
|
||||||
*/
|
|
||||||
function filterStableVersions(array $versions): array {
|
|
||||||
return array_filter($versions, function($version) {
|
|
||||||
// Only include stable versions (exclude versions with -rc, -beta, -alpha, etc.)
|
|
||||||
return preg_match('/^\d+\.\d+\.\d+$/', $version);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get the latest and previous minor/major versions from a list of versions.
|
|
||||||
*/
|
|
||||||
function getLatestAndPreviousMinorMajorVersions(array $versions): array {
|
|
||||||
usort($versions, 'version_compare');
|
|
||||||
$currentVersion = end($versions);
|
|
||||||
|
|
||||||
$previousVersion = null;
|
|
||||||
foreach (array_reverse($versions) as $version) {
|
|
||||||
if (version_compare($version, $currentVersion, '<') && getMinorMajorVersion($version) !== getMinorMajorVersion($currentVersion)) {
|
|
||||||
$previousVersion = $version;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [$currentVersion, $previousVersion];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMinorMajorVersion(string $version): string {
|
|
||||||
$parts = explode('.', $version);
|
|
||||||
return $parts[0] . '.' . $parts[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to fetch tags from a GitHub repository.
|
|
||||||
*/
|
|
||||||
function fetchGitHubTags(string $repo, string $token, int $page = 1, int $limit = 50): array {
|
|
||||||
$url = "https://api.github.com/repos/$repo/tags?per_page=$limit&page=$page";
|
|
||||||
$ch = curl_init($url);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0'); // GitHub API requires a user agent
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
||||||
"Authorization: token $token"
|
|
||||||
]);
|
|
||||||
$response = curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
|
|
||||||
if ($response === false) {
|
|
||||||
die("Failed to fetch tags from GitHub.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode($response, true);
|
|
||||||
|
|
||||||
if (isset($data['message']) && $data['message'] == 'Not Found') {
|
|
||||||
die("Repository not found or access denied.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return array_column($data, 'name');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function saving versions to a temporary files.
|
|
||||||
* File containing latest version is prefixed with 'latest_' and previous version is prefixed with 'previous_'.
|
|
||||||
*/
|
|
||||||
function saveVersionsToFiles(?string $latestVersion, ?string $previousVersion, string $fileNameSuffix): void {
|
|
||||||
file_put_contents("/tmp/latest_{$fileNameSuffix}", $latestVersion);
|
|
||||||
file_put_contents("/tmp/previous_{$fileNameSuffix}", $previousVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceLatestVersion(string $latestVersion, string $downloadCommand): void {
|
|
||||||
replaceVersionInFile(
|
|
||||||
__DIR__ . '/../../../.circleci/config.yml',
|
|
||||||
'/(.\/do ' . $downloadCommand . ' )\d+\.\d+\.\d+/',
|
|
||||||
'${1}' . $latestVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function replacePreviousVersion(string $previousVersion, string $configParameterName): void {
|
|
||||||
replaceVersionInFile(
|
|
||||||
__DIR__ . '/../../../.circleci/config.yml',
|
|
||||||
'/(' . $configParameterName . ': )\d+\.\d+\.\d+/',
|
|
||||||
'${1}' . $previousVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function replacing the latest and previous versions of a private plugin in the config file.
|
|
||||||
* The function fetches the tags from the GitHub repository, filters stable versions,
|
|
||||||
* gets the latest and previous minor/major versions, and replaces the versions in the CircleCI config file.
|
|
||||||
*/
|
|
||||||
function replacePrivatePluginVersion(
|
|
||||||
string $repository,
|
|
||||||
string $downloadCommand,
|
|
||||||
string $configParameterName,
|
|
||||||
string $versionsFilename
|
|
||||||
): void {
|
|
||||||
// Read the GitHub token from environment variable
|
|
||||||
$token = getenv('GH_TOKEN');
|
|
||||||
if (!$token) {
|
|
||||||
die("GitHub token not found. Make sure it's set in the environment variable 'GH_TOKEN'.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = 1;
|
|
||||||
$latestVersion = null;
|
|
||||||
$previousVersion = null;
|
|
||||||
$allVersions = [];
|
|
||||||
while (($latestVersion === null || $previousVersion === null) && $page < 10) {
|
|
||||||
$allVersions = array_merge($allVersions, fetchGitHubTags($repository, $token, $page));
|
|
||||||
$stableVersions = filterStableVersions($allVersions);
|
|
||||||
[$latestVersion, $previousVersion] = getLatestAndPreviousMinorMajorVersions($stableVersions);
|
|
||||||
$page++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Latest version: $latestVersion\n";
|
|
||||||
echo "Previous version: $previousVersion\n";
|
|
||||||
|
|
||||||
if ($latestVersion) {
|
|
||||||
echo "Replacing the latest version in the config file...\n";
|
|
||||||
replaceLatestVersion($latestVersion, $downloadCommand);
|
|
||||||
} else {
|
|
||||||
echo "No latest version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($previousVersion) {
|
|
||||||
echo "Replacing the previous version in the config file...\n";
|
|
||||||
replacePreviousVersion($previousVersion, $configParameterName);
|
|
||||||
} else {
|
|
||||||
echo "No previous version found.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
saveVersionsToFiles($latestVersion, $previousVersion, $versionsFilename);
|
|
||||||
}
|
|
18
.github/workflows/stats.yml
vendored
Normal file
18
.github/workflows/stats.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: Pull Request Stats
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened]
|
||||||
|
branches-ignore:
|
||||||
|
- 'dependabot/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stats:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Run pull request stats
|
||||||
|
uses: flowwer-dev/pull-request-stats@master
|
||||||
|
with:
|
||||||
|
period: 90
|
||||||
|
charts: true
|
||||||
|
sort-by: 'TIME'
|
182
.github/workflows/update-wordpress-and-plugins.yml
vendored
182
.github/workflows/update-wordpress-and-plugins.yml
vendored
@ -1,182 +0,0 @@
|
|||||||
name: Check new versions of plugins and WordPress
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 6 * * 1' # At 06:00 on Monday
|
|
||||||
workflow_dispatch: # Allows manual triggering
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-versions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.3' # Specify the PHP version you want to use
|
|
||||||
|
|
||||||
# Updating used WordPress
|
|
||||||
- name: Check WordPress Docker Versions
|
|
||||||
run: php .github/workflows/scripts/check_wordpress_versions.php
|
|
||||||
|
|
||||||
- name: Check for WordPress changes
|
|
||||||
id: check_wp_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
if [ "$(git status --porcelain)" != "" ]; then
|
|
||||||
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
|
||||||
echo "WORDPRESS_CHANGES=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get WordPress versions from files
|
|
||||||
id: get_wp_versions
|
|
||||||
run: |
|
|
||||||
echo "WORDPRESS_LATEST_VERSION=$(cat /tmp/latest_wordpress_version.txt)" >> $GITHUB_ENV
|
|
||||||
echo "WORDPRESS_PREVIOUS_VERSION=$(cat /tmp/previous_wordpress_version.txt)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Commit WordPress changes
|
|
||||||
if: env.WORDPRESS_CHANGES == 'true'
|
|
||||||
run: |
|
|
||||||
git add .
|
|
||||||
git commit -m $'Update used WordPress images in Circle CI\n\n - latest version: ${{ env.WORDPRESS_LATEST_VERSION }}\n - previous version: ${{ env.WORDPRESS_PREVIOUS_VERSION }}'
|
|
||||||
|
|
||||||
# Updating used WooCommerce plugin
|
|
||||||
- name: Check WooCommerce Versions
|
|
||||||
run: php .github/workflows/scripts/check_woocommerce_versions.php
|
|
||||||
|
|
||||||
- name: Check for WooCommerce changes
|
|
||||||
id: check_wc_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
if [ "$(git status --porcelain)" != "" ]; then
|
|
||||||
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
|
||||||
echo "WOOCOMMERCE_CHANGES=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get WooCommerce versions from files
|
|
||||||
id: get_wc_versions
|
|
||||||
run: |
|
|
||||||
echo "WOOCOMMERCE_LATEST_VERSION=$(cat /tmp/latest_woocommerce_version.txt)" >> $GITHUB_ENV
|
|
||||||
echo "WOOCOMMERCE_PREVIOUS_VERSION=$(cat /tmp/previous_woocommerce_version.txt)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Commit WooCommerce changes
|
|
||||||
if: env.WOOCOMMERCE_CHANGES == 'true'
|
|
||||||
run: |
|
|
||||||
git add .
|
|
||||||
git commit -m $'Update used WooCommerce plugin in Circle CI\n\n - latest version: ${{ env.WOOCOMMERCE_LATEST_VERSION }}\n - previous version: ${{ env.WOOCOMMERCE_PREVIOUS_VERSION }}'
|
|
||||||
|
|
||||||
# Updating used Automate Woo plugin
|
|
||||||
- name: Check Automate Woo Versions
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
run: php .github/workflows/scripts/check_automate_woo_versions.php
|
|
||||||
|
|
||||||
- name: Check for Automate Woo changes
|
|
||||||
id: check_aw_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
if [ "$(git status --porcelain)" != "" ]; then
|
|
||||||
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
|
||||||
echo "AUTOMATE_WOO_CHANGES=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get Automate Woo versions from files
|
|
||||||
id: get_aw_versions
|
|
||||||
run: |
|
|
||||||
echo "AUTOMATE_WOO_LATEST_VERSION=$(cat /tmp/latest_automate_woo_version.txt)" >> $GITHUB_ENV
|
|
||||||
echo "AUTOMATE_WOO_PREVIOUS_VERSION=$(cat /tmp/previous_automate_woo_version.txt)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Commit Automate Woo changes
|
|
||||||
if: env.AUTOMATE_WOO_CHANGES == 'true'
|
|
||||||
run: |
|
|
||||||
git add .
|
|
||||||
git commit -m $'Update used Automate Woo plugin in Circle CI\n\n - latest version: ${{ env.AUTOMATE_WOO_LATEST_VERSION }}\n - previous version: ${{ env.AUTOMATE_WOO_PREVIOUS_VERSION }}'
|
|
||||||
|
|
||||||
# Updating used WooCommerce Subscriptions plugin
|
|
||||||
- name: Check WooCommerce Subscriptions Versions
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
run: php .github/workflows/scripts/check_woocommerce_subscriptions_versions.php
|
|
||||||
|
|
||||||
- name: Check for WooCommerce Subscriptions changes
|
|
||||||
id: check_ws_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
if [ "$(git status --porcelain)" != "" ]; then
|
|
||||||
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
|
||||||
echo "SUBSCRIPTIONS_CHANGES=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get WooCommerce Subscriptions versions from files
|
|
||||||
id: get_ws_versions
|
|
||||||
run: |
|
|
||||||
echo "WOOCOMMERCE_SUBSCRIPTIONS_LATEST_VERSION=$(cat /tmp/latest_woocommerce_subscriptions_version.txt)" >> $GITHUB_ENV
|
|
||||||
echo "WOOCOMMERCE_SUBSCRIPTIONS_PREVIOUS_VERSION=$(cat /tmp/previous_woocommerce_subscriptions_version.txt)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Commit WooCommerce Subscriptions changes
|
|
||||||
if: env.SUBSCRIPTIONS_CHANGES == 'true'
|
|
||||||
run: |
|
|
||||||
git add .
|
|
||||||
git commit -m $'Update used WooCommerce Subscriptions plugin in Circle CI\n\n - latest version: ${{ env.WOOCOMMERCE_SUBSCRIPTIONS_LATEST_VERSION }}\n - previous version: ${{ env.WOOCOMMERCE_SUBSCRIPTIONS_PREVIOUS_VERSION }}'
|
|
||||||
|
|
||||||
# Updating used WooCommerce Memberships plugin
|
|
||||||
- name: Check WooCommerce Memberships Versions
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
run: php .github/workflows/scripts/check_woocommerce_memberships_versions.php
|
|
||||||
|
|
||||||
- name: Check for WooCommerce Memberships changes
|
|
||||||
id: check_wm_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions[bot]'
|
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
||||||
if [ "$(git status --porcelain)" != "" ]; then
|
|
||||||
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
|
||||||
echo "MEMBERSHIPS_CHANGES=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get WooCommerce Memberships versions from files
|
|
||||||
id: get_wm_versions
|
|
||||||
run: |
|
|
||||||
echo "WOOCOMMERCE_MEMBERSHIPS_LATEST_VERSION=$(cat /tmp/latest_woocommerce_memberships_version.txt)" >> $GITHUB_ENV
|
|
||||||
echo "WOOCOMMERCE_MEMBERSHIPS_PREVIOUS_VERSION=$(cat /tmp/previous_woocommerce_memberships_version.txt)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Commit WooCommerce Memberships changes
|
|
||||||
if: env.MEMBERSHIPS_CHANGES == 'true'
|
|
||||||
run: |
|
|
||||||
git add .
|
|
||||||
git commit -m $'Update used WooCommerce Memberships plugin in Circle CI\n\n - latest version: ${{ env.WOOCOMMERCE_MEMBERSHIPS_LATEST_VERSION }}\n - previous version: ${{ env.WOOCOMMERCE_MEMBERSHIPS_PREVIOUS_VERSION }}'
|
|
||||||
|
|
||||||
# Push all changes at the end if any changes were detected
|
|
||||||
#
|
|
||||||
# For local testing with act tool add following:
|
|
||||||
# env:
|
|
||||||
# GH_PAT: ${{ secrets.GH_TOKEN }}
|
|
||||||
# run: |
|
|
||||||
# git remote set-url origin https://${GH_PAT}@github.com/mailpoet/mailpoet
|
|
||||||
# git push -f origin HEAD:refs/heads/update-plugins-and-wordpress-test
|
|
||||||
- name: Push changes
|
|
||||||
if: env.CHANGES_DETECTED == 'true'
|
|
||||||
run: |
|
|
||||||
git push -f origin HEAD:refs/heads/update-plugins-and-wordpress
|
|
||||||
|
|
||||||
# Create a pull request if there are changes
|
|
||||||
- name: Create Pull Request
|
|
||||||
if: env.CHANGES_DETECTED == 'true'
|
|
||||||
uses: peter-evans/create-pull-request@v6
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
|
||||||
branch: update-plugins-and-wordpress
|
|
||||||
title: Update WordPress and plugins in CI jobs
|
|
||||||
base: trunk
|
|
||||||
labels: automated, check-versions
|
|
||||||
body: |
|
|
||||||
1. If all checks passed, you can merge this PR.
|
|
||||||
2. If the build failed, please investigate the failure and either address the issues or delegate the job. Then, make sure these changes are merged.
|
|
@ -1,27 +0,0 @@
|
|||||||
name: Add link to WordPress Playground preview
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, reopened, synchronize]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
add-wp-playground-link:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Check and append description
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
PR_NUMBER="${{ github.event.pull_request.number }}"
|
|
||||||
BRANCH_NAME="${{ github.head_ref }}"
|
|
||||||
DESCRIPTION="$(gh pr view $PR_NUMBER --json body -q .body)"
|
|
||||||
HEADING="## Preview"
|
|
||||||
CONTENT="$(printf "${HEADING}\n\n[Preview in WordPress Playground](https://account.mailpoet.com/playground/new/branch:${BRANCH_NAME})\n\n_The latest successful build from \`${BRANCH_NAME}\` will be used. If none is available, the link won't work._")"
|
|
||||||
|
|
||||||
if [[ "$DESCRIPTION" != *"$HEADING"* ]]; then
|
|
||||||
gh pr edit $PR_NUMBER --body "$(printf "${DESCRIPTION}\n\n${CONTENT}")"
|
|
||||||
fi
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,5 +9,3 @@ npm-debug.log
|
|||||||
mailpoet-premium
|
mailpoet-premium
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
/wordpress
|
/wordpress
|
||||||
packages/php/*/vendor
|
|
||||||
tests_env/vendor
|
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
. "$(dirname "$0")/../mailpoet/.env"
|
|
||||||
|
|
||||||
export MP_GIT_HOOKS_ENABLE="${MP_GIT_HOOKS_ENABLE:-true}"
|
|
||||||
export MP_GIT_HOOKS_ESLINT="${MP_GIT_HOOKS_ESLINT:-true}"
|
|
||||||
export MP_GIT_HOOKS_STYLELINT="${MP_GIT_HOOKS_STYLELINT:-true}"
|
|
||||||
export MP_GIT_HOOKS_PHPLINT="${MP_GIT_HOOKS_PHPLINT:-true}"
|
|
||||||
export MP_GIT_HOOKS_CODE_SNIFFER="${MP_GIT_HOOKS_CODE_SNIFFER:-true}"
|
|
||||||
export MP_GIT_HOOKS_PHPSTAN="${MP_GIT_HOOKS_PHPSTAN:-true}"
|
|
||||||
export MP_GIT_HOOKS_INSTALL_JS="${MP_GIT_HOOKS_INSTALL_JS:-false}"
|
|
||||||
export MP_GIT_HOOKS_INSTALL_PHP="${MP_GIT_HOOKS_INSTALL_PHP:-false}"
|
|
||||||
|
|
||||||
fileChanged() {
|
|
||||||
local filePattern="$1"
|
|
||||||
local changedFiles="$2"
|
|
||||||
if echo "$changedFiles" | grep -qE "$filePattern"; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installIfUpdates() {
|
|
||||||
local changedFiles="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)"
|
|
||||||
|
|
||||||
if [ "$MP_GIT_HOOKS_INSTALL_JS" = "true" ] && fileChanged "pnpm-lock.yaml" "$changedFiles"; then
|
|
||||||
echo "Change detected in pnpm-lock.yaml, running do install:js"
|
|
||||||
pushd mailpoet
|
|
||||||
./do install:js
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$MP_GIT_HOOKS_INSTALL_PHP" = "true" ] && fileChanged "mailpoet/composer.lock" "$changedFiles"; then
|
|
||||||
echo "Change detected in mailpoet/composer.lock, running do install:php"
|
|
||||||
pushd mailpoet
|
|
||||||
./do install:php
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
. "$(dirname "$0")/common.sh"
|
|
||||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
|
||||||
|
|
||||||
installIfUpdates
|
|
||||||
|
|
||||||
./do cleanup:cached-files
|
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
. "$(dirname "$0")/common.sh"
|
|
||||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
|
||||||
|
|
||||||
|
|
||||||
installIfUpdates
|
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
. "$(dirname "$0")/common.sh"
|
|
||||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
|
||||||
|
|
||||||
|
|
||||||
installIfUpdates
|
|
@ -1,8 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/common.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
|
||||||
|
|
||||||
npx lint-staged -c mailpoet/package.json --cwd mailpoet
|
npx lint-staged -c mailpoet/package.json --cwd mailpoet
|
||||||
npx lint-staged -c package.json
|
npx lint-staged -c package.json
|
||||||
npx lint-staged -c packages/js/email-editor/package.json --cwd packages/js/email-editor
|
|
||||||
npx lint-staged -c packages/php/email-editor/.lintstagedrc.json --cwd packages/php/email-editor
|
|
||||||
|
@ -25,5 +25,3 @@ vendor-prefixed
|
|||||||
/mailpoet/views
|
/mailpoet/views
|
||||||
/mailpoet-premium
|
/mailpoet-premium
|
||||||
/wordpress
|
/wordpress
|
||||||
/packages/php/email-editor
|
|
||||||
/packages/js/email-editor
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
clone:
|
|
||||||
git:
|
|
||||||
image: woodpeckerci/plugin-git
|
|
||||||
settings:
|
|
||||||
depth: 1
|
|
||||||
|
|
||||||
steps:
|
|
||||||
build:
|
|
||||||
image: node:current-bookworm-slim
|
|
||||||
commands:
|
|
||||||
- apt update
|
|
||||||
- apt install php php-symfony bash -y
|
|
||||||
- npm install pnpm
|
|
||||||
- cd mailpoet
|
|
||||||
- bash build.sh
|
|
||||||
- mkdir ../output
|
|
||||||
- mv mailpoet.zip ../output
|
|
||||||
- cd ..
|
|
||||||
|
|
||||||
release:
|
|
||||||
image: woodpeckerci/plugin-gitea-release:latest
|
|
||||||
settings:
|
|
||||||
base_url: https://git.cavemanon.xyz
|
|
||||||
api_key:
|
|
||||||
from_secret: releasesmithapikey
|
|
||||||
files: "output/"
|
|
||||||
prerelease: false
|
|
||||||
title: "${CI_COMMIT_TAG}"
|
|
||||||
when:
|
|
||||||
- event: tag
|
|
@ -1,51 +1,56 @@
|
|||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
There is a `./do` command that helps with the development process. See [README](README.md) for more details.
|
|
||||||
|
|
||||||
## PHP Code
|
## PHP Code
|
||||||
|
|
||||||
- Two spaces indentation.
|
- Two spaces indentation.
|
||||||
- Space between keyword and left bracket (`if ()`, `for ()`, `switch ()`...).
|
- Space between keyword (if, for, switch...) and left bracket
|
||||||
- `CamelCase` for classes.
|
- CamelCase for classes.
|
||||||
- `camelCase` for methods.
|
- camelCase for methods.
|
||||||
- `snake_case` for variables and class properties.
|
- snake_case for variables and class properties.
|
||||||
- Composition over Inheritance.
|
- Composition over Inheritance.
|
||||||
- Comments are a code smell. If you need to use a comment - see if same idea can be achieved by more clearly expressing code.
|
- Comments are a code smell. If you need to use a comment - see if same idea can be achieved by more clearly expressing code.
|
||||||
- Require other classes with `use` at the beginning of the class file.
|
- Require other classes with 'use' at the beginning of the class file.
|
||||||
|
- Do not specify 'public' if method is public, it's implicit.
|
||||||
- Always use guard clauses.
|
- Always use guard clauses.
|
||||||
- Ensure compatibility with PHP 7.4 and newer versions.
|
- Ensure compatibility with PHP 7.1 and newer versions.
|
||||||
- Cover your code in tests.
|
- Cover your code in tests.
|
||||||
|
|
||||||
## SCSS Code
|
## SCSS Code
|
||||||
|
|
||||||
- `kebab-case` for file names.
|
- camelCase for file name
|
||||||
- Components files are prefixed with underscore, to indicate, that they aren't compiled separately (`_new-component.scss`).
|
- Components files are prefixed with underscore, to indicate, that they aren't compiled separately.
|
||||||
|
|
||||||
## JS Code
|
## JS Code
|
||||||
|
|
||||||
- Javascript code should follow the [Airbnb style guide](https://github.com/airbnb/javascript).
|
- Javascript code should follow the [Airbnb style guide](https://github.com/airbnb/javascript).
|
||||||
- Prefer named export before default export in JS and TS files
|
- Prefer named export before default export in JS and TS files
|
||||||
- Default to TypeScript for new files.
|
|
||||||
|
|
||||||
## Disabling linting rules
|
## Disabling linting rules
|
||||||
|
|
||||||
- We want to avoid using `eslint-disable`
|
- we want to avoid using `eslint-disable`
|
||||||
- If we have to use it we need to use a comment explaining why do we need it:
|
- if we have to use it we need to use a comment explaining why do we need it:
|
||||||
`/* eslint-disable no-new -- this class has a side-effect in the constructor and it's a library's. */`
|
`/* eslint-disable no-new -- this class has a side-effect in the constructor and it's a library's. */`
|
||||||
- For PHP we do the same with the exception `// phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps` which for now doesn’t require an explanation
|
- for PHP we do the same with the exception `// phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps` which for now doesn’t require an explanation
|
||||||
|
|
||||||
## Git flow
|
## Git flow
|
||||||
|
|
||||||
- Do not commit to trunk.
|
- Do not commit to trunk.
|
||||||
- Open a short-living feature branch.
|
- Open a short-living feature branch.
|
||||||
- Use good commit messages as explained here https://chris.beams.io/posts/git-commit. Include Jira ticket in the commit message.
|
- Open a pull request.
|
||||||
|
- Add Jira issue reference in the title of the Pull Request.
|
||||||
|
- Work on the pull request.
|
||||||
- Use the `./do qa` command to check your code style before pushing.
|
- Use the `./do qa` command to check your code style before pushing.
|
||||||
- Create a pull request when finished. Include Jira ticket in the title of the pull request.
|
- Use good commit messages as explained here https://chris.beams.io/posts/git-commit
|
||||||
- Wait for review from another developer.
|
- Wait for review from another developer.
|
||||||
|
|
||||||
## Feature flags
|
## Issues creation
|
||||||
|
|
||||||
We use feature flags to control the visibility of new features. This allows us to work on new features in smaller chunks before they are released to all customers.
|
- Issues are managed on Jira.
|
||||||
|
- Discuss issues on public Slack chats, discuss code in pull requests.
|
||||||
|
- Open a small Jira issue only when it has been discussed.
|
||||||
|
|
||||||
- Feature flags can be enabled on the experimental page: `/admin.php?page=mailpoet-experimental`.
|
## Migration from IdiORM to Doctrine
|
||||||
- New feature flags can be added in the class `FeaturesController`.
|
|
||||||
|
MailPoet used to use [IdiORM](https://github.com/j4mie/idiorm) as its object-relational mapper (ORM), but the project was abandoned a while ago, so we started a migration to [Doctrine](https://www.doctrine-project.org/). This is a significant effort that has been going on for quite some time. Although you will still see parts of the code that use IdioORM, we ask that all new code be added using Doctrine instead.
|
||||||
|
|
||||||
|
All IdioORM models live in [mailpoet/lib/Models](https://github.com/mailpoet/mailpoet/tree/trunk/mailpoet/lib/Models), should be considered deprecated and shouldn't be used by new code. We are moving everything to Doctrine entities and some auxiliary code when needed. You can find Doctrine entities in [mailpoet/lib/Entities](https://github.com/mailpoet/mailpoet/tree/trunk/mailpoet/lib/Entities).
|
||||||
|
102
README.md
102
README.md
@ -1,41 +1,20 @@
|
|||||||
### Table of Contents
|
# MailPoet
|
||||||
|
|
||||||
1. [MailPoet](#mailpoet)
|
|
||||||
2. [Initial setup](#initial-setup)
|
|
||||||
1. [Additional dependencies](#additional-dependencies)
|
|
||||||
3. [Xdebug](#xdebug)
|
|
||||||
1. [PhpStorm setup](#phpstorm-setup)
|
|
||||||
2. [Xdebug develop mode](#xdebug-develop-mode)
|
|
||||||
3. [Xdebug for integration tests](#xdebug-for-integration-tests)
|
|
||||||
4. [Local development](#local-development)
|
|
||||||
1. [NFS volume sharing for Mac](#nfs-volume-sharing-for-mac)
|
|
||||||
2. [Husky hooks](#husky-hooks)
|
|
||||||
5. [Docker](#docker)
|
|
||||||
1. [Commands](#commands)
|
|
||||||
2. [Available PHP versions](#available-php-versions)
|
|
||||||
3. [Disabling the Tracy panel](#disabling-the-tracy-panel)
|
|
||||||
4. [Running individual tests](#running-individual-tests)
|
|
||||||
6. [TODO](#todo)
|
|
||||||
|
|
||||||
## MailPoet
|
|
||||||
|
|
||||||
The **MailPoet** plugin monorepo.
|
The **MailPoet** plugin monorepo.
|
||||||
|
|
||||||
If you have **any questions or need help or support**, please see the [Support](SUPPORT.md) document.
|
|
||||||
|
|
||||||
To use our Docker-based development environment (recommended), continue with the steps below.
|
To use our Docker-based development environment (recommended), continue with the steps below.
|
||||||
If you'd like to use the plugin code directly, see details in [the plugin's readme](mailpoet/README.md).
|
If you'd like to use the plugin code directly, see details in [the plugin's readme](mailpoet/README.md).
|
||||||
|
|
||||||
## Initial setup
|
## 🔌 Initial setup
|
||||||
|
|
||||||
1. Run `./do setup` to pull everything and install necessary dependencies.
|
1. Run `./do setup` to pull everything and install necessary dependencies.
|
||||||
2. Add secrets to `.env` files in `mailpoet` and `mailpoet-premium` directories. Go to the Secret Store and look for "MailPoet: plugin .env"
|
2. Add secrets to `.env` files in `mailpoet` and `mailpoet-premium` directories. Go to the Secret Store and look for "MailPoet: plugin .env"
|
||||||
3. Run `./do start` to start the stack.
|
3. Run `./do start` to start the stack.
|
||||||
4. Go to http://localhost:8888 to see the dashboard of the dev environment.
|
4. Go to http://localhost:8888 to see the dashboard of the dev environment.
|
||||||
|
|
||||||
### Additional dependencies
|
## ✅ Additional dependencies
|
||||||
|
|
||||||
Even though it's possible to run everything using Docker, in the development workflow,
|
Even though it possible to run everything using Docker, in the development workflow,
|
||||||
it may be faster and more convenient to run some tasks outside the container. Therefore,
|
it may be faster and more convenient to run some tasks outside the container. Therefore,
|
||||||
the following tools are recommended:
|
the following tools are recommended:
|
||||||
|
|
||||||
@ -43,9 +22,7 @@ the following tools are recommended:
|
|||||||
2. **Node.js**, as specified by `.nvmrc`. For automatic management use [nvm](https://github.com/nvm-sh/nvm), [FNM](https://github.com/Schniz/fnm), or [Volta](https://github.com/volta-cli/volta).
|
2. **Node.js**, as specified by `.nvmrc`. For automatic management use [nvm](https://github.com/nvm-sh/nvm), [FNM](https://github.com/Schniz/fnm), or [Volta](https://github.com/volta-cli/volta).
|
||||||
3. **pnpm**, as specified in `package.json`. For automatic setup enable [Corepack](https://nodejs.org/docs/latest-v17.x/api/corepack.html) using `corepack enable`.
|
3. **pnpm**, as specified in `package.json`. For automatic setup enable [Corepack](https://nodejs.org/docs/latest-v17.x/api/corepack.html) using `corepack enable`.
|
||||||
|
|
||||||
## Xdebug
|
## 🔍 PHPStorm setup for XDebug
|
||||||
|
|
||||||
### PhpStorm setup
|
|
||||||
|
|
||||||
In `Languages & Preferences > PHP > Servers` set path mappings:
|
In `Languages & Preferences > PHP > Servers` set path mappings:
|
||||||
|
|
||||||
@ -62,7 +39,7 @@ To use XDebug inside the **cron**, you need to pass a URL argument `&XDEBUG_TRIG
|
|||||||
[in the cron request](https://github.com/mailpoet/mailpoet/blob/bf7bd6d2d9090ed6ec7b8b575bb7d6b08e663a52/lib/Cron/CronHelper.php#L155-L166).
|
[in the cron request](https://github.com/mailpoet/mailpoet/blob/bf7bd6d2d9090ed6ec7b8b575bb7d6b08e663a52/lib/Cron/CronHelper.php#L155-L166).
|
||||||
Alternatively, you can add `XDEBUG_TRIGGER: yes` to the `wordpress` service in `docker-compose.yml` and restart it (which will run XDebug also for all other requests).
|
Alternatively, you can add `XDEBUG_TRIGGER: yes` to the `wordpress` service in `docker-compose.yml` and restart it (which will run XDebug also for all other requests).
|
||||||
|
|
||||||
### Xdebug develop mode
|
## Xdebug develop mode
|
||||||
|
|
||||||
[Xdebug develop mode](https://xdebug.org/docs/develop) is disabled by default because it causes performance issues due to conflicts with the DI container.
|
[Xdebug develop mode](https://xdebug.org/docs/develop) is disabled by default because it causes performance issues due to conflicts with the DI container.
|
||||||
|
|
||||||
@ -73,7 +50,7 @@ environment:
|
|||||||
XDEBUG_MODE: debug, develop
|
XDEBUG_MODE: debug, develop
|
||||||
```
|
```
|
||||||
|
|
||||||
### Xdebug for integration tests
|
## Xdebug for integration tests
|
||||||
|
|
||||||
- In Languages & Preferences > PHP > Servers create a new sever named `MailPoetTest`, set the host to `localhost` and port to `80` and set following path mappings:
|
- In Languages & Preferences > PHP > Servers create a new sever named `MailPoetTest`, set the host to `localhost` and port to `80` and set following path mappings:
|
||||||
|
|
||||||
@ -85,12 +62,10 @@ mailpoet/vendor/bin/codecept -> /project/vendor/bin/codecept
|
|||||||
mailpoet/vendor/bin/wp -> /usr/local/bin/wp
|
mailpoet/vendor/bin/wp -> /usr/local/bin/wp
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add `XDEBUG_TRIGGER: 1` environment to `tests_env/docker/docker-compose.yml` -> codeception service to start triggering Xdebug
|
- Add `XDEBUG_TRIGGER: 1` environment to `mailpoet/tests/docker/docker-compose.yml` -> codeception service to start triggering Xdebug
|
||||||
- Make PHPStorm listen to connections by clicking on the phone icon
|
- Make PHPStorm listen to connections by clicking on the phone icon
|
||||||
|
|
||||||
## Local development
|
## 💾 NFS volume sharing for Mac
|
||||||
|
|
||||||
### NFS volume sharing for Mac
|
|
||||||
|
|
||||||
NFS volumes can bring more stability and performance on Docker for Mac. To setup NFS volume sharing run:
|
NFS volumes can bring more stability and performance on Docker for Mac. To setup NFS volume sharing run:
|
||||||
|
|
||||||
@ -103,14 +78,14 @@ Then create a Docker Compose override file with NFS settings and restart contain
|
|||||||
```shell
|
```shell
|
||||||
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
||||||
|
|
||||||
docker compose down -v --remove-orphans
|
docker-compose down -v --remove-orphans
|
||||||
docker compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** If you are on MacOS Catalina or newer, make sure to put the repository
|
**NOTE:** If you are on MacOS Catalina or newer, make sure to put the repository
|
||||||
outside your `Documents` folder, otherwise you may run into [file permission issues](https://objekt.click/2019/11/docker-the-problem-with-macos-catalina/).
|
outside your `Documents` folder, otherwise you may run into [file permission issues](https://objekt.click/2019/11/docker-the-problem-with-macos-catalina/).
|
||||||
|
|
||||||
### Husky hooks
|
# 🐶 Husky
|
||||||
|
|
||||||
We use [Husky](https://github.com/typicode/husky) to run automated checks in pre-commit hooks.
|
We use [Husky](https://github.com/typicode/husky) to run automated checks in pre-commit hooks.
|
||||||
|
|
||||||
@ -125,9 +100,7 @@ export NVM_DIR="$HOME/.nvm"
|
|||||||
|
|
||||||
Without it, you may experience errors in some Git clients.
|
Without it, you may experience errors in some Git clients.
|
||||||
|
|
||||||
## Docker
|
## 🕹 Commands
|
||||||
|
|
||||||
### Commands
|
|
||||||
|
|
||||||
The `./do` script define aliases for most of the commands you will need while working on plugins:
|
The `./do` script define aliases for most of the commands you will need while working on plugins:
|
||||||
|
|
||||||
@ -149,7 +122,11 @@ Options:
|
|||||||
|
|
||||||
You can access this help in your command line running `./do` without parameters.
|
You can access this help in your command line running `./do` without parameters.
|
||||||
|
|
||||||
### Available PHP versions
|
## ✉️ Adding new templates to the plugin
|
||||||
|
|
||||||
|
[Read the article.](https://mailpoet.atlassian.net/wiki/spaces/MAILPOET/pages/629374977/Adding+new+templates+to+the+plugin)
|
||||||
|
|
||||||
|
## 🚥 Testing with different PHP versions
|
||||||
|
|
||||||
To switch the environment to a different PHP version:
|
To switch the environment to a different PHP version:
|
||||||
|
|
||||||
@ -163,13 +140,13 @@ To switch the environment to a different PHP version:
|
|||||||
dockerfile: dev/{PHP_VERSION}/Dockerfile
|
dockerfile: dev/{PHP_VERSION}/Dockerfile
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run `docker compose build wordpress`.
|
3. Run `docker-compose build wordpress`.
|
||||||
4. Start the stack with `./do start`.
|
4. Start the stack with `./do start`.
|
||||||
|
|
||||||
To switch back to the default PHP version remove what was added in 2) and, run `docker compose build wordpress` for application container and `docker compose build test_wordpress` for tests container,
|
To switch back to the default PHP version remove what was added in 2) and, run `docker-compose build wordpress` for application container and `docker-compose build test_wordpress` for tests container,
|
||||||
and start the stack using `./do start`.
|
and start the stack using `./do start`.
|
||||||
|
|
||||||
### Disabling the Tracy panel
|
## Disabling the Tracy panel
|
||||||
|
|
||||||
To disable the Tracy panel, add the following to `docker-compose.override.yml`:
|
To disable the Tracy panel, add the following to `docker-compose.override.yml`:
|
||||||
|
|
||||||
@ -180,39 +157,6 @@ services:
|
|||||||
MAILPOET_DISABLE_TRACY_PANEL: 1
|
MAILPOET_DISABLE_TRACY_PANEL: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running individual tests
|
## ✅ TODO
|
||||||
|
|
||||||
It's recommended to run tests in Docker. Free plugin tests can be run using --test flag (`./do --test`). However, to run a premium test, you need to ssh into test container (`./do ssh --test`) and run tests there.
|
- install woo commerce, members and other useful plugins by default
|
||||||
|
|
||||||
#### Integration test in the free plugin
|
|
||||||
|
|
||||||
```shell
|
|
||||||
./do --test test:integration --skip-deps --file=tests/integration/WP/EmojiTest.php
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Acceptance test in the free plugin
|
|
||||||
|
|
||||||
```shell
|
|
||||||
./do --test test:acceptance --skip-deps --file=tests/acceptance/Misc/MailpoetMenuCest.php
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Unit/integration test in the premium plugin
|
|
||||||
|
|
||||||
```shell
|
|
||||||
./do ssh --test # to enter the container
|
|
||||||
cd ../mailpoet-premium # switch to premium plugin directory
|
|
||||||
./do test:unit --file=tests/unit/Config/EnvTest.php
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Acceptance test in the premium plugin
|
|
||||||
|
|
||||||
```shell
|
|
||||||
cd ./mailpoet-premium # switch to premium plugin directory on your local machine
|
|
||||||
./do test:acceptance --skip-deps --file tests/acceptance/PremiumCheckCest.php
|
|
||||||
```
|
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
- [ ] Install WooCommerce
|
|
||||||
- [ ] Install Members
|
|
||||||
- [ ] Install other useful plugins by default
|
|
||||||
|
24
SUPPORT.md
24
SUPPORT.md
@ -1,5 +1,23 @@
|
|||||||
# Support
|
# Getting Support
|
||||||
|
|
||||||
Please visit our [Support](https://www.mailpoet.com/support/) page. We have a team of Happiness Engineers ready to help you.
|
Welcome to MailPoet!
|
||||||
|
This isn't the right place to get support for using MailPoet,
|
||||||
|
but the following resources are available below,
|
||||||
|
thanks for understanding.
|
||||||
|
|
||||||
For feature requests, please use our [tracker](https://feedback.mailpoet.com).
|
- [Support](https://www.mailpoet.com/support)
|
||||||
|
- [Feature Requests](https://feedback.mailpoet.com)
|
||||||
|
|
||||||
|
_DO NOT_ use the issue tracker to ask questions;
|
||||||
|
use the links above for that.
|
||||||
|
Questions posed to the issue tracker will be closed.
|
||||||
|
|
||||||
|
When reporting an issue, please include the following details:
|
||||||
|
|
||||||
|
- A narrative description of what you are trying to accomplish.
|
||||||
|
- The expected results.
|
||||||
|
- The actual results received.
|
||||||
|
- We may ask for additional details: what version of the plugin you are using, and what PHP version
|
||||||
|
was used to reproduce the issue.
|
||||||
|
|
||||||
|
You may also submit a failing test case as a pull request.
|
||||||
|
@ -21,7 +21,7 @@ mkdir -p wordpress/wp-content/plugins/mailpoet-premium
|
|||||||
mkdir -p dev/data/mailhog
|
mkdir -p dev/data/mailhog
|
||||||
|
|
||||||
for plugin in "mailpoet" "mailpoet-premium"; do
|
for plugin in "mailpoet" "mailpoet-premium"; do
|
||||||
docker compose run --rm wordpress /bin/sh -c "
|
docker-compose run --rm wordpress /bin/sh -c "
|
||||||
[ -d /var/www/html/wp-content/plugins/$plugin ] &&
|
[ -d /var/www/html/wp-content/plugins/$plugin ] &&
|
||||||
cd /var/www/html/wp-content/plugins/$plugin &&
|
cd /var/www/html/wp-content/plugins/$plugin &&
|
||||||
./do install &&
|
./do install &&
|
||||||
@ -29,7 +29,7 @@ for plugin in "mailpoet" "mailpoet-premium"; do
|
|||||||
"
|
"
|
||||||
done
|
done
|
||||||
|
|
||||||
docker compose run --rm wordpress /bin/sh -c "
|
docker-compose run --rm wordpress /bin/sh -c "
|
||||||
cd /var/www/templates &&
|
cd /var/www/templates &&
|
||||||
mkdir assets classes exported
|
mkdir assets classes exported
|
||||||
"
|
"
|
||||||
|
@ -29,6 +29,6 @@ cat <<EOT
|
|||||||
NFS volume sharing is set up. Recreate your containers and volumes using:
|
NFS volume sharing is set up. Recreate your containers and volumes using:
|
||||||
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
||||||
|
|
||||||
docker compose down -v --remove-orphans
|
docker-compose down -v --remove-orphans
|
||||||
docker compose up -d
|
docker-compose up -d
|
||||||
EOT
|
EOT
|
||||||
|
@ -27,7 +27,7 @@ RUN printf "account default\nhost smtp\nport 1025" > /etc/msmtprc
|
|||||||
|
|
||||||
# xdebug build an config
|
# xdebug build an config
|
||||||
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
||||||
RUN git clone -b "3.3.1" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
RUN git clone -b "3.0.2" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
||||||
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
||||||
&& docker-php-ext-install xdebug \
|
&& docker-php-ext-install xdebug \
|
||||||
&& mkdir /tmp/debug
|
&& mkdir /tmp/debug
|
||||||
|
@ -27,7 +27,7 @@ RUN printf "account default\nhost smtp\nport 1025" > /etc/msmtprc
|
|||||||
|
|
||||||
# xdebug build an config
|
# xdebug build an config
|
||||||
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
||||||
RUN git clone -b "3.3.1" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
RUN git clone -b "3.1.1" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
||||||
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
||||||
&& docker-php-ext-install xdebug \
|
&& docker-php-ext-install xdebug \
|
||||||
&& mkdir /tmp/debug
|
&& mkdir /tmp/debug
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM wordpress:php8.2-apache
|
FROM php:8.2.0RC6-apache
|
||||||
|
|
||||||
ARG UID=1000
|
ARG UID=1000
|
||||||
ARG GID=1000
|
ARG GID=1000
|
||||||
@ -27,7 +27,7 @@ RUN printf "account default\nhost smtp\nport 1025" > /etc/msmtprc
|
|||||||
|
|
||||||
# xdebug build an config
|
# xdebug build an config
|
||||||
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
|
||||||
RUN git clone -b "3.3.1" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
RUN git clone -b "3.2.0RC2" --depth 1 https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug \
|
||||||
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
&& docker-php-ext-configure xdebug --enable-xdebug-dev \
|
||||||
&& docker-php-ext-install xdebug \
|
&& docker-php-ext-install xdebug \
|
||||||
&& mkdir /tmp/debug
|
&& mkdir /tmp/debug
|
||||||
|
16
do
16
do
@ -3,8 +3,8 @@
|
|||||||
function syntax {
|
function syntax {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
./do setup Setup the dev environment.
|
./do setup Setup the dev environment.
|
||||||
./do start Start the docker containers (docker compose up -d).
|
./do start Start the docker containers (docker-compose up -d).
|
||||||
./do stop Stop the docker containers (docker compose stop).
|
./do stop Stop the docker containers (docker-compose stop).
|
||||||
./do ssh [--test] Run an interactive bash shell inside the plugin directory.
|
./do ssh [--test] Run an interactive bash shell inside the plugin directory.
|
||||||
./do run [--test] <command> Run a custom bash command in the wordpress container.
|
./do run [--test] <command> Run a custom bash command in the wordpress container.
|
||||||
./do acceptance [--premium] Run acceptance tests.
|
./do acceptance [--premium] Run acceptance tests.
|
||||||
@ -21,7 +21,7 @@ EOF
|
|||||||
function ssh_and_run {
|
function ssh_and_run {
|
||||||
params=("$@")
|
params=("$@")
|
||||||
params=("${params[@]:1}")
|
params=("${params[@]:1}")
|
||||||
docker compose exec $1 bash -c "${params[@]}"
|
docker-compose exec $1 bash -c "${params[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "" -o "$1" = "--help" ]; then
|
if [ "$1" = "" -o "$1" = "--help" ]; then
|
||||||
@ -31,10 +31,10 @@ elif [ "$1" = "setup" ]; then
|
|||||||
./dev/initial-setup.sh
|
./dev/initial-setup.sh
|
||||||
|
|
||||||
elif [ "$1" = "start" ]; then
|
elif [ "$1" = "start" ]; then
|
||||||
docker compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
elif [ "$1" = "stop" ]; then
|
elif [ "$1" = "stop" ]; then
|
||||||
docker compose stop
|
docker-compose stop
|
||||||
|
|
||||||
elif [ "$1" = "run" ]; then
|
elif [ "$1" = "run" ]; then
|
||||||
params=("$@")
|
params=("$@")
|
||||||
@ -54,9 +54,9 @@ elif [ "$1" = "ssh" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$2" = "--test" ] || [ "$3" = "--test" ]; then
|
if [ "$2" = "--test" ] || [ "$3" = "--test" ]; then
|
||||||
docker compose exec --workdir $dir test_wordpress bash
|
docker-compose exec --workdir $dir test_wordpress bash
|
||||||
else
|
else
|
||||||
docker compose exec --workdir $dir wordpress bash
|
docker-compose exec --workdir $dir wordpress bash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$1" = "acceptance" ]; then
|
elif [ "$1" = "acceptance" ]; then
|
||||||
@ -65,7 +65,7 @@ elif [ "$1" = "acceptance" ]; then
|
|||||||
else
|
else
|
||||||
cd mailpoet
|
cd mailpoet
|
||||||
fi
|
fi
|
||||||
COMPOSE_HTTP_TIMEOUT=200 docker compose run codeception_acceptance -e KEEP_DEPS=1 --steps --debug -vvv
|
COMPOSE_HTTP_TIMEOUT=200 docker-compose run codeception_acceptance -e KEEP_DEPS=1 --steps --debug -vvv
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
elif [ "$1" = "build" ]; then
|
elif [ "$1" = "build" ]; then
|
||||||
|
@ -27,7 +27,6 @@ Class `\MailPoet\API\API` becomes available once MailPoet plugin is loaded by Wo
|
|||||||
|
|
||||||
- [Add List (addList)](api_methods/AddList.md)
|
- [Add List (addList)](api_methods/AddList.md)
|
||||||
- [Add Subscriber (addSubscriber)](api_methods/AddSubscriber.md)
|
- [Add Subscriber (addSubscriber)](api_methods/AddSubscriber.md)
|
||||||
- [Update Subscriber (updateSubscriber)](api_methods/UpdateSubscriber.md)
|
|
||||||
- [Add Subscriber Field (addSubscriberField)](api_methods/AddSubscriberField.md)
|
- [Add Subscriber Field (addSubscriberField)](api_methods/AddSubscriberField.md)
|
||||||
- [Delete List (deleteList)](api_methods/DeleteList.md)
|
- [Delete List (deleteList)](api_methods/DeleteList.md)
|
||||||
- [Get Lists (getLists)](api_methods/GetLists.md)
|
- [Get Lists (getLists)](api_methods/GetLists.md)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[back to list](../Readme.md)
|
[back to list](../Readme.md)
|
||||||
|
|
||||||
# Add List
|
# Add Subscriber
|
||||||
|
|
||||||
## `array addList(array $list)`
|
## `array addList(array $list)`
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ This method throws an `\Exception` in the event a subscriber with a given email
|
|||||||
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
| created_at | string\|null | - | UTC time of creation in 'Y-m-d H:i:s' format |
|
||||||
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
| updated_at | string | - | UTC time of last update in 'Y-m-d H:i:s' format |
|
||||||
| deleted_at | string\|null | - | This property in not null in case that list is in trash and contains UTC time in 'Y-m-d H:i:s' format. |
|
| deleted_at | string\|null | - | This property in not null in case that list is in trash and contains UTC time in 'Y-m-d H:i:s' format. |
|
||||||
| last_subscribed_at | string\|null | - | UTC time of last confirmed subscription in 'Y-m-d H:i:s' format. |
|
|
||||||
| unconfirmed_data | string\|null | 65K chars | May contain serialized subscriber data in case when there are pending changes waiting for a confirmation from a subscriber |
|
| unconfirmed_data | string\|null | 65K chars | May contain serialized subscriber data in case when there are pending changes waiting for a confirmation from a subscriber |
|
||||||
| source | string\|null | - | Possible values: `form`,`imported`,`administrator`,`api`,`wordpress_user`,`woocommerce_user`,`woocommerce_checkout`,`unknown`) |
|
| source | string\|null | - | Possible values: `form`,`imported`,`administrator`,`api`,`wordpress_user`,`woocommerce_user`,`woocommerce_checkout`,`unknown`) |
|
||||||
| count_confirmations | string | 11 chars | Counter for confirmation emails |
|
| count_confirmations | string | 11 chars | Counter for confirmation emails |
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[back to list](../Readme.md)
|
[back to list](../Readme.md)
|
||||||
|
|
||||||
# Update List
|
# Add Subscriber
|
||||||
|
|
||||||
## `array updateList(array $list)`
|
## `array updateList(array $list)`
|
||||||
|
|
||||||
@ -14,11 +14,11 @@ It returns the updated list. See [Get Lists](GetLists.md) for a list data struct
|
|||||||
|
|
||||||
An associative array which contains list data.
|
An associative array which contains list data.
|
||||||
|
|
||||||
| Property | Type | Limits | Description |
|
| Property | Type | Limits | Description |
|
||||||
| ---------------------- | ------------ | --------- | -------------------------------------------------------------------------- |
|
| ---------------------- | ------------ | --------- | -------------------------- |
|
||||||
| id (required) | string | 11 chars | A id of the list. |
|
| id (required) | string | 11 chars | A id of the list. |
|
||||||
| name (required) | string | 90 chars | A name of the list. |
|
| name (required) | string | 90 chars | A name of the list. |
|
||||||
| description (optional) | string\|null | 250 chars | A description of the list. This will reset the list description when empty |
|
| description (optional) | string\|null | 250 chars | A description of the list. |
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
[back to list](../Readme.md)
|
|
||||||
|
|
||||||
# Update Subscriber
|
|
||||||
|
|
||||||
## `array updateSubscriber($subscriberIdOrEmail, array $subscriber): array`
|
|
||||||
|
|
||||||
This method allows a subscriber to be updated.
|
|
||||||
The argument `$subscriber` is similar to [Add Subscriber](AddSubscriber.md) method, but the subscriber is updated instead of created.
|
|
||||||
|
|
||||||
It returns the updated subscriber. See [Get Subscriber](GetSubscriber.md) for a subscriber data structure.
|
|
||||||
|
|
||||||
If the subscriber is a WordPress user, the method does not allow updating `email`, `first_name` and `last_name`. It needs to be updated in the `wp_users` and MailPoet will synchronise the new values.
|
|
||||||
|
|
||||||
## Arguments
|
|
||||||
|
|
||||||
| Argument | Type | Description |
|
|
||||||
| -------------------- | ------------- | ----------------------------------------- |
|
|
||||||
| $subscriberIdOrEmail | string or int | An id or email of an existing subscriber. |
|
|
||||||
| $subscriber | array | Subscriber data that will be updated |
|
|
||||||
|
|
||||||
## Error handling
|
|
||||||
|
|
||||||
All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`.
|
|
||||||
Code of the exception is populated to distinguish between different errors.
|
|
||||||
|
|
||||||
An exception of base class `\Exception` can be thrown when something unexpected happens.
|
|
||||||
|
|
||||||
Codes description:
|
|
||||||
|
|
||||||
| Code | Description |
|
|
||||||
| ---- | -------------------------------------------------- |
|
|
||||||
| 4 | Updating a subscriber that does not exist. |
|
|
||||||
| 13 | The subscriber couldn’t be updated in the database |
|
|
@ -1,3 +1,5 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# for M1 Macs
|
# for M1 Macs
|
||||||
db:
|
db:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
dashboard:
|
dashboard:
|
||||||
container_name: mp-dashboard
|
container_name: mp-dashboard
|
||||||
@ -25,12 +27,13 @@ services:
|
|||||||
container_name: mp-wp
|
container_name: mp-wp
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: dev/php82/Dockerfile
|
dockerfile: dev/php81/Dockerfile
|
||||||
args:
|
args:
|
||||||
UID: ${UID:-1000}
|
UID: ${UID:-1000}
|
||||||
GID: ${GID:-1000}
|
GID: ${GID:-1000}
|
||||||
ports:
|
ports:
|
||||||
- '8002:80'
|
- '8002:80'
|
||||||
|
- '8083:8083' # Storybook port number, see package.json
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- smtp
|
- smtp
|
||||||
@ -49,12 +52,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- './wordpress:/var/www/html'
|
- './wordpress:/var/www/html'
|
||||||
- './tsconfig.base.json:/var/www/html/wp-content/plugins/tsconfig.base.json:ro'
|
- './tsconfig.base.json:/var/www/html/wp-content/plugins/tsconfig.base.json:ro'
|
||||||
- './.npmrc:/var/www/html/wp-content/plugins/.npmrc'
|
|
||||||
- './package.json:/var/www/html/wp-content/plugins/package.json'
|
- './package.json:/var/www/html/wp-content/plugins/package.json'
|
||||||
- './pnpm-lock.yaml:/var/www/html/wp-content/plugins/pnpm-lock.yaml'
|
- './pnpm-lock.yaml:/var/www/html/wp-content/plugins/pnpm-lock.yaml'
|
||||||
- './pnpm-workspace.yaml:/var/www/html/wp-content/plugins/pnpm-workspace.yaml'
|
- './pnpm-workspace.yaml:/var/www/html/wp-content/plugins/pnpm-workspace.yaml'
|
||||||
- './patches:/var/www/html/wp-content/plugins/patches'
|
- './patches:/var/www/html/wp-content/plugins/patches'
|
||||||
- './tests_env:/var/www/html/wp-content/plugins/tests_env'
|
|
||||||
- './mailpoet:/var/www/html/wp-content/plugins/mailpoet'
|
- './mailpoet:/var/www/html/wp-content/plugins/mailpoet'
|
||||||
- './mailpoet-premium:/var/www/html/wp-content/plugins/mailpoet-premium'
|
- './mailpoet-premium:/var/www/html/wp-content/plugins/mailpoet-premium'
|
||||||
- './packages:/var/www/html/wp-content/plugins/packages'
|
- './packages:/var/www/html/wp-content/plugins/packages'
|
||||||
|
@ -44,13 +44,3 @@ WP_TEST_PERFORMANCE_DATA_URL=
|
|||||||
WP_TEST_PERFORMANCE_PW=
|
WP_TEST_PERFORMANCE_PW=
|
||||||
K6_CLOUD_TOKEN=
|
K6_CLOUD_TOKEN=
|
||||||
K6_CLOUD_ID=
|
K6_CLOUD_ID=
|
||||||
|
|
||||||
# git hooks configuration (must be 'true' to enable)
|
|
||||||
MP_GIT_HOOKS_ENABLE=true
|
|
||||||
MP_GIT_HOOKS_ESLINT=true
|
|
||||||
MP_GIT_HOOKS_STYLELINT=true
|
|
||||||
MP_GIT_HOOKS_PHPLINT=true
|
|
||||||
MP_GIT_HOOKS_CODE_SNIFFER=true
|
|
||||||
MP_GIT_HOOKS_PHPSTAN=true
|
|
||||||
MP_GIT_HOOKS_INSTALL_JS=false
|
|
||||||
MP_GIT_HOOKS_INSTALL_PHP=false
|
|
||||||
|
1
mailpoet/.gitignore
vendored
1
mailpoet/.gitignore
vendored
@ -26,4 +26,5 @@ tasks/code_sniffer/vendor
|
|||||||
tasks/phpstan/vendor
|
tasks/phpstan/vendor
|
||||||
tasks/phpstan/_phpstan-wp-source.neon
|
tasks/phpstan/_phpstan-wp-source.neon
|
||||||
/tools/vendor
|
/tools/vendor
|
||||||
|
/storybook-static
|
||||||
assets/js/src/newsletter-editor/behaviors/tinymce-icons.js
|
assets/js/src/newsletter-editor/behaviors/tinymce-icons.js
|
||||||
|
48
mailpoet/.storybook/main.js
Normal file
48
mailpoet/.storybook/main.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const modulesDir = path.join(__dirname, '../node_modules');
|
||||||
|
console.log('NODE', modulesDir);
|
||||||
|
// Workaround for Emotion 11
|
||||||
|
// https://github.com/storybookjs/storybook/pull/13300#issuecomment-783268111
|
||||||
|
const updateEmotionAliases = (config) => ({
|
||||||
|
...config,
|
||||||
|
resolve: {
|
||||||
|
...config.resolve,
|
||||||
|
alias: {
|
||||||
|
...config.resolve.alias,
|
||||||
|
'@emotion/core': path.join(modulesDir, '@emotion/react'),
|
||||||
|
'@emotion/styled': path.join(modulesDir, '@emotion/styled'),
|
||||||
|
'@emotion/styled-base': path.join(modulesDir, '@emotion/styled'),
|
||||||
|
'emotion-theming': path.join(modulesDir, '@emotion/react'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
core: {
|
||||||
|
builder: 'webpack5',
|
||||||
|
},
|
||||||
|
stories: ['../assets/js/src/**/_stories/*.tsx'],
|
||||||
|
webpackFinal: (config) => {
|
||||||
|
config.resolve.modules = ['node_modules', '../assets/js/src'];
|
||||||
|
return updateEmotionAliases(config);
|
||||||
|
},
|
||||||
|
managerWebpack: updateEmotionAliases,
|
||||||
|
addons: [
|
||||||
|
'@storybook/addon-actions',
|
||||||
|
'@storybook/addon-links',
|
||||||
|
'storybook-addon-performance/register',
|
||||||
|
{
|
||||||
|
name: '@storybook/addon-storysource',
|
||||||
|
options: {
|
||||||
|
rule: {
|
||||||
|
test: [/_stories\/.*\.tsx?$/],
|
||||||
|
include: [path.resolve(__dirname, '../assets/js/src')],
|
||||||
|
},
|
||||||
|
loaderOptions: {
|
||||||
|
parser: 'typescript',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
14
mailpoet/.storybook/preview.js
Normal file
14
mailpoet/.storybook/preview.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { addDecorator } from '@storybook/react';
|
||||||
|
import { withPerformance } from 'storybook-addon-performance';
|
||||||
|
import '../assets/css/src/storybook/wordpress-5.8.2.css';
|
||||||
|
import '../assets/dist/css/mailpoet-plugin.css';
|
||||||
|
import '../assets/dist/css/mailpoet-form-editor.css';
|
||||||
|
|
||||||
|
addDecorator(withPerformance);
|
||||||
|
addDecorator((story) => (
|
||||||
|
<div className="wp-core-ui" id="wpbody">
|
||||||
|
<div id="mailpoet-modal"></div>
|
||||||
|
{story()}
|
||||||
|
</div>
|
||||||
|
));
|
@ -1,28 +1,24 @@
|
|||||||
### Table of Contents
|
# MailPoet
|
||||||
|
|
||||||
1. [MailPoet](#mailpoet)
|
The **MailPoet** plugin.
|
||||||
2. [Setup](#setup)
|
|
||||||
1. [Requirements](#requirements)
|
|
||||||
2. [Installation](#installation)
|
|
||||||
3. [Frameworks and libraries](#frameworks-and-libraries)
|
|
||||||
3. [Workflow Commands](#workflow-commands)
|
|
||||||
4. [Coding and Testing](#coding-and-testing)
|
|
||||||
1. [DI](#di)
|
|
||||||
2. [PHP-Scoper](#php-scoper)
|
|
||||||
3. [i18n](#i18n)
|
|
||||||
4. [Acceptance testing](#acceptance-testing)
|
|
||||||
|
|
||||||
## MailPoet
|
To use the official Docker-based development environment, see details
|
||||||
|
in [the readme file](../README.md) in the root of this repository. If
|
||||||
|
you'd like to use the plugin code directly, you can follow the instructions
|
||||||
|
below.
|
||||||
|
|
||||||
- For help with product, visit [SUPPORT](../SUPPORT.md).
|
## Contents
|
||||||
- To use the Docker-based development environment, see [monorepo README](../README.md).
|
|
||||||
- To use plugin code directly, follow instructions below.
|
- [Setup](#setup)
|
||||||
|
- [Frameworks and libraries](#frameworks-and-libraries)
|
||||||
|
- [Workflow Commands](#workflow-commands)
|
||||||
|
- [Coding and Testing](#coding-and-testing)
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- PHP >= 7.4
|
- PHP >= 7.3 (only for the development environment, to run the plugin PHP >= 7.2 is required)
|
||||||
- NodeJS
|
- NodeJS
|
||||||
- WordPress
|
- WordPress
|
||||||
|
|
||||||
@ -50,8 +46,9 @@ cp .env.sample .env
|
|||||||
./do compile:all
|
./do compile:all
|
||||||
```
|
```
|
||||||
|
|
||||||
### Frameworks and libraries
|
## Frameworks and libraries
|
||||||
|
|
||||||
|
- [Paris ORM](https://github.com/j4mie/paris).
|
||||||
- [Symfony/dependency-injection](https://github.com/symfony/dependency-injection) ([docs for 3.4](https://symfony.com/doc/3.4/components/dependency_injection.html)).
|
- [Symfony/dependency-injection](https://github.com/symfony/dependency-injection) ([docs for 3.4](https://symfony.com/doc/3.4/components/dependency_injection.html)).
|
||||||
- [PHP-Scoper](https://github.com/humbug/php-scoper) for moving dependencies into MP namespace
|
- [PHP-Scoper](https://github.com/humbug/php-scoper) for moving dependencies into MP namespace
|
||||||
- [Twig](https://twig.symfony.com/) and [Handlebars](https://handlebarsjs.com/) are used for templates rendering.
|
- [Twig](https://twig.symfony.com/) and [Handlebars](https://handlebarsjs.com/) are used for templates rendering.
|
||||||
@ -68,13 +65,6 @@ cp .env.sample .env
|
|||||||
|
|
||||||
## Workflow Commands
|
## Workflow Commands
|
||||||
|
|
||||||
There are two different `./do` commands. One is in the free MailPoet directory and runs the commands on the local computer. The second is in the repository root and runs the commands in a Docker container.
|
|
||||||
Running `./do` commands in the repository root will run the command in the Docker container.
|
|
||||||
|
|
||||||
It is recommended to run the assets commands directly in the free MailPoet directory. That means installing the dependencies locally. Running the js and css compilation commands within the container is possible, but it is slower.
|
|
||||||
|
|
||||||
On the other hand, the tests should be run in the container. The container has all the necessary dependencies installed and configured. And there is a database running. See more details in the README.md in the repository root.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./do install # install PHP and JS dependencies
|
$ ./do install # install PHP and JS dependencies
|
||||||
$ ./do update # update PHP and JS dependencies
|
$ ./do update # update PHP and JS dependencies
|
||||||
@ -127,6 +117,34 @@ $ ./do container:dump # Generates DI container cache.
|
|||||||
$ ./do generate:data [<generatorName>] [<threads>] # Generates random usage data (Note: requires WooCommerce active) e.g. ./do generate:data past_revenues 4
|
$ ./do generate:data [<generatorName>] [<threads>] # Generates random usage data (Note: requires WooCommerce active) e.g. ./do generate:data past_revenues 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Storybook
|
||||||
|
|
||||||
|
We use [Storybook.js](https://storybook.js.org/) to showcase our React components, which can be used throughout the plugin.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Currently, we don't have Storybook published publicly, so developers need to run or build it locally.
|
||||||
|
|
||||||
|
To run it locally (on `http://localhost:8083`) while watching the changes (recommended when developing new component), run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./do storybook:watch
|
||||||
|
```
|
||||||
|
|
||||||
|
To build the static version, which can be accessed via browser, run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./do storybook:build
|
||||||
|
```
|
||||||
|
|
||||||
|
which will create a `storybook-static` folder with all necessary files. Don't forget to rebuild it when new components are added.
|
||||||
|
|
||||||
|
### Building new components
|
||||||
|
|
||||||
|
- All stories should be located in `_stories` folder inside the component folder they belong to.
|
||||||
|
- Run `./do storybook:watch` so all changes are automatically reflected in `http://localhost:8083`.
|
||||||
|
- Examples are available in `assets/js/src/storybook_demo/_stories` folder.
|
||||||
|
|
||||||
## Coding and Testing
|
## Coding and Testing
|
||||||
|
|
||||||
### DI
|
### DI
|
||||||
@ -142,23 +160,9 @@ Dependencies handled by PHP-Scoper are configured in extra configuration files `
|
|||||||
|
|
||||||
### i18n
|
### i18n
|
||||||
|
|
||||||
We use functions `__()`, `_n()`, `_x()`, and `_nx()` with domain `mailpoet` to translate strings. Please follow [best practices](https://codex.wordpress.org/I18n_for_WordPress_Developers).
|
We use functions `__()`, `_n()`, `_x()`, and `_nx()` with domain `mailpoet` to translate strings.
|
||||||
|
|
||||||
#### Comments for translators
|
**in PHP code**
|
||||||
|
|
||||||
When the translation string can be ambiguous, add [a translators comment](https://codex.wordpress.org/I18n_for_WordPress_Developers#Descriptions) for clarification. Don't use `_x()` or `_xn()` for clarification.
|
|
||||||
|
|
||||||
```php
|
|
||||||
// translators:
|
|
||||||
$customErrorMessage = sprintf(
|
|
||||||
// translators: %1$s is the link, %2$s is the error message.
|
|
||||||
__('Please see %1$s for more information. %2$s.', 'mailpoet'),
|
|
||||||
'https://kb.mailpoet.com',
|
|
||||||
$errorMessage
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### In PHP code
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
__('text to translate', 'mailpoet');
|
__('text to translate', 'mailpoet');
|
||||||
@ -167,7 +171,7 @@ _x('text to translate', 'context', 'mailpoet');
|
|||||||
_xn('single text', 'plural text', $number, 'context', 'mailpoet');
|
_xn('single text', 'plural text', $number, 'context', 'mailpoet');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### In JavaScript/TypeScript code
|
**in JavaScript/TypeScript code**
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { __, _n, _x, _xn } from '@wordpress/i18n';
|
import { __, _n, _x, _xn } from '@wordpress/i18n';
|
||||||
@ -221,7 +225,7 @@ If you want to run only a single test use the parameter `--file`:
|
|||||||
The argument `--skip-deps` is useful locally to speed up the run.
|
The argument `--skip-deps` is useful locally to speed up the run.
|
||||||
|
|
||||||
If there are some unexpected errors you can delete all the runtime and start again.
|
If there are some unexpected errors you can delete all the runtime and start again.
|
||||||
To delete all the docker runtime for acceptance tests use the command `./do delete:docker`.
|
To delete all the docker runtime for acceptance tests use the command `./do d:d`.
|
||||||
|
|
||||||
When debugging you can add `$i->pause();` in to your test which pauses the execution.
|
When debugging you can add `$i->pause();` in to your test which pauses the execution.
|
||||||
|
|
||||||
|
@ -23,21 +23,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $this->taskExecStack()
|
return $this->taskExecStack()
|
||||||
->stopOnFail()
|
->stopOnFail()
|
||||||
->exec('./tools/vendor/composer.phar install')
|
->exec('./tools/vendor/composer.phar install')
|
||||||
->exec('cd ../packages/php/email-editor && ../../../mailpoet/tools/vendor/composer.phar install && cd -')
|
|
||||||
->exec('cd .. && pnpm install --frozen-lockfile --prefer-offline')
|
->exec('cd .. && pnpm install --frozen-lockfile --prefer-offline')
|
||||||
->addCode([$this, 'cleanupCachedFiles'])
|
->addCode([$this, 'cleanupCachedFiles'])
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installPhp() {
|
|
||||||
return $this->taskExecStack()
|
|
||||||
->stopOnFail()
|
|
||||||
->exec('./tools/vendor/composer.phar install')
|
|
||||||
->exec('cd ../packages/php/email-editor && ../../../mailpoet/tools/vendor/composer.phar install && cd -')
|
|
||||||
->addCode([$this, 'cleanupCachedFiles'])
|
|
||||||
->run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function installJs() {
|
public function installJs() {
|
||||||
return $this->taskExecStack()
|
return $this->taskExecStack()
|
||||||
->stopOnFail()
|
->stopOnFail()
|
||||||
@ -50,8 +40,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->_exec('rm -rf ' . __DIR__ . '/generated/*');
|
$this->_exec('rm -rf ' . __DIR__ . '/generated/*');
|
||||||
$this->say('Cleaning up PHPStan cache.');
|
$this->say('Cleaning up PHPStan cache.');
|
||||||
$this->_exec('rm -rf ' . __DIR__ . '/temp/*');
|
$this->_exec('rm -rf ' . __DIR__ . '/temp/*');
|
||||||
$this->say('Cleaning up old testing plugins.');
|
|
||||||
$this->_exec('rm -rf ' . __DIR__ . '/tests/plugins/*');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update() {
|
public function update() {
|
||||||
@ -85,8 +73,12 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
$excludePackages = [
|
$excludePackages = [
|
||||||
|
'tinymce',
|
||||||
'react-router-dom', // MAILPOET-3911
|
'react-router-dom', // MAILPOET-3911
|
||||||
|
'react-tooltip', // MAILPOET-5482
|
||||||
'codemirror', // MAILPOET-5483
|
'codemirror', // MAILPOET-5483
|
||||||
|
'@babel/preset-env', // MAILPOET-5489
|
||||||
|
'react-string-replace', // MAILPOET-5490
|
||||||
'babel-loader', // MAILPOET-5491
|
'babel-loader', // MAILPOET-5491
|
||||||
'stylelint', // MAILPOET-5462
|
'stylelint', // MAILPOET-5462
|
||||||
'backbone', // Will remove with new email editor
|
'backbone', // Will remove with new email editor
|
||||||
@ -189,7 +181,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->_exec('./node_modules/webpack/bin/webpack.js --watch');
|
$this->_exec('./node_modules/webpack/bin/webpack.js --watch');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compileAll($opts = ['env' => null, 'skip-tests' => false, 'only-tests' => false]) {
|
public function compileAll($opts = ['env' => null]) {
|
||||||
$collection = $this->collectionBuilder();
|
$collection = $this->collectionBuilder();
|
||||||
$collection->addCode(function() use ($opts) {
|
$collection->addCode(function() use ($opts) {
|
||||||
return call_user_func([$this, 'compileJs'], $opts);
|
return call_user_func([$this, 'compileJs'], $opts);
|
||||||
@ -200,17 +192,15 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $collection->run();
|
return $collection->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compileJs($opts = ['env' => null, 'skip-tests' => false, 'only-tests' => false]) {
|
public function compileJs($opts = ['env' => null]) {
|
||||||
if (!is_dir('assets/dist/js')) {
|
if (!is_dir('assets/dist/js')) {
|
||||||
mkdir('assets/dist/js', 0777, true);
|
mkdir('assets/dist/js', 0777, true);
|
||||||
}
|
}
|
||||||
if (!$opts['only-tests']) {
|
$this->_exec('rm -rf ' . __DIR__ . '/assets/dist/js/*');
|
||||||
$this->_exec('rm -rf ' . __DIR__ . '/assets/dist/js/*');
|
|
||||||
}
|
|
||||||
$env = ($opts['env']) ?
|
$env = ($opts['env']) ?
|
||||||
sprintf('./node_modules/.bin/cross-env NODE_ENV="%s"', $opts['env']) :
|
sprintf('./node_modules/.bin/cross-env NODE_ENV="%s"', $opts['env']) :
|
||||||
null;
|
null;
|
||||||
return $this->_exec($env . ' ./node_modules/webpack/bin/webpack.js --env BUILD_TESTS=' . ($opts['skip-tests'] ? 'skip' : 'build') . ' --env BUILD_ONLY_TESTS=' . ($opts['only-tests'] ? 'true' : 'false'));
|
return $this->_exec($env . ' ./node_modules/webpack/bin/webpack.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compileCss($opts = ['env' => null]) {
|
public function compileCss($opts = ['env' => null]) {
|
||||||
@ -222,7 +212,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
$compilationResult = $this->taskExecStack()
|
$compilationResult = $this->taskExecStack()
|
||||||
->exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"')
|
->exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"')
|
||||||
->exec('pnpm run scss' . ($opts['env'] === 'production' ? ' --no-source-map' : ''))
|
->exec('pnpm run scss')
|
||||||
->exec('pnpm run autoprefixer')
|
->exec('pnpm run autoprefixer')
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
@ -266,6 +256,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
'vendor',
|
'vendor',
|
||||||
'vendor-prefixed',
|
'vendor-prefixed',
|
||||||
'RoboFile.php',
|
'RoboFile.php',
|
||||||
|
'.storybook',
|
||||||
|
'storybook-static',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$headers = escapeshellarg(
|
$headers = escapeshellarg(
|
||||||
@ -332,7 +324,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testUnit(array $opts = ['file' => null, 'xml' => false, 'multisite' => false, 'debug' => false]) {
|
public function testUnit(array $opts = ['file' => null, 'xml' => false, 'multisite' => false, 'debug' => false]) {
|
||||||
$command = '../tests_env/vendor/bin/codecept run unit';
|
$command = 'vendor/bin/codecept run unit';
|
||||||
|
|
||||||
if ($opts['file']) {
|
if ($opts['file']) {
|
||||||
$command .= ' -f ' . $opts['file'];
|
$command .= ' -f ' . $opts['file'];
|
||||||
@ -349,15 +341,15 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $this->_exec($command);
|
return $this->_exec($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIntegration(array $opts = ['file' => null, 'group' => null, 'skip-group' => null, 'xml' => false, 'multisite' => false, 'debug' => false, 'skip-deps' => false, 'skip-plugins' => false, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false, 'stop-on-fail' => false, 'wordpress-version' => null]) {
|
public function testIntegration(array $opts = ['file' => null, 'group' => null, 'skip-group' => null, 'xml' => false, 'multisite' => false, 'debug' => false, 'skip-deps' => false, 'skip-plugins' => false, 'enable-cot' => false, 'enable-cot-sync' => false, 'stop-on-fail' => false]) {
|
||||||
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration']));
|
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMultisiteIntegration($opts = ['file' => null, 'group' => null, 'skip-group' => null, 'xml' => false, 'multisite' => true, 'skip-deps' => false, 'skip-plugins' => false, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false]) {
|
public function testMultisiteIntegration($opts = ['file' => null, 'group' => null, 'skip-group' => null, 'xml' => false, 'multisite' => true, 'skip-deps' => false, 'skip-plugins' => false, 'enable-cot' => false, 'enable-cot-sync' => false]) {
|
||||||
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration']));
|
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWooIntegration(array $opts = ['file' => null, 'xml' => false, 'multisite' => false, 'debug' => false, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false]) {
|
public function testWooIntegration(array $opts = ['file' => null, 'xml' => false, 'multisite' => false, 'debug' => false, 'enable-cot' => false, 'enable-cot-sync' => false]) {
|
||||||
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration', 'group' => 'woo', 'skip-deps' => true, 'skip-plugins' => false]));
|
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration', 'group' => 'woo', 'skip-deps' => true, 'skip-plugins' => false]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +361,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$command = join(' ', [
|
$command = join(' ', [
|
||||||
'./node_modules/.bin/mocha',
|
'./node_modules/.bin/mocha',
|
||||||
'-r tests/javascript-newsletter-editor/mocha-test-helper.js',
|
'-r tests/javascript-newsletter-editor/mocha-test-helper.js',
|
||||||
'-r tests/javascript-newsletter-editor/mocha-chai.mjs',
|
|
||||||
'tests/javascript-newsletter-editor/testBundles/**/*.js',
|
'tests/javascript-newsletter-editor/testBundles/**/*.js',
|
||||||
'--exit',
|
'--exit',
|
||||||
]);
|
]);
|
||||||
@ -386,7 +377,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testJavascript($xmlOutputFile = null) {
|
public function testJavascript($xmlOutputFile = null) {
|
||||||
$command = './node_modules/.bin/mocha --recursive --require tests/javascript/mocha-env.mjs tests/javascript --extension spec.ts';
|
$command = './node_modules/.bin/mocha --recursive --require tests/javascript/babel-register.js tests/javascript --extension spec.js --extension spec.ts';
|
||||||
|
|
||||||
if (!empty($xmlOutputFile)) {
|
if (!empty($xmlOutputFile)) {
|
||||||
$command .= sprintf(
|
$command .= sprintf(
|
||||||
@ -406,11 +397,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $this->testIntegration($opts);
|
return $this->testIntegration($opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAcceptance($opts = ['file' => null, 'skip-deps' => false, 'group' => null, 'timeout' => null, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false, 'wordpress-version' => null, 'skip-plugins' => false]) {
|
public function testAcceptance($opts = ['file' => null, 'skip-deps' => false, 'group' => null, 'timeout' => null, 'enable-cot' => false, 'enable-cot-sync' => false]) {
|
||||||
return $this->runTestsInContainer($opts);
|
return $this->runTestsInContainer($opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPerformance($path = null, $opts = ['url' => null, 'us' => null, 'pw' => null, 'head' => false, 'scenario' => null]) {
|
public function testPerformance($path = null, $opts = ['url' => null, 'pw' => null, 'head' => false, 'scenario' => null]) {
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
if ((getenv('K6_CLOUD_TOKEN')) === false) {
|
if ((getenv('K6_CLOUD_TOKEN')) === false) {
|
||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
@ -419,10 +410,9 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->arg('run')
|
->arg('run')
|
||||||
->option('env', 'K6_BROWSER_ENABLED=1')
|
->option('env', 'K6_BROWSER_ENABLED=1')
|
||||||
->option('env', 'URL=' . $opts['url'])
|
->option('env', 'URL=' . $opts['url'])
|
||||||
->option('env', 'US=' . $opts['us'])
|
|
||||||
->option('env', 'PW=' . $opts['pw'])
|
->option('env', 'PW=' . $opts['pw'])
|
||||||
->option('env', 'K6_BROWSER_HEADLESS=' . ($opts['head'] ? 'false' : 'true'))
|
->option('env', 'K6_BROWSER_HEADLESS=' . ($opts['head'] ? 'false' : 'true'))
|
||||||
->option('env', 'K6_BROWSER_TIMEOUT=' . getenv('K6_BROWSER_TIMEOUT'))
|
->option('env', 'K6_BROWSER_TIMEOUT=120s')
|
||||||
->option('env', 'SCENARIO=' . $opts['scenario'])
|
->option('env', 'SCENARIO=' . $opts['scenario'])
|
||||||
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
||||||
->dir($dir)->run();
|
->dir($dir)->run();
|
||||||
@ -433,13 +423,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->arg('run')
|
->arg('run')
|
||||||
->option('env', 'K6_BROWSER_ENABLED=1')
|
->option('env', 'K6_BROWSER_ENABLED=1')
|
||||||
->option('env', 'URL=' . $opts['url'])
|
->option('env', 'URL=' . $opts['url'])
|
||||||
->option('env', 'US=' . $opts['us'])
|
|
||||||
->option('env', 'PW=' . $opts['pw'])
|
->option('env', 'PW=' . $opts['pw'])
|
||||||
->option('env', 'HEADLESS=' . ($opts['head'] ? 'false' : 'true'))
|
->option('env', 'HEADLESS=' . ($opts['head'] ? 'false' : 'true'))
|
||||||
->option('env', 'SCENARIO=' . $opts['scenario'])
|
->option('env', 'SCENARIO=' . $opts['scenario'])
|
||||||
->option('env', 'K6_CLOUD_TOKEN=' . getenv('K6_CLOUD_TOKEN'))
|
->option('env', 'K6_CLOUD_TOKEN=' . getenv('K6_CLOUD_TOKEN'))
|
||||||
->option('env', 'K6_CLOUD_ID=' . getenv('K6_CLOUD_ID'))
|
->option('env', 'K6_CLOUD_ID=' . getenv('K6_CLOUD_ID'))
|
||||||
->option('env', 'K6_BROWSER_TIMEOUT=' . getenv('K6_BROWSER_TIMEOUT'))
|
|
||||||
->option('env', 'K6_PROJECT_NAME=' . $opts['scenario'])
|
->option('env', 'K6_PROJECT_NAME=' . $opts['scenario'])
|
||||||
->option('out', 'cloud')
|
->option('out', 'cloud')
|
||||||
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
||||||
@ -476,19 +464,19 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
// import data & run WordPress setup
|
// import data & run WordPress setup
|
||||||
$this->say('Importing data and running a WordPress setup...');
|
$this->say('Importing data and running a WordPress setup...');
|
||||||
$this->taskExec('COMPOSE_HTTP_TIMEOUT=200 docker compose run --rm -it setup')
|
$this->taskExec('COMPOSE_HTTP_TIMEOUT=200 docker-compose run --rm -it setup')
|
||||||
->dir(__DIR__ . '/tests/performance')
|
->dir(__DIR__ . '/tests/performance')
|
||||||
->run();
|
->run();
|
||||||
$this->say('Data imported, WordPress set up.');
|
$this->say('Data imported, WordPress set up.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPerformanceClean() {
|
public function testPerformanceClean() {
|
||||||
$this->taskExec('COMPOSE_HTTP_TIMEOUT=200 docker compose down --remove-orphans -v')
|
$this->taskExec('COMPOSE_HTTP_TIMEOUT=200 docker-compose down --remove-orphans -v')
|
||||||
->dir(__DIR__ . '/tests/performance')
|
->dir(__DIR__ . '/tests/performance')
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAcceptanceMultisite($opts = ['file' => null, 'skip-deps' => false, 'group' => null, 'timeout' => null, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false]) {
|
public function testAcceptanceMultisite($opts = ['file' => null, 'skip-deps' => false, 'group' => null, 'timeout' => null, 'enable-cot' => false, 'enable-cot-sync' => false]) {
|
||||||
return $this->runTestsInContainer(array_merge($opts, ['multisite' => true]));
|
return $this->runTestsInContainer(array_merge($opts, ['multisite' => true]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,30 +485,27 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
*/
|
*/
|
||||||
public function deleteDocker() {
|
public function deleteDocker() {
|
||||||
return $this->taskExec(
|
return $this->taskExec(
|
||||||
'docker compose down -v --remove-orphans --rmi all'
|
'docker-compose down -v --remove-orphans --rmi all'
|
||||||
)->dir(__DIR__ . '/../tests_env/docker')->run();
|
)->dir(__DIR__ . '/tests/docker')->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes docker containers and volumes used in tests
|
* Deletes docker containers and volumes used in tests
|
||||||
*/
|
*/
|
||||||
public function resetTestDocker() {
|
public function resetTestDocker() {
|
||||||
return $this
|
return $this->taskExec(
|
||||||
->taskExec(
|
'docker-compose down -v --remove-orphans'
|
||||||
'docker compose down -v --remove-orphans'
|
)->dir(__DIR__ . '/tests/docker')->run();
|
||||||
)->dir(__DIR__ . '/../tests_env/docker')
|
|
||||||
->addCode([$this, 'cleanupCachedFiles'])
|
|
||||||
->run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFailedUnit() {
|
public function testFailedUnit() {
|
||||||
$this->_exec('../tests_env/vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
return $this->_exec('../tests_env/vendor/bin/codecept run unit -g failed');
|
return $this->_exec('vendor/bin/codecept run unit -g failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFailedIntegration() {
|
public function testFailedIntegration() {
|
||||||
$this->_exec('../tests_env/vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
return $this->_exec('../tests_env/vendor/bin/codecept run integration -g failed');
|
return $this->_exec('vendor/bin/codecept run integration -g failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function containerDump() {
|
public function containerDump() {
|
||||||
@ -624,6 +609,9 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$collection->addCode(function() {
|
$collection->addCode(function() {
|
||||||
return $this->qaCodeSniffer([]);
|
return $this->qaCodeSniffer([]);
|
||||||
});
|
});
|
||||||
|
$collection->addCode(function() {
|
||||||
|
return $this->qaMinimalPluginStandard([]);
|
||||||
|
});
|
||||||
return $collection->run();
|
return $collection->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +638,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
'lib/',
|
'lib/',
|
||||||
'lib-3rd-party/',
|
'lib-3rd-party/',
|
||||||
'vendor/composer',
|
'vendor/composer',
|
||||||
'vendor/dragonmantank',
|
'vendor/mtdowling',
|
||||||
'vendor-prefixed/',
|
'vendor-prefixed/',
|
||||||
'vendor-prefixed/soundasleep',
|
'vendor-prefixed/soundasleep',
|
||||||
'mailpoet.php',
|
'mailpoet.php',
|
||||||
@ -666,7 +654,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
'vendor-prefixed/cerdic/css-tidy/COPYING',
|
'vendor-prefixed/cerdic/css-tidy/COPYING',
|
||||||
'vendor-prefixed/cerdic/css-tidy/NEWS',
|
'vendor-prefixed/cerdic/css-tidy/NEWS',
|
||||||
'vendor-prefixed/cerdic/css-tidy/testing',
|
'vendor-prefixed/cerdic/css-tidy/testing',
|
||||||
'vendor/dragonmantank/cron-expression/tests',
|
'vendor/mtdowling/cron-expression/tests',
|
||||||
'vendor/phpmailer/phpmailer/test',
|
'vendor/phpmailer/phpmailer/test',
|
||||||
'vendor-prefixed/psr/log/Psr/Log/Test',
|
'vendor-prefixed/psr/log/Psr/Log/Test',
|
||||||
'vendor-prefixed/sabberworm/php-css-parser/tests',
|
'vendor-prefixed/sabberworm/php-css-parser/tests',
|
||||||
@ -686,21 +674,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function qaLintJavascript() {
|
public function qaLintJavascript() {
|
||||||
$collection = $this->collectionBuilder();
|
return $this->_exec('pnpm run check-types && pnpm run lint');
|
||||||
return $collection->taskExecStack()
|
|
||||||
->stopOnFail()
|
|
||||||
->exec('pnpm run check-types && pnpm run lint')
|
|
||||||
->exec('cd .. && cd packages/js/email-editor && pnpm run check-types && pnpm run lint:js')
|
|
||||||
->run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function qaLintCss() {
|
public function qaLintCss() {
|
||||||
$collection = $this->collectionBuilder();
|
return $this->_exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"');
|
||||||
return $collection->taskExecStack()
|
|
||||||
->stopOnFail()
|
|
||||||
->exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"')
|
|
||||||
->exec('cd .. && cd packages/js/email-editor && pnpm run lint:css')
|
|
||||||
->run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function qaCodeSniffer(array $filesToCheck, $opts = ['severity' => 'all']) {
|
public function qaCodeSniffer(array $filesToCheck, $opts = ['severity' => 'all']) {
|
||||||
@ -729,9 +707,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
'tasks/code_sniffer/vendor',
|
'tasks/code_sniffer/vendor',
|
||||||
'tasks/phpstan/vendor',
|
'tasks/phpstan/vendor',
|
||||||
'tasks/makepot',
|
'tasks/makepot',
|
||||||
'tasks/minimal-plugin-standard/vendor',
|
|
||||||
'tools/vendor',
|
'tools/vendor',
|
||||||
'tools/wpscan-semgrep-rules',
|
|
||||||
'temp',
|
'temp',
|
||||||
'tests/_data',
|
'tests/_data',
|
||||||
'tests/_output',
|
'tests/_output',
|
||||||
@ -754,6 +730,57 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function qaMinimalPluginStandard(array $filesToCheck, $opts = ['severity' => 'all']) {
|
||||||
|
$severityFlag = $opts['severity'] === 'all' ? '-w' : '-n';
|
||||||
|
|
||||||
|
$task = implode(' ', [
|
||||||
|
'php -d memory_limit=-1',
|
||||||
|
'./tasks/code_sniffer/vendor/bin/phpcs',
|
||||||
|
'--parallel=' . $this->getParallelism(),
|
||||||
|
'--extensions=php',
|
||||||
|
$severityFlag,
|
||||||
|
'--standard=tasks/code_sniffer/vendor/wporg/plugin-directory/MinimalPluginStandard',
|
||||||
|
'-s',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$ignorePaths = [
|
||||||
|
'.mp_svn',
|
||||||
|
'assets',
|
||||||
|
'doc',
|
||||||
|
'generated',
|
||||||
|
'lib/Config/PopulatorData/Templates',
|
||||||
|
'lib-3rd-party',
|
||||||
|
'node_modules',
|
||||||
|
'plugin_repository',
|
||||||
|
'prefixer/build',
|
||||||
|
'prefixer/vendor',
|
||||||
|
'tasks/code_sniffer/vendor',
|
||||||
|
'tasks/phpstan/vendor',
|
||||||
|
'tasks/makepot',
|
||||||
|
'tools/vendor',
|
||||||
|
'temp',
|
||||||
|
'tests/_data',
|
||||||
|
'tests/_output',
|
||||||
|
'tests/_support/_generated',
|
||||||
|
'vendor',
|
||||||
|
'vendor-prefixed',
|
||||||
|
'views',
|
||||||
|
];
|
||||||
|
|
||||||
|
// the "--ignore" arg takes a list of regexes, we need to anchor and escape them
|
||||||
|
$ignorePatterns = array_map(function (string $path): string {
|
||||||
|
return '^' . preg_quote(__DIR__ . DIRECTORY_SEPARATOR . $path);
|
||||||
|
}, $ignorePaths);
|
||||||
|
|
||||||
|
$stringFilesToCheck = !empty($filesToCheck) ? implode(' ', $filesToCheck) : '.';
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->taskExec($task)
|
||||||
|
->arg('--ignore=' . implode(',', $ignorePatterns))
|
||||||
|
->rawArg($stringFilesToCheck)
|
||||||
|
->run();
|
||||||
|
}
|
||||||
|
|
||||||
public function qaFixFile($filePath) {
|
public function qaFixFile($filePath) {
|
||||||
$extension = pathinfo($filePath, PATHINFO_EXTENSION);
|
$extension = pathinfo($filePath, PATHINFO_EXTENSION);
|
||||||
if ($extension === 'php') {
|
if ($extension === 'php') {
|
||||||
@ -761,8 +788,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $this->collectionBuilder()
|
return $this->collectionBuilder()
|
||||||
->taskExec(
|
->taskExec(
|
||||||
'./tasks/code_sniffer/vendor/bin/phpcbf ' .
|
'./tasks/code_sniffer/vendor/bin/phpcbf ' .
|
||||||
'--standard=tasks/code_sniffer/MailPoet/free-ruleset.xml ' .
|
'--standard=./tasks/code_sniffer/MailPoet ' .
|
||||||
'--runtime-set testVersion 7.4-8.2 ' .
|
'--runtime-set testVersion 7.3-8.2 ' .
|
||||||
$filePath . ' -n'
|
$filePath . ' -n'
|
||||||
)
|
)
|
||||||
->run();
|
->run();
|
||||||
@ -787,7 +814,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure Codeception support files are present to avoid invalid errors when running PHPStan
|
// make sure Codeception support files are present to avoid invalid errors when running PHPStan
|
||||||
$this->_exec('../tests_env/vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
|
|
||||||
// PHPStan must be run out of main plugin directory to avoid its autoloading
|
// PHPStan must be run out of main plugin directory to avoid its autoloading
|
||||||
// from vendor/autoload.php where some dev dependencies cause conflicts.
|
// from vendor/autoload.php where some dev dependencies cause conflicts.
|
||||||
@ -811,8 +838,12 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
return $this->_exec('./tools/semgrep.sh lib/ lib-3rd-party/');
|
return $this->_exec('./tools/semgrep.sh lib/ lib-3rd-party/');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function qaQitSecurity() {
|
public function storybookBuild() {
|
||||||
return $this->_exec('./vendor/bin/qit run:security mailpoet --zip=mailpoet.zip --wait');
|
return $this->_exec('pnpm run build-storybook');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storybookWatch() {
|
||||||
|
return $this->_exec('pnpm run storybook');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function svnCheckout() {
|
public function svnCheckout() {
|
||||||
@ -1091,9 +1122,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->addCode(function () {
|
->addCode(function () {
|
||||||
return $this->releaseDownloadZip();
|
return $this->releaseDownloadZip();
|
||||||
})
|
})
|
||||||
->addCode(function () use ($version) {
|
|
||||||
return $this->releaseVerifyDownloadedZip($version);
|
|
||||||
})
|
|
||||||
->addCode(function () {
|
->addCode(function () {
|
||||||
return $this->translationsGetPotFileFromBuild();
|
return $this->translationsGetPotFileFromBuild();
|
||||||
})
|
})
|
||||||
@ -1118,9 +1146,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->addCode(function () {
|
->addCode(function () {
|
||||||
return $this->releaseMergePullRequest(\MailPoetTasks\Release\GitHubController::RELEASE_SOURCE_BRANCH);
|
return $this->releaseMergePullRequest(\MailPoetTasks\Release\GitHubController::RELEASE_SOURCE_BRANCH);
|
||||||
})
|
})
|
||||||
->addCode(function () {
|
|
||||||
return $this->releaseDeleteDownloadedZip();
|
|
||||||
})
|
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1279,29 +1304,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
|
$this->say("IMPORTANT NOTES \n" . ($outputs[2] ?: 'none'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function releaseVerifyDownloadedZip($version) {
|
|
||||||
$this->say('Verifying ZIP file');
|
|
||||||
$zip = new ZipArchive();
|
|
||||||
|
|
||||||
$versionFound = false;
|
|
||||||
if ($zip->open(self::ZIP_BUILD_PATH) === true) {
|
|
||||||
$fileContent = $zip->getFromName('mailpoet/readme.txt');
|
|
||||||
if ($fileContent !== false) {
|
|
||||||
$versionFound = strpos($fileContent, 'Stable tag: ' . $version);
|
|
||||||
}
|
|
||||||
$zip->close();
|
|
||||||
} else {
|
|
||||||
$this->yell('ZIP file could not be opened!', 40, 'red');
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$versionFound) {
|
|
||||||
$this->yell('ZIP file does not contain required version: "' . $version . '" in readme.txt! ', 40, 'red');
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$this->say('ZIP file contains required version: "' . $version . '" in readme.txt.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function releaseDownloadZip() {
|
public function releaseDownloadZip() {
|
||||||
$circleciController = $this->createCircleCiController();
|
$circleciController = $this->createCircleCiController();
|
||||||
$path = $circleciController->downloadLatestBuild(self::ZIP_BUILD_PATH);
|
$path = $circleciController->downloadLatestBuild(self::ZIP_BUILD_PATH);
|
||||||
@ -1309,12 +1311,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->say(sprintf('Release ZIP file size: %.2F MB', filesize($path) / pow(1024, 2)));
|
$this->say(sprintf('Release ZIP file size: %.2F MB', filesize($path) / pow(1024, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function releaseDeleteDownloadedZip() {
|
|
||||||
$this->say('Delete downloaded ZIP: ' . self::ZIP_BUILD_PATH);
|
|
||||||
$this->taskExec('rm -f ' . self::ZIP_BUILD_PATH)->run();
|
|
||||||
$this->say('ZIP file was deleted');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function releasePublishGithub($version = null) {
|
public function releasePublishGithub($version = null) {
|
||||||
$jiraController = $this->createJiraController();
|
$jiraController = $this->createJiraController();
|
||||||
$version = $jiraController->getVersion($version);
|
$version = $jiraController->getVersion($version);
|
||||||
@ -1354,6 +1350,11 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function downloadWooCommerceBlocksZip($tag = null) {
|
||||||
|
$this->createWpOrgDownloader('woo-gutenberg-products-block')
|
||||||
|
->downloadPluginZip('woo-gutenberg-products-block.zip', __DIR__ . '/tests/plugins/', $tag);
|
||||||
|
}
|
||||||
|
|
||||||
public function downloadWooCommerceMembershipsZip($tag = null) {
|
public function downloadWooCommerceMembershipsZip($tag = null) {
|
||||||
if (!getenv('WP_GITHUB_USERNAME') && !getenv('WP_GITHUB_TOKEN')) {
|
if (!getenv('WP_GITHUB_USERNAME') && !getenv('WP_GITHUB_TOKEN')) {
|
||||||
$this->yell("Skipping download of WooCommerce Memberships", 40, 'red');
|
$this->yell("Skipping download of WooCommerce Memberships", 40, 'red');
|
||||||
@ -1475,16 +1476,12 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
new TwigFileSystem($templatePath)
|
new TwigFileSystem($templatePath)
|
||||||
);
|
);
|
||||||
$twig = $renderer->getTwig();
|
$twig = $renderer->getTwig();
|
||||||
foreach ($this->rsearch($templatePath, ['html', 'hbs', 'txt']) as $template) {
|
foreach ($this->rsearch($templatePath, ['html','hbs','txt']) as $template) {
|
||||||
$path = substr($template, strlen($templatePath));
|
$path = substr($template, strlen($templatePath));
|
||||||
$twig->load($path);
|
$twig->load($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function emailCreateTemplates() {
|
|
||||||
return $this->taskExec('vendor/bin/wp mailpoet:email-editor:create-templates');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function rsearch($folder, $extensions = []) {
|
protected function rsearch($folder, $extensions = []) {
|
||||||
$dir = new RecursiveDirectoryIterator($folder);
|
$dir = new RecursiveDirectoryIterator($folder);
|
||||||
$iterator = new RecursiveIteratorIterator($dir);
|
$iterator = new RecursiveIteratorIterator($dir);
|
||||||
@ -1611,9 +1608,9 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
$annotationReaderProvider = new \MailPoet\Doctrine\Annotations\AnnotationReaderProvider();
|
$annotationReaderProvider = new \MailPoet\Doctrine\Annotations\AnnotationReaderProvider();
|
||||||
$configuration = (new \MailPoet\Doctrine\ConfigurationFactory($annotationReaderProvider, true))->createConfiguration();
|
$configuration = (new \MailPoet\Doctrine\ConfigurationFactory($annotationReaderProvider, true))->createConfiguration();
|
||||||
$platformClass = \MailPoetVendor\Doctrine\DBAL\Platforms\MySQLPlatform::class;
|
$platformClass = \MailPoet\Doctrine\ConnectionFactory::PLATFORM_CLASS;
|
||||||
return \MailPoetVendor\Doctrine\ORM\EntityManager::create([
|
return \MailPoetVendor\Doctrine\ORM\EntityManager::create([
|
||||||
'driverClass' => \MailPoet\Doctrine\ConnectionFactory::DRIVER_CLASS,
|
'driver' => \MailPoet\Doctrine\ConnectionFactory::DRIVER,
|
||||||
'platform' => new $platformClass,
|
'platform' => new $platformClass,
|
||||||
], $configuration);
|
], $configuration);
|
||||||
}
|
}
|
||||||
@ -1622,12 +1619,10 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$testType = $opts['test_type'] ?? 'acceptance';
|
$testType = $opts['test_type'] ?? 'acceptance';
|
||||||
$this->doctrineGenerateCache();
|
$this->doctrineGenerateCache();
|
||||||
return $this->taskExec(
|
return $this->taskExec(
|
||||||
'COMPOSE_HTTP_TIMEOUT=200 docker compose run ' .
|
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
|
||||||
(isset($opts['wordpress-version']) && $opts['wordpress-version'] ? '-e WORDPRESS_VERSION=' . $opts['wordpress-version'] . ' ' : '') .
|
|
||||||
(isset($opts['skip-deps']) && $opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
|
(isset($opts['skip-deps']) && $opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
|
||||||
(isset($opts['disable-hpos']) && $opts['disable-hpos'] ? '-e DISABLE_HPOS=1 ' : '') .
|
(isset($opts['enable-cot']) && $opts['enable-cot'] ? '-e ENABLE_COT=1 ' : '') .
|
||||||
(isset($opts['enable-hpos-sync']) && $opts['enable-hpos-sync'] ? '-e ENABLE_HPOS_SYNC=1 ' : '') .
|
(isset($opts['enable-cot-sync']) && $opts['enable-cot-sync'] ? '-e ENABLE_COT_SYNC=1 ' : '') .
|
||||||
(isset($opts['enable-hpos']) && $opts['enable-hpos'] ? '-e ENABLE_HPOS=1 ' : '') .
|
|
||||||
(isset($opts['skip-plugins']) && $opts['skip-plugins'] ? '-e SKIP_PLUGINS=1 ' : '') .
|
(isset($opts['skip-plugins']) && $opts['skip-plugins'] ? '-e SKIP_PLUGINS=1 ' : '') .
|
||||||
(isset($opts['timeout']) && $opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') .
|
(isset($opts['timeout']) && $opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') .
|
||||||
(isset($opts['multisite']) && $opts['multisite'] ? '-e MULTISITE=1 ' : '-e MULTISITE=0 ') .
|
(isset($opts['multisite']) && $opts['multisite'] ? '-e MULTISITE=1 ' : '-e MULTISITE=0 ') .
|
||||||
@ -1637,7 +1632,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
(isset($opts['skip-group']) && $opts['skip-group'] ? '--skip-group ' . $opts['skip-group'] . ' ' : '') .
|
(isset($opts['skip-group']) && $opts['skip-group'] ? '--skip-group ' . $opts['skip-group'] . ' ' : '') .
|
||||||
(isset($opts['stop-on-fail']) && $opts['stop-on-fail'] ? '-f ' : '') .
|
(isset($opts['stop-on-fail']) && $opts['stop-on-fail'] ? '-f ' : '') .
|
||||||
(isset($opts['file']) && $opts['file'] ? $opts['file'] : '')
|
(isset($opts['file']) && $opts['file'] ? $opts['file'] : '')
|
||||||
)->dir(__DIR__ . '/../tests_env/docker')->run();
|
)->dir(__DIR__ . '/tests/docker')->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getParallelism(int $multiplier = 1, int $min = 4, int $max = 32): int {
|
private function getParallelism(int $multiplier = 1, int $min = 4, int $max = 32): int {
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,8 +3,6 @@ $color-wp-gray-0: #fbfbfb;
|
|||||||
$color-poet-gray-dividers: #dcdcde;
|
$color-poet-gray-dividers: #dcdcde;
|
||||||
$color-gutenberg-blue: #007cba;
|
$color-gutenberg-blue: #007cba;
|
||||||
$color-gutenberg-grey-100: #f0f0f0;
|
$color-gutenberg-grey-100: #f0f0f0;
|
||||||
$color-gutenberg-grey-200: #e0e0e0;
|
|
||||||
$color-gutenberg-grey-400: #ccc;
|
|
||||||
$color-gutenberg-grey-600: #949494;
|
$color-gutenberg-grey-600: #949494;
|
||||||
$color-gutenberg-grey-700: #757575;
|
$color-gutenberg-grey-700: #757575;
|
||||||
$color-gutenberg-grey-800: #2f2f2f;
|
$color-gutenberg-grey-800: #2f2f2f;
|
||||||
@ -20,4 +18,3 @@ $color-wp-yellow-50: #996800;
|
|||||||
$color-wp-yellow-60: #755100;
|
$color-wp-yellow-60: #755100;
|
||||||
$color-wp-red-0: #fcf0f1;
|
$color-wp-red-0: #fcf0f1;
|
||||||
$color-wp-red-60: #b32d2e;
|
$color-wp-red-60: #b32d2e;
|
||||||
$color-wp-red-70: #8a2424;
|
|
@ -1,18 +1,18 @@
|
|||||||
@import '../components-automation/colors';
|
@import 'colors';
|
||||||
|
|
||||||
.mailpoet-automation-analytics-title {
|
.mailpoet-automation-analytics-title {
|
||||||
color: $color-gutenberg-grey-700;
|
color: $color-gutenberg-grey-700;
|
||||||
font-size: 16px;
|
|
||||||
a {
|
a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
color: $color-gutenberg-grey-900;
|
color: $color-gutenberg-grey-900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-automation-status {
|
.mailpoet-analytics-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
@ -27,21 +27,9 @@
|
|||||||
.woocommerce-filters-filter {
|
.woocommerce-filters-filter {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
* {
|
.components-dropdown__content .components-popover__content {
|
||||||
box-sizing: border-box;
|
padding: 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.components-dropdown {
|
|
||||||
.components-button.is-primary {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin_page_mailpoet-automation-analytics {
|
|
||||||
.woocommerce-filters-date__content .components-popover__content {
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import '../components-automation/colors';
|
@import './colors';
|
||||||
|
|
||||||
.mailpoet-automation-analytics-overview {
|
.mailpoet-automation-analytics-overview {
|
||||||
background: $color-white;
|
background: $color-white;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import '../../components-automation/colors';
|
@import '../colors';
|
||||||
|
|
||||||
.mailpoet-automation-editor-stats-placeholder {
|
.mailpoet-automation-editor-stats-placeholder {
|
||||||
.mailpoet-automation-stats-label {
|
.mailpoet-automation-stats-label {
|
||||||
@ -20,8 +20,8 @@
|
|||||||
.mailpoet-automation-editor-step-icon {
|
.mailpoet-automation-editor-step-icon {
|
||||||
background: $color-gutenberg-grey-100;
|
background: $color-gutenberg-grey-100;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
height: 48px;
|
height: 49px;
|
||||||
width: 48px;
|
width: 49px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-automation-editor-step-title {
|
.mailpoet-automation-editor-step-title {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@import '../../components-automation/colors';
|
@import '../colors';
|
||||||
|
@import 'mixins';
|
||||||
|
|
||||||
.mailpoet-analytics-main-value {
|
.mailpoet-analytics-main-value {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@ -7,6 +8,14 @@
|
|||||||
margin: 0 0 4px;
|
margin: 0 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge-text {
|
||||||
|
@include badge;
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-automation-analytics-email-name {
|
.mailpoet-automation-analytics-email-name {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
@ -15,6 +24,24 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge-success {
|
||||||
|
color: $color-gutenberg-alert-green;
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge-text {
|
||||||
|
background: $color-wp-green-0;
|
||||||
|
color: $color-wp-green-60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge-warning {
|
||||||
|
color: $color-wp-yellow-50;
|
||||||
|
|
||||||
|
.mailpoet-analytics-badge-text {
|
||||||
|
background: $color-wp-yellow-0;
|
||||||
|
color: $color-wp-yellow-60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-automation-analytics-table-subvalue {
|
.mailpoet-automation-analytics-table-subvalue {
|
||||||
color: $color-gutenberg-grey-600;
|
color: $color-gutenberg-grey-600;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import '../../components-automation/colors';
|
@import '../colors';
|
||||||
|
|
||||||
.mailpoet-analytics-tabs {
|
.mailpoet-analytics-tabs {
|
||||||
background: $color-white;
|
background: $color-white;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
@import 'mixins';
|
||||||
@import 'general';
|
@import 'general';
|
||||||
@import 'email';
|
@import 'email';
|
||||||
@import 'orders';
|
@import 'orders';
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
@import '../colors';
|
||||||
|
|
||||||
|
@mixin badge {
|
||||||
|
background: $color-grey;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 16px;
|
||||||
|
margin-right: 4px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
@import '../../components-automation/colors';
|
@import '../colors';
|
||||||
|
@import 'mixins';
|
||||||
|
|
||||||
.mailpoet-analytics-tab-orders,
|
.mailpoet-analytics-tab-orders,
|
||||||
.mailpoet-analytics-tab-subscribers {
|
.mailpoet-analytics-tab-subscribers {
|
||||||
@ -14,7 +15,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal,
|
|
||||||
.mailpoet-automation-analytics .woocommerce-table__item {
|
.mailpoet-automation-analytics .woocommerce-table__item {
|
||||||
a.mailpoet-analytics-orders__customer {
|
a.mailpoet-analytics-orders__customer {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@ -26,9 +26,7 @@
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-analytics .woocommerce-table__item {
|
|
||||||
.mailpoet-automations-analytics-order-products {
|
.mailpoet-automations-analytics-order-products {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
column-gap: 8px;
|
column-gap: 8px;
|
||||||
@ -58,6 +56,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-order-status {
|
||||||
|
@include badge;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-order-status-completed,
|
||||||
|
.mailpoet-analytics-order-status-processing {
|
||||||
|
background: $color-wp-green-0;
|
||||||
|
color: $color-wp-green-60;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-order-status-failed {
|
||||||
|
background: $color-wp-red-0;
|
||||||
|
color: $color-wp-red-60;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mailpoet-analytics-order-status-on-hold {
|
||||||
|
background: $color-wp-yellow-0;
|
||||||
|
color: $color-wp-yellow-60;
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-analytics-upgrade-banner {
|
.mailpoet-analytics-upgrade-banner {
|
||||||
margin: 24px;
|
margin: 24px;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import '../../components-automation/colors';
|
@import '../colors';
|
||||||
|
|
||||||
.mailpoet-analytics-clear-filters {
|
.mailpoet-analytics-clear-filters {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
@ -26,7 +26,7 @@
|
|||||||
grid-template-columns: 20px 1fr;
|
grid-template-columns: 20px 1fr;
|
||||||
|
|
||||||
.mailpoet-automation-colored-icon {
|
.mailpoet-automation-colored-icon {
|
||||||
padding: 2px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
@ -39,55 +39,3 @@
|
|||||||
grid-column-start: 2;
|
grid-column-start: 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-spinner {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal {
|
|
||||||
min-width: 500px;
|
|
||||||
|
|
||||||
.components-modal__header-heading {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-table {
|
|
||||||
margin-top: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-header {
|
|
||||||
background: $color-white;
|
|
||||||
|
|
||||||
.components-modal__header-heading,
|
|
||||||
.mailpoet-analytics-orders__customer {
|
|
||||||
font-size: 1.2rem;
|
|
||||||
height: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-header-spacer {
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-footer {
|
|
||||||
align-items: center;
|
|
||||||
color: $color-gutenberg-grey-700;
|
|
||||||
display: flex;
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
justify-content: center;
|
|
||||||
padding-top: 24px;
|
|
||||||
|
|
||||||
svg {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-analytics-activity-modal-status-info {
|
|
||||||
max-width: 220px;
|
|
||||||
|
|
||||||
&:not(:empty) {
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,35 +1,16 @@
|
|||||||
.mailpoet-automation-editor-automation {
|
.mailpoet-automation-editor-automation {
|
||||||
background: #fbfbfb;
|
background: #fbfbfb;
|
||||||
display: grid;
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
grid-template-rows: auto 1fr;
|
|
||||||
overflow: auto;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-automation-editor-automation-wrapper {
|
.mailpoet-automation-editor-automation-wrapper {
|
||||||
padding: 0 20px 50px;
|
|
||||||
|
|
||||||
// Fix for action selector popup on small devices
|
|
||||||
.components-popover__content {
|
|
||||||
min-width: 280px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-automation-flow {
|
|
||||||
margin: auto;
|
|
||||||
width: max-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-automation-row {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-auto-flow: column;
|
padding: 50px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-automation-editor-automation-end {
|
.mailpoet-automation-editor-automation-end {
|
||||||
background: #8c8f94;
|
background: #8c8f94;
|
||||||
border-radius: 999999px;
|
border-radius: 999999px;
|
||||||
display: block;
|
|
||||||
fill: white;
|
fill: white;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
margin: 4px auto;
|
margin: 4px auto;
|
||||||
@ -38,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mailpoet-automation-editor-stats {
|
.mailpoet-automation-editor-stats {
|
||||||
margin: 50px auto 32px;
|
margin: 0 auto 32px;
|
||||||
max-width: 480px;
|
max-width: 480px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
// See: https://github.com/WordPress/gutenberg/blob/af7da80dd54d7fe52772890e2cc1b65073db9655/packages/block-editor/src/components/block-icon/style.scss
|
// See: https://github.com/WordPress/gutenberg/blob/af7da80dd54d7fe52772890e2cc1b65073db9655/packages/block-editor/src/components/block-icon/style.scss
|
||||||
|
|
||||||
.block-editor-block-icon,
|
.block-editor-block-icon {
|
||||||
.block-editor-block-icon > div {
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
}
|
|
||||||
|
|
||||||
.block-editor-block-icon {
|
|
||||||
&.has-colors {
|
&.has-colors {
|
||||||
svg {
|
svg {
|
||||||
fill: currentColor;
|
fill: currentColor;
|
||||||
@ -29,10 +26,9 @@
|
|||||||
// indicated size.
|
// indicated size.
|
||||||
// See: https://github.com/WordPress/gutenberg/pull/9828
|
// See: https://github.com/WordPress/gutenberg/pull/9828
|
||||||
svg {
|
svg {
|
||||||
margin: -4px;
|
max-height: 24px;
|
||||||
max-height: 32px;
|
max-width: 24px;
|
||||||
max-width: 32px;
|
min-height: 20px;
|
||||||
min-height: 26px;
|
min-width: 20px;
|
||||||
min-width: 26px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,3 @@
|
|||||||
.mailpoet-automation-editor-edit-site-document-actions {
|
|
||||||
background: none;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.edit-site-document-actions__title:hover {
|
|
||||||
color: var(--wp-admin-theme-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-dropdown {
|
|
||||||
align-items: center;
|
|
||||||
display: inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.edit-site-document-actions__get-info {
|
|
||||||
min-width: 24px;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: none;
|
|
||||||
color: var(--wp-admin-theme-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-chip-gray {
|
|
||||||
padding: 0 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-edit-site-document-actions__info-dropdown {
|
|
||||||
.components-popover__content {
|
|
||||||
min-width: 240px;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.mailpoet-automation-editor-dropdown-name-edit {
|
.mailpoet-automation-editor-dropdown-name-edit {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
@ -46,15 +9,6 @@
|
|||||||
.mailpoet-automation-editor-dropdown-toggle-link {
|
.mailpoet-automation-editor-dropdown-toggle-link {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
padding: 6px 0;
|
margin-top: 10px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.edit-site-document-actions__title {
|
|
||||||
margin: 0 0.5em;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
#mailpoet_automation_editor .interface-interface-skeleton__header {
|
#mailpoet_automation_editor .interface-interface-skeleton__header {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In automation editor we don't display the WP toolbar, but there is a css that adds space to the top of the page
|
|
||||||
// for the toolbar so we need to override it
|
|
||||||
.interface-interface-skeleton__html-container.wp-toolbar {
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
$separator-width: 1px;
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-separator {
|
.mailpoet-automation-editor-separator {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #c3c4c7;
|
background: #c3c4c7;
|
||||||
@ -7,78 +5,5 @@ $separator-width: 1px;
|
|||||||
height: 64px;
|
height: 64px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
white-space: nowrap;
|
width: 1px;
|
||||||
width: $separator-width;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-separator-curve-root {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-separator-curve-root-left,
|
|
||||||
.mailpoet-automation-editor-separator-curve-root-right {
|
|
||||||
border-bottom: $separator-width solid #c3c4c7;
|
|
||||||
border-bottom-right-radius: 70px 30px;
|
|
||||||
border-right: $separator-width solid #c3c4c7;
|
|
||||||
height: 20px;
|
|
||||||
justify-self: end;
|
|
||||||
width: 100%;
|
|
||||||
//box-shadow: 0 0 1px transparent;
|
|
||||||
|
|
||||||
&.mailpoet-automation-editor-separator-curve-root-left {
|
|
||||||
margin-right: calc(-1 * $separator-width / 2);
|
|
||||||
transform: scaleX(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.mailpoet-automation-editor-separator-curve-root-right {
|
|
||||||
margin-left: calc(-1 * $separator-width / 2);
|
|
||||||
transform: scaleX(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-separator-curve-leaf-left,
|
|
||||||
.mailpoet-automation-editor-separator-curve-leaf-right {
|
|
||||||
$width: 70px;
|
|
||||||
|
|
||||||
&.mailpoet-automation-editor-separator-curve-leaf-left {
|
|
||||||
transform: scaleX(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.mailpoet-automation-editor-separator-curve-leaf-right {
|
|
||||||
transform: scaleX(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cover rest of full-width line coming from curve root
|
|
||||||
&:before {
|
|
||||||
background: #fbfbfb;
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
height: 20px;
|
|
||||||
position: absolute;
|
|
||||||
right: calc(50% - $width);
|
|
||||||
top: 0;
|
|
||||||
width: calc(100% - $width);
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add curve leaf ending rounded to the bottom
|
|
||||||
&:after {
|
|
||||||
$offset: 0.5px; // vertical offset to prevent artifacts with scale/zoom
|
|
||||||
border-left: $separator-width solid #c3c4c7;
|
|
||||||
border-top: $separator-width solid #c3c4c7;
|
|
||||||
border-top-left-radius: 35px 20px;
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
height: 16px + $offset;
|
|
||||||
margin: calc(-1 * ($separator-width + $offset)) auto 0
|
|
||||||
calc(50% - $separator-width / 2);
|
|
||||||
transform-origin: left;
|
|
||||||
width: calc($width + $separator-width / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-editor-branch-badge {
|
|
||||||
height: 32px;
|
|
||||||
margin: 4px auto;
|
|
||||||
width: 32px;
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.mailpoet-automation-editor-step-wrapper {
|
.mailpoet-automation-editor-step-wrapper {
|
||||||
margin: 0 auto;
|
margin: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 280px;
|
width: 280px;
|
||||||
}
|
}
|
||||||
@ -27,10 +27,10 @@
|
|||||||
grid-gap: 12px;
|
grid-gap: 12px;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
margin: 4px;
|
margin: 4px auto;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: calc(100% - 8px);
|
width: 100%;
|
||||||
|
|
||||||
&.is-unknown-step {
|
&.is-unknown-step {
|
||||||
background: #f0f0f1;
|
background: #f0f0f1;
|
||||||
@ -81,13 +81,6 @@
|
|||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 8px;
|
padding: 12px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
> div {
|
|
||||||
display: flex;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
@import './core/steps';
|
|
@ -1,22 +0,0 @@
|
|||||||
.mailpoet-automation-if-else-yes,
|
|
||||||
.mailpoet-automation-if-else-no {
|
|
||||||
align-items: center;
|
|
||||||
border-radius: 999px;
|
|
||||||
display: flex;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-if-else-yes {
|
|
||||||
background: #edfaef;
|
|
||||||
border: 1px solid #008a20;
|
|
||||||
fill: #008a20;
|
|
||||||
//color: #007017;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mailpoet-automation-if-else-no {
|
|
||||||
background: #fcf0f1;
|
|
||||||
border: 1px solid #d63638;
|
|
||||||
fill: #d63638;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
@import './if-else';
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user