Compare commits
1 Commits
update-plu
...
4.51.2
Author | SHA1 | Date | |
---|---|---|---|
2b9fbe34ea |
@ -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:
|
||||
slack: circleci/slack@4.2.0
|
||||
jq: circleci/jq@3.0.0
|
||||
|
||||
slack-fail-post-step: &slack-fail-post-step
|
||||
post-steps:
|
||||
@ -99,12 +98,12 @@ executors:
|
||||
wpcli_php_max_wporg:
|
||||
<<: *default_job_config
|
||||
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:
|
||||
<<: *default_job_config
|
||||
docker:
|
||||
- image: mailpoet/wordpress:8.2_20241126.1
|
||||
- image: mailpoet/wordpress:8.1_20230307.1
|
||||
|
||||
wpcli_php_mysql_oldest:
|
||||
<<: *default_job_config
|
||||
@ -115,7 +114,7 @@ executors:
|
||||
wpcli_php_mysql_latest:
|
||||
<<: *default_job_config
|
||||
docker:
|
||||
- image: mailpoet/wordpress:8.2_20241126.1
|
||||
- image: mailpoet/wordpress:8.1_20230307.1
|
||||
- image: cimg/mysql:8.0
|
||||
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" }}
|
||||
- restore_cache:
|
||||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
||||
- restore_cache:
|
||||
key: composer-{{ checksum "../tests_env/composer.json" }}-{{ checksum "../tests_env/composer.lock" }}
|
||||
- restore_cache:
|
||||
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
||||
- restore_cache:
|
||||
@ -157,9 +154,9 @@ jobs:
|
||||
./tools/vendor/composer.phar validate --no-check-all --no-check-publish --working-dir=prefixer
|
||||
touch .env
|
||||
./do install
|
||||
./do compile:all --env production --skip-tests
|
||||
./do compile:all --env production
|
||||
./do doctrine:generate-cache
|
||||
../tests_env/vendor/bin/codecept build
|
||||
vendor/bin/codecept build
|
||||
./do twig:generate-cache
|
||||
- run:
|
||||
name: 'Check Prettier formatting'
|
||||
@ -180,10 +177,6 @@ jobs:
|
||||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
|
||||
paths:
|
||||
- vendor
|
||||
- save_cache:
|
||||
key: composer-{{ checksum "../tests_env/composer.json" }}-{{ checksum "../tests_env/composer.lock" }}
|
||||
paths:
|
||||
- ../tests_env/vendor
|
||||
- save_cache:
|
||||
key: composer-prefixed-{{ checksum "prefixer-checksum" }}
|
||||
paths:
|
||||
@ -197,10 +190,10 @@ jobs:
|
||||
- run:
|
||||
name: Download additional WP Plugins for tests
|
||||
command: |
|
||||
./do download:woo-commerce-zip 9.6.1
|
||||
./do download:woo-commerce-subscriptions-zip 7.1.0
|
||||
./do download:woo-commerce-memberships-zip 1.26.5
|
||||
./do download:automate-woo-zip 6.1.5
|
||||
./do download:woo-commerce-zip latest
|
||||
./do download:woo-commerce-subscriptions-zip 5.7.0
|
||||
./do download:woo-commerce-memberships-zip 1.25.2
|
||||
./do download:automate-woo-zip 6.0.10
|
||||
- run:
|
||||
name: Dump tests ENV variables for acceptance tests
|
||||
command: |
|
||||
@ -336,7 +329,6 @@ jobs:
|
||||
name: 'JS Newsletter Editor Tests'
|
||||
command: |
|
||||
mkdir test-results/mocha
|
||||
./do compile:js --env production --only-tests
|
||||
./do t:newsletter-editor test-results/mocha/newsletter_editor_junit.xml
|
||||
- run:
|
||||
name: 'JS Tests'
|
||||
@ -396,106 +388,65 @@ jobs:
|
||||
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:
|
||||
MYSQL_COMMAND: << parameters.mysql_command >>
|
||||
MYSQL_IMAGE: << parameters.mysql_image >>
|
||||
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
||||
WORDPRESS_IMAGE_VERSION: << parameters.wordpress_image_version >>
|
||||
WORDPRESS_VERSION: << parameters.wordpress_version >>
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /home/circleci
|
||||
- run:
|
||||
name: 'Set up virtual host'
|
||||
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:
|
||||
name: 'Pull test docker images'
|
||||
# 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:
|
||||
name: Create docker containers for test
|
||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||
command: |
|
||||
cd ../tests_env/docker
|
||||
docker compose create || docker compose create
|
||||
cd tests/docker
|
||||
docker-compose create || docker-compose create
|
||||
- run:
|
||||
# Some tools we use may need different version based on PHP version used in docker
|
||||
name: Ensure correct versions of tools
|
||||
command: |
|
||||
cd ../tests_env/docker
|
||||
docker compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_acceptance
|
||||
cd tests/docker
|
||||
docker-compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_acceptance
|
||||
- when:
|
||||
condition: ${WOOCOMMERCE_VERSION}
|
||||
condition: << parameters.woo_core_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Core
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
cd tests/docker
|
||||
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:
|
||||
condition: << parameters.woo_subscriptions_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Subscriptions
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- when:
|
||||
condition: << parameters.woo_memberships_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Memberships
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- when:
|
||||
condition: << parameters.automate_woo_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download AutomateWoo
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- run:
|
||||
name: Group acceptance tests
|
||||
command: |
|
||||
@ -515,7 +466,7 @@ jobs:
|
||||
name: Run acceptance tests
|
||||
command: |
|
||||
mkdir -m 777 -p tests/_output/exceptions
|
||||
cd ../tests_env/docker
|
||||
cd tests/docker
|
||||
args=(
|
||||
--steps
|
||||
--debug
|
||||
@ -524,7 +475,7 @@ jobs:
|
||||
--xml
|
||||
-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_JOB=${CIRCLE_JOB} \
|
||||
-e MULTISITE=<< parameters.multisite >> \
|
||||
@ -532,7 +483,6 @@ jobs:
|
||||
-e ENABLE_HPOS=<< parameters.enable_hpos >> \
|
||||
-e ENABLE_HPOS_SYNC=<< parameters.enable_hpos_sync >> \
|
||||
-e DISABLE_HPOS=<< parameters.disable_hpos >> \
|
||||
-e WORDPRESS_VERSION=${WORDPRESS_VERSION} \
|
||||
codeception_acceptance "${args[@]}"
|
||||
- run:
|
||||
name: Check exceptions
|
||||
@ -583,13 +533,13 @@ jobs:
|
||||
- run:
|
||||
name: 'Pull test docker images'
|
||||
# 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:
|
||||
name: Create docker containers for test
|
||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||
command: |
|
||||
cd tests/performance
|
||||
docker compose create || docker compose create
|
||||
docker-compose create || docker-compose create
|
||||
- run:
|
||||
name: Run performance tests
|
||||
command: |
|
||||
@ -653,15 +603,10 @@ jobs:
|
||||
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
|
||||
MYSQL_COMMAND: << parameters.mysql_command >>
|
||||
MYSQL_IMAGE: << parameters.mysql_image >>
|
||||
WORDPRESS_IMAGE_VERSION: << parameters.wordpress_image_version >>
|
||||
WORDPRESS_VERSION: << parameters.wordpress_version >>
|
||||
parameters:
|
||||
codeception_image_version:
|
||||
type: string
|
||||
default: ''
|
||||
wordpress_image_version:
|
||||
type: string
|
||||
default: ''
|
||||
group:
|
||||
type: string
|
||||
default: ''
|
||||
@ -701,102 +646,62 @@ jobs:
|
||||
automate_woo_version:
|
||||
type: string
|
||||
default: ''
|
||||
use_wordpress_beta:
|
||||
type: boolean
|
||||
default: false
|
||||
use_woocommerce_beta:
|
||||
type: boolean
|
||||
default: false
|
||||
wordpress_version:
|
||||
type: string
|
||||
default: ''
|
||||
steps:
|
||||
- attach_workspace:
|
||||
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:
|
||||
name: 'Pull test docker images'
|
||||
# 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:
|
||||
name: Create docker containers for test
|
||||
# We experienced some failures when creating containers so we do it explicitly with one retry
|
||||
command: |
|
||||
cd ../tests_env/docker
|
||||
docker compose create || docker compose create
|
||||
cd tests/docker
|
||||
docker-compose create || docker-compose create
|
||||
- run:
|
||||
# Some tools we use may need different version based on PHP version used in docker
|
||||
name: Ensure correct versions of tools
|
||||
command: |
|
||||
cd ../tests_env/docker
|
||||
docker compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_integration
|
||||
cd tests/docker
|
||||
docker-compose run --rm -w /project -e COMPOSER_DEV_MODE=1 --entrypoint "php tools/install.php" codeception_integration
|
||||
- when:
|
||||
condition: ${WOOCOMMERCE_VERSION}
|
||||
condition: << parameters.woo_core_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Core
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
cd tests/docker
|
||||
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:
|
||||
condition: << parameters.woo_subscriptions_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Subscriptions
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- when:
|
||||
condition: << parameters.woo_memberships_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download WooCommerce Memberships
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- when:
|
||||
condition: << parameters.automate_woo_version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Download AutomateWoo
|
||||
command: |
|
||||
cd ../tests_env/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
|
||||
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
|
||||
- run:
|
||||
name: 'PHP Integration tests'
|
||||
command: |
|
||||
mkdir -m 777 -p tests/_output/exceptions
|
||||
cd ../tests_env/docker
|
||||
cd tests/docker
|
||||
args=(
|
||||
--steps
|
||||
--debug
|
||||
@ -810,7 +715,7 @@ jobs:
|
||||
if [[ -n '<< parameters.skip_group >>' ]]; then
|
||||
args+=(--skip-group << parameters.skip_group >>)
|
||||
fi
|
||||
docker compose run -e SKIP_DEPS=1 \
|
||||
docker-compose run -e SKIP_DEPS=1 \
|
||||
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
|
||||
-e CIRCLE_JOB=${CIRCLE_JOB} \
|
||||
-e SKIP_PLUGINS=<< parameters.skip_plugins >> \
|
||||
@ -830,7 +735,6 @@ jobs:
|
||||
-e ENABLE_HPOS=<< parameters.enable_hpos >> \
|
||||
-e ENABLE_HPOS_SYNC=<< parameters.enable_hpos_sync >> \
|
||||
-e DISABLE_HPOS=<< parameters.disable_hpos >> \
|
||||
-e WORDPRESS_VERSION=${WORDPRESS_VERSION} \
|
||||
codeception_integration "${args[@]}"
|
||||
- store_test_results:
|
||||
path: tests/_output
|
||||
@ -863,30 +767,6 @@ jobs:
|
||||
root: /home/circleci/mailpoet
|
||||
paths:
|
||||
- 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:
|
||||
build_and_test:
|
||||
@ -940,28 +820,48 @@ workflows:
|
||||
name: acceptance_tests_base_and_woo
|
||||
enable_hpos: 1
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: acceptance_tests_woo_hpos_sync_on
|
||||
group: woo
|
||||
enable_hpos_sync: 1
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: acceptance_tests_woo_hpos_off
|
||||
group: woo
|
||||
disable_hpos: 1
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: acceptance_tests_blockbased_theme
|
||||
group: frontend
|
||||
blockbased_theme: 1
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- performance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: performance_tests
|
||||
requires:
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- js_tests:
|
||||
<<: *slack-fail-post-step
|
||||
requires:
|
||||
@ -972,41 +872,55 @@ workflows:
|
||||
enable_hpos_sync: 1
|
||||
name: integration_test_woo_hpos_sync_on
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- integration_tests:
|
||||
<<: *slack-fail-post-step
|
||||
group: woo
|
||||
name: integration_test_woo_hpos_on
|
||||
enable_hpos: 1
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- integration_tests:
|
||||
<<: *slack-fail-post-step
|
||||
group: woo
|
||||
disable_hpos: 1
|
||||
name: integration_test_woo_hpos_off
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- integration_tests:
|
||||
<<: *slack-fail-post-step
|
||||
skip_group: woo
|
||||
skip_plugins: 1
|
||||
name: integration_test_base
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
<<: *multisite_acceptance_config
|
||||
name: acceptance_tests_multisite
|
||||
requires:
|
||||
- build
|
||||
- integration_tests:
|
||||
<<: *slack-fail-post-step
|
||||
<<: *only_trunk_and_release
|
||||
multisite: 1
|
||||
name: integration_tests_multisite
|
||||
requires:
|
||||
- build
|
||||
- unit_tests
|
||||
- static_analysis_php7
|
||||
- static_analysis_php8
|
||||
- qa_js
|
||||
- qa_php
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
<<: *only_release
|
||||
@ -1035,27 +949,15 @@ workflows:
|
||||
- integration_test_woo_hpos_on
|
||||
- integration_test_woo_hpos_off
|
||||
- integration_test_woo_hpos_sync_on
|
||||
- integration_with_premium_latest
|
||||
- acceptance_tests_woo_hpos_sync_on
|
||||
- acceptance_tests_woo_hpos_off
|
||||
- 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
|
||||
- performance_tests
|
||||
|
||||
nightly:
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: '0 1 * * 1-5'
|
||||
cron: '0 22 * * 1-5'
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
@ -1066,6 +968,10 @@ workflows:
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: acceptance_latest
|
||||
woo_core_version: latest
|
||||
woo_subscriptions_version: latest
|
||||
woo_memberships_version: latest
|
||||
automate_woo_version: latest
|
||||
mysql_image: mysql:8.3
|
||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
||||
requires:
|
||||
@ -1075,6 +981,10 @@ workflows:
|
||||
name: acceptance_latest_blockbased_theme
|
||||
group: frontend
|
||||
blockbased_theme: 1
|
||||
woo_core_version: latest
|
||||
woo_subscriptions_version: latest
|
||||
woo_memberships_version: latest
|
||||
automate_woo_version: latest
|
||||
mysql_image: mysql:8.3
|
||||
mysql_command: --default-authentication-plugin=mysql_native_password
|
||||
requires:
|
||||
@ -1082,15 +992,14 @@ workflows:
|
||||
- acceptance_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: acceptance_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
|
||||
mysql_command: --max_allowed_packet=100M
|
||||
woo_core_version: 8.8.3
|
||||
woo_subscriptions_version: 5.6.0
|
||||
woo_memberships_version: 1.23.1
|
||||
automate_woo_version: 5.8.5
|
||||
mysql_command: --max_allowed_packet=100M --default-storage-engine=MYISAM
|
||||
mysql_image: mysql:5.5
|
||||
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
|
||||
wordpress_image_version: wp-6.4_php8.0_20231114.1
|
||||
requires:
|
||||
- build
|
||||
- performance_tests:
|
||||
@ -1123,14 +1032,12 @@ workflows:
|
||||
- integration_tests:
|
||||
<<: *slack-fail-post-step
|
||||
name: integration_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
|
||||
woo_core_version: 8.8.3
|
||||
woo_subscriptions_version: 5.6.0
|
||||
woo_memberships_version: 1.24.0
|
||||
automate_woo_version: 5.8.5
|
||||
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 # 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_command: --max_allowed_packet=100M --default-storage-engine=MYISAM
|
||||
mysql_image: mysql:5.5
|
||||
requires:
|
||||
- build
|
||||
@ -1143,36 +1050,6 @@ workflows:
|
||||
name: acceptance_with_premium_latest
|
||||
requires:
|
||||
- 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:
|
||||
<<: *slack-fail-post-step
|
||||
name: unit_with_premium_latest
|
||||
@ -1183,29 +1060,3 @@ workflows:
|
||||
name: integration_with_premium_latest
|
||||
requires:
|
||||
- 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
|
||||
max_line_length = off
|
||||
|
||||
[packages/php/email-editor/**]
|
||||
indent_style = tab
|
||||
|
||||
[packages/js/email-editor/**.{js,jsx,ts,tsx,scss}]
|
||||
indent_style = tab
|
||||
|
||||
[*.php]
|
||||
ij_php_align_key_value_pairs = 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_before_else_keyword = 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
|
||||
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);
|
||||
}
|
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
|
||||
tsconfig.tsbuildinfo
|
||||
/wordpress
|
||||
packages/php/*/vendor
|
||||
tests_env/vendor
|
||||
|
@ -7,6 +7,7 @@ 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_MINIMAL_PLUGIN_STANDARDS="${MP_GIT_HOOKS_MINIMAL_PLUGIN_STANDARDS:-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}"
|
||||
|
@ -4,5 +4,3 @@
|
||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
||||
|
||||
installIfUpdates
|
||||
|
||||
./do cleanup:cached-files
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
[ "$MP_GIT_HOOKS_ENABLE" != "true" ] && exit 0
|
||||
|
||||
npx lint-staged -c mailpoet/package.json --cwd mailpoet
|
||||
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-premium
|
||||
/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,65 @@
|
||||
# Contributing
|
||||
|
||||
There is a `./do` command that helps with the development process. See [README](README.md) for more details.
|
||||
There is a `./do` command that helps with the development process. See README.md for more details.
|
||||
|
||||
## PHP Code
|
||||
|
||||
- Two spaces indentation.
|
||||
- Space between keyword and left bracket (`if ()`, `for ()`, `switch ()`...).
|
||||
- `CamelCase` for classes.
|
||||
- `camelCase` for methods.
|
||||
- `snake_case` for variables and class properties.
|
||||
- Space between keyword (if, for, switch...) and left bracket
|
||||
- CamelCase for classes.
|
||||
- camelCase for methods.
|
||||
- snake_case for variables and class properties.
|
||||
- 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.
|
||||
- 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.
|
||||
- Ensure compatibility with PHP 7.4 and newer versions.
|
||||
- Ensure compatibility with PHP 7.1 and newer versions.
|
||||
- Cover your code in tests.
|
||||
|
||||
## SCSS Code
|
||||
|
||||
- `kebab-case` for file names.
|
||||
- Components files are prefixed with underscore, to indicate, that they aren't compiled separately (`_new-component.scss`).
|
||||
- camelCase for file name
|
||||
- Components files are prefixed with underscore, to indicate, that they aren't compiled separately.
|
||||
|
||||
## JS Code
|
||||
|
||||
- Javascript code should follow the [Airbnb style guide](https://github.com/airbnb/javascript).
|
||||
- Prefer named export before default export in JS and TS files
|
||||
- Default to TypeScript for new files.
|
||||
|
||||
## Disabling linting rules
|
||||
|
||||
- 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:
|
||||
- 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:
|
||||
`/* 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
|
||||
|
||||
- Do not commit to trunk.
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
## Issues creation
|
||||
|
||||
- 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.
|
||||
|
||||
## Migration from IdiORM to Doctrine
|
||||
|
||||
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).
|
||||
|
||||
## Feature flags
|
||||
|
||||
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.
|
||||
|
||||
- Feature flags can be enabled on the experimental page: `/admin.php?page=mailpoet-experimental`.
|
||||
- New feature flags can be added in the class `FeaturesController`.
|
||||
- Feature flags can be enabled on the experimental page: wp-admin/admin.php?page=mailpoet-experimental
|
||||
- New feature flags can be added in the class `FeaturesController`
|
||||
|
100
README.md
100
README.md
@ -1,23 +1,4 @@
|
||||
### Table of Contents
|
||||
|
||||
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
|
||||
# MailPoet
|
||||
|
||||
The **MailPoet** plugin monorepo.
|
||||
|
||||
@ -26,16 +7,16 @@ If you have **any questions or need help or support**, please see the [Support](
|
||||
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).
|
||||
|
||||
## Initial setup
|
||||
## 🔌 Initial setup
|
||||
|
||||
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"
|
||||
3. Run `./do start` to start the stack.
|
||||
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,
|
||||
the following tools are recommended:
|
||||
|
||||
@ -43,9 +24,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).
|
||||
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
|
||||
## 🔍 PHPStorm setup for XDebug
|
||||
|
||||
In `Languages & Preferences > PHP > Servers` set path mappings:
|
||||
|
||||
@ -62,7 +41,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).
|
||||
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.
|
||||
|
||||
@ -73,7 +52,7 @@ environment:
|
||||
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:
|
||||
|
||||
@ -85,12 +64,10 @@ mailpoet/vendor/bin/codecept -> /project/vendor/bin/codecept
|
||||
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
|
||||
|
||||
## 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:
|
||||
|
||||
@ -103,14 +80,14 @@ Then create a Docker Compose override file with NFS settings and restart contain
|
||||
```shell
|
||||
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
||||
|
||||
docker compose down -v --remove-orphans
|
||||
docker compose up -d
|
||||
docker-compose down -v --remove-orphans
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
**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/).
|
||||
|
||||
### Husky hooks
|
||||
# 🐶 Husky
|
||||
|
||||
We use [Husky](https://github.com/typicode/husky) to run automated checks in pre-commit hooks.
|
||||
|
||||
@ -125,9 +102,7 @@ export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
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:
|
||||
|
||||
@ -149,7 +124,11 @@ Options:
|
||||
|
||||
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:
|
||||
|
||||
@ -163,13 +142,13 @@ To switch the environment to a different PHP version:
|
||||
dockerfile: dev/{PHP_VERSION}/Dockerfile
|
||||
```
|
||||
|
||||
3. Run `docker compose build wordpress`.
|
||||
3. Run `docker-compose build wordpress`.
|
||||
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`.
|
||||
|
||||
### Disabling the Tracy panel
|
||||
## Disabling the Tracy panel
|
||||
|
||||
To disable the Tracy panel, add the following to `docker-compose.override.yml`:
|
||||
|
||||
@ -180,39 +159,6 @@ services:
|
||||
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.
|
||||
|
||||
#### 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
|
||||
- install woo commerce, members and other useful plugins by default
|
||||
|
14
SUPPORT.md
14
SUPPORT.md
@ -1,5 +1,13 @@
|
||||
# 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).
|
||||
When you need help, please visit our [Support](https://www.mailpoet.com/support) page.
|
||||
We have a team of Happiness Engineers ready to help you.
|
||||
|
||||
Free users can also ask questions in the [WordPress.org support forum](https://wordpress.org/support/plugin/mailpoet).
|
||||
|
||||
For feature Requests use our [tracker](https://feedback.mailpoet.com).
|
||||
|
@ -21,7 +21,7 @@ mkdir -p wordpress/wp-content/plugins/mailpoet-premium
|
||||
mkdir -p dev/data/mailhog
|
||||
|
||||
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 ] &&
|
||||
cd /var/www/html/wp-content/plugins/$plugin &&
|
||||
./do install &&
|
||||
@ -29,7 +29,7 @@ for plugin in "mailpoet" "mailpoet-premium"; do
|
||||
"
|
||||
done
|
||||
|
||||
docker compose run --rm wordpress /bin/sh -c "
|
||||
docker-compose run --rm wordpress /bin/sh -c "
|
||||
cd /var/www/templates &&
|
||||
mkdir assets classes exported
|
||||
"
|
||||
|
@ -29,6 +29,6 @@ cat <<EOT
|
||||
NFS volume sharing is set up. Recreate your containers and volumes using:
|
||||
cp docker-compose.override.macos-sample.yml docker-compose.override.yml
|
||||
|
||||
docker compose down -v --remove-orphans
|
||||
docker compose up -d
|
||||
docker-compose down -v --remove-orphans
|
||||
docker-compose up -d
|
||||
EOT
|
||||
|
16
do
16
do
@ -3,8 +3,8 @@
|
||||
function syntax {
|
||||
cat << EOF
|
||||
./do setup Setup the dev environment.
|
||||
./do start Start the docker containers (docker compose up -d).
|
||||
./do stop Stop the docker containers (docker compose stop).
|
||||
./do start Start the docker containers (docker-compose up -d).
|
||||
./do stop Stop the docker containers (docker-compose stop).
|
||||
./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 acceptance [--premium] Run acceptance tests.
|
||||
@ -21,7 +21,7 @@ EOF
|
||||
function ssh_and_run {
|
||||
params=("$@")
|
||||
params=("${params[@]:1}")
|
||||
docker compose exec $1 bash -c "${params[@]}"
|
||||
docker-compose exec $1 bash -c "${params[@]}"
|
||||
}
|
||||
|
||||
if [ "$1" = "" -o "$1" = "--help" ]; then
|
||||
@ -31,10 +31,10 @@ elif [ "$1" = "setup" ]; then
|
||||
./dev/initial-setup.sh
|
||||
|
||||
elif [ "$1" = "start" ]; then
|
||||
docker compose up -d
|
||||
docker-compose up -d
|
||||
|
||||
elif [ "$1" = "stop" ]; then
|
||||
docker compose stop
|
||||
docker-compose stop
|
||||
|
||||
elif [ "$1" = "run" ]; then
|
||||
params=("$@")
|
||||
@ -54,9 +54,9 @@ elif [ "$1" = "ssh" ]; then
|
||||
fi
|
||||
|
||||
if [ "$2" = "--test" ] || [ "$3" = "--test" ]; then
|
||||
docker compose exec --workdir $dir test_wordpress bash
|
||||
docker-compose exec --workdir $dir test_wordpress bash
|
||||
else
|
||||
docker compose exec --workdir $dir wordpress bash
|
||||
docker-compose exec --workdir $dir wordpress bash
|
||||
fi
|
||||
|
||||
elif [ "$1" = "acceptance" ]; then
|
||||
@ -65,7 +65,7 @@ elif [ "$1" = "acceptance" ]; then
|
||||
else
|
||||
cd mailpoet
|
||||
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 ..
|
||||
|
||||
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 Subscriber (addSubscriber)](api_methods/AddSubscriber.md)
|
||||
- [Update Subscriber (updateSubscriber)](api_methods/UpdateSubscriber.md)
|
||||
- [Add Subscriber Field (addSubscriberField)](api_methods/AddSubscriberField.md)
|
||||
- [Delete List (deleteList)](api_methods/DeleteList.md)
|
||||
- [Get Lists (getLists)](api_methods/GetLists.md)
|
||||
|
@ -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:
|
||||
# for M1 Macs
|
||||
db:
|
||||
|
@ -1,3 +1,5 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
dashboard:
|
||||
container_name: mp-dashboard
|
||||
@ -25,12 +27,13 @@ services:
|
||||
container_name: mp-wp
|
||||
build:
|
||||
context: .
|
||||
dockerfile: dev/php82/Dockerfile
|
||||
dockerfile: dev/php81/Dockerfile
|
||||
args:
|
||||
UID: ${UID:-1000}
|
||||
GID: ${GID:-1000}
|
||||
ports:
|
||||
- '8002:80'
|
||||
- '8083:8083' # Storybook port number, see package.json
|
||||
depends_on:
|
||||
- db
|
||||
- smtp
|
||||
@ -49,12 +52,10 @@ services:
|
||||
volumes:
|
||||
- './wordpress:/var/www/html'
|
||||
- './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'
|
||||
- './pnpm-lock.yaml:/var/www/html/wp-content/plugins/pnpm-lock.yaml'
|
||||
- './pnpm-workspace.yaml:/var/www/html/wp-content/plugins/pnpm-workspace.yaml'
|
||||
- './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-premium:/var/www/html/wp-content/plugins/mailpoet-premium'
|
||||
- './packages:/var/www/html/wp-content/plugins/packages'
|
||||
|
@ -51,6 +51,7 @@ MP_GIT_HOOKS_ESLINT=true
|
||||
MP_GIT_HOOKS_STYLELINT=true
|
||||
MP_GIT_HOOKS_PHPLINT=true
|
||||
MP_GIT_HOOKS_CODE_SNIFFER=true
|
||||
MP_GIT_HOOKS_MINIMAL_PLUGIN_STANDARDS=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/_phpstan-wp-source.neon
|
||||
/tools/vendor
|
||||
/storybook-static
|
||||
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,26 @@
|
||||
### Table of Contents
|
||||
# MailPoet
|
||||
|
||||
1. [MailPoet](#mailpoet)
|
||||
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)
|
||||
The **MailPoet** plugin.
|
||||
|
||||
## MailPoet
|
||||
If you have **any questions or need help or support**, please see the [Support](../SUPPORT.md) document.
|
||||
|
||||
- For help with product, visit [SUPPORT](../SUPPORT.md).
|
||||
- To use the Docker-based development environment, see [monorepo README](../README.md).
|
||||
- To use plugin code directly, follow instructions below.
|
||||
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.
|
||||
|
||||
## Contents
|
||||
|
||||
- [Setup](#setup)
|
||||
- [Frameworks and libraries](#frameworks-and-libraries)
|
||||
- [Workflow Commands](#workflow-commands)
|
||||
- [Coding and Testing](#coding-and-testing)
|
||||
|
||||
## Setup
|
||||
|
||||
### Requirements
|
||||
|
||||
- PHP >= 7.4
|
||||
- PHP >= 7.3 (only for the development environment, to run the plugin PHP >= 7.2 is required)
|
||||
- NodeJS
|
||||
- WordPress
|
||||
|
||||
@ -50,8 +48,9 @@ cp .env.sample .env
|
||||
./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)).
|
||||
- [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.
|
||||
@ -127,6 +126,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
|
||||
```
|
||||
|
||||
## 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
|
||||
|
||||
### DI
|
||||
@ -142,23 +169,9 @@ Dependencies handled by PHP-Scoper are configured in extra configuration files `
|
||||
|
||||
### 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
|
||||
|
||||
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
|
||||
**in PHP code**
|
||||
|
||||
```php
|
||||
__('text to translate', 'mailpoet');
|
||||
@ -167,7 +180,7 @@ _x('text to translate', 'context', 'mailpoet');
|
||||
_xn('single text', 'plural text', $number, 'context', 'mailpoet');
|
||||
```
|
||||
|
||||
#### In JavaScript/TypeScript code
|
||||
**in JavaScript/TypeScript code**
|
||||
|
||||
```ts
|
||||
import { __, _n, _x, _xn } from '@wordpress/i18n';
|
||||
|
@ -23,7 +23,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $this->taskExecStack()
|
||||
->stopOnFail()
|
||||
->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')
|
||||
->addCode([$this, 'cleanupCachedFiles'])
|
||||
->run();
|
||||
@ -33,7 +32,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
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();
|
||||
}
|
||||
@ -85,8 +83,12 @@ class RoboFile extends \Robo\Tasks {
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
$excludePackages = [
|
||||
'tinymce',
|
||||
'react-router-dom', // MAILPOET-3911
|
||||
'react-tooltip', // MAILPOET-5482
|
||||
'codemirror', // MAILPOET-5483
|
||||
'@babel/preset-env', // MAILPOET-5489
|
||||
'react-string-replace', // MAILPOET-5490
|
||||
'babel-loader', // MAILPOET-5491
|
||||
'stylelint', // MAILPOET-5462
|
||||
'backbone', // Will remove with new email editor
|
||||
@ -189,7 +191,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
$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, 'skip-tests' => false]) {
|
||||
$collection = $this->collectionBuilder();
|
||||
$collection->addCode(function() use ($opts) {
|
||||
return call_user_func([$this, 'compileJs'], $opts);
|
||||
@ -200,17 +202,15 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $collection->run();
|
||||
}
|
||||
|
||||
public function compileJs($opts = ['env' => null, 'skip-tests' => false, 'only-tests' => false]) {
|
||||
public function compileJs($opts = ['env' => null, 'skip-tests' => false]) {
|
||||
if (!is_dir('assets/dist/js')) {
|
||||
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']) ?
|
||||
sprintf('./node_modules/.bin/cross-env NODE_ENV="%s"', $opts['env']) :
|
||||
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 --env BUILD_TESTS=' . ($opts['skip-tests'] ? 'skip' : 'build'));
|
||||
}
|
||||
|
||||
public function compileCss($opts = ['env' => null]) {
|
||||
@ -222,7 +222,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
|
||||
$compilationResult = $this->taskExecStack()
|
||||
->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')
|
||||
->run();
|
||||
|
||||
@ -266,6 +266,8 @@ class RoboFile extends \Robo\Tasks {
|
||||
'vendor',
|
||||
'vendor-prefixed',
|
||||
'RoboFile.php',
|
||||
'.storybook',
|
||||
'storybook-static',
|
||||
]);
|
||||
|
||||
$headers = escapeshellarg(
|
||||
@ -332,7 +334,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
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']) {
|
||||
$command .= ' -f ' . $opts['file'];
|
||||
@ -349,7 +351,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
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, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false, 'stop-on-fail' => false]) {
|
||||
return $this->runTestsInContainer(array_merge($opts, ['test_type' => 'integration']));
|
||||
}
|
||||
|
||||
@ -369,7 +371,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
$command = join(' ', [
|
||||
'./node_modules/.bin/mocha',
|
||||
'-r tests/javascript-newsletter-editor/mocha-test-helper.js',
|
||||
'-r tests/javascript-newsletter-editor/mocha-chai.mjs',
|
||||
'tests/javascript-newsletter-editor/testBundles/**/*.js',
|
||||
'--exit',
|
||||
]);
|
||||
@ -386,7 +387,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
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)) {
|
||||
$command .= sprintf(
|
||||
@ -406,7 +407,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
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, 'disable-hpos' => false, 'enable-hpos-sync' => false, 'enable-hpos' => false]) {
|
||||
return $this->runTestsInContainer($opts);
|
||||
}
|
||||
|
||||
@ -422,7 +423,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
->option('env', 'US=' . $opts['us'])
|
||||
->option('env', 'PW=' . $opts['pw'])
|
||||
->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'])
|
||||
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
||||
->dir($dir)->run();
|
||||
@ -439,7 +440,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
->option('env', 'SCENARIO=' . $opts['scenario'])
|
||||
->option('env', 'K6_CLOUD_TOKEN=' . getenv('K6_CLOUD_TOKEN'))
|
||||
->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('out', 'cloud')
|
||||
->arg($path ?? "$dir/tests/performance/scenarios.js")
|
||||
@ -476,14 +476,14 @@ class RoboFile extends \Robo\Tasks {
|
||||
|
||||
// import data & run 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')
|
||||
->run();
|
||||
$this->say('Data imported, WordPress set up.');
|
||||
}
|
||||
|
||||
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')
|
||||
->run();
|
||||
}
|
||||
@ -497,8 +497,8 @@ class RoboFile extends \Robo\Tasks {
|
||||
*/
|
||||
public function deleteDocker() {
|
||||
return $this->taskExec(
|
||||
'docker compose down -v --remove-orphans --rmi all'
|
||||
)->dir(__DIR__ . '/../tests_env/docker')->run();
|
||||
'docker-compose down -v --remove-orphans --rmi all'
|
||||
)->dir(__DIR__ . '/tests/docker')->run();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -507,20 +507,20 @@ class RoboFile extends \Robo\Tasks {
|
||||
public function resetTestDocker() {
|
||||
return $this
|
||||
->taskExec(
|
||||
'docker compose down -v --remove-orphans'
|
||||
)->dir(__DIR__ . '/../tests_env/docker')
|
||||
'docker-compose down -v --remove-orphans'
|
||||
)->dir(__DIR__ . '/tests/docker')
|
||||
->addCode([$this, 'cleanupCachedFiles'])
|
||||
->run();
|
||||
}
|
||||
|
||||
public function testFailedUnit() {
|
||||
$this->_exec('../tests_env/vendor/bin/codecept build');
|
||||
return $this->_exec('../tests_env/vendor/bin/codecept run unit -g failed');
|
||||
$this->_exec('vendor/bin/codecept build');
|
||||
return $this->_exec('vendor/bin/codecept run unit -g failed');
|
||||
}
|
||||
|
||||
public function testFailedIntegration() {
|
||||
$this->_exec('../tests_env/vendor/bin/codecept build');
|
||||
return $this->_exec('../tests_env/vendor/bin/codecept run integration -g failed');
|
||||
$this->_exec('vendor/bin/codecept build');
|
||||
return $this->_exec('vendor/bin/codecept run integration -g failed');
|
||||
}
|
||||
|
||||
public function containerDump() {
|
||||
@ -624,6 +624,9 @@ class RoboFile extends \Robo\Tasks {
|
||||
$collection->addCode(function() {
|
||||
return $this->qaCodeSniffer([]);
|
||||
});
|
||||
$collection->addCode(function() {
|
||||
return $this->qaMinimalPluginStandard([]);
|
||||
});
|
||||
return $collection->run();
|
||||
}
|
||||
|
||||
@ -650,7 +653,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
'lib/',
|
||||
'lib-3rd-party/',
|
||||
'vendor/composer',
|
||||
'vendor/dragonmantank',
|
||||
'vendor/mtdowling',
|
||||
'vendor-prefixed/',
|
||||
'vendor-prefixed/soundasleep',
|
||||
'mailpoet.php',
|
||||
@ -666,7 +669,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
'vendor-prefixed/cerdic/css-tidy/COPYING',
|
||||
'vendor-prefixed/cerdic/css-tidy/NEWS',
|
||||
'vendor-prefixed/cerdic/css-tidy/testing',
|
||||
'vendor/dragonmantank/cron-expression/tests',
|
||||
'vendor/mtdowling/cron-expression/tests',
|
||||
'vendor/phpmailer/phpmailer/test',
|
||||
'vendor-prefixed/psr/log/Psr/Log/Test',
|
||||
'vendor-prefixed/sabberworm/php-css-parser/tests',
|
||||
@ -686,21 +689,11 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
public function qaLintJavascript() {
|
||||
$collection = $this->collectionBuilder();
|
||||
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();
|
||||
return $this->_exec('pnpm run check-types && pnpm run lint');
|
||||
}
|
||||
|
||||
public function qaLintCss() {
|
||||
$collection = $this->collectionBuilder();
|
||||
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();
|
||||
return $this->_exec('pnpm run stylelint-check -- "assets/css/src/**/*.scss"');
|
||||
}
|
||||
|
||||
public function qaCodeSniffer(array $filesToCheck, $opts = ['severity' => 'all']) {
|
||||
@ -729,7 +722,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
'tasks/code_sniffer/vendor',
|
||||
'tasks/phpstan/vendor',
|
||||
'tasks/makepot',
|
||||
'tasks/minimal-plugin-standard/vendor',
|
||||
'tools/vendor',
|
||||
'tools/wpscan-semgrep-rules',
|
||||
'temp',
|
||||
@ -754,6 +746,58 @@ class RoboFile extends \Robo\Tasks {
|
||||
->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',
|
||||
'tools/wpscan-semgrep-rules',
|
||||
'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) {
|
||||
$extension = pathinfo($filePath, PATHINFO_EXTENSION);
|
||||
if ($extension === 'php') {
|
||||
@ -761,7 +805,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $this->collectionBuilder()
|
||||
->taskExec(
|
||||
'./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 ' .
|
||||
$filePath . ' -n'
|
||||
)
|
||||
@ -787,7 +831,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
// 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
|
||||
// from vendor/autoload.php where some dev dependencies cause conflicts.
|
||||
@ -811,8 +855,12 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $this->_exec('./tools/semgrep.sh lib/ lib-3rd-party/');
|
||||
}
|
||||
|
||||
public function qaQitSecurity() {
|
||||
return $this->_exec('./vendor/bin/qit run:security mailpoet --zip=mailpoet.zip --wait');
|
||||
public function storybookBuild() {
|
||||
return $this->_exec('pnpm run build-storybook');
|
||||
}
|
||||
|
||||
public function storybookWatch() {
|
||||
return $this->_exec('pnpm run storybook');
|
||||
}
|
||||
|
||||
public function svnCheckout() {
|
||||
@ -1091,9 +1139,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
->addCode(function () {
|
||||
return $this->releaseDownloadZip();
|
||||
})
|
||||
->addCode(function () use ($version) {
|
||||
return $this->releaseVerifyDownloadedZip($version);
|
||||
})
|
||||
->addCode(function () {
|
||||
return $this->translationsGetPotFileFromBuild();
|
||||
})
|
||||
@ -1118,9 +1163,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
->addCode(function () {
|
||||
return $this->releaseMergePullRequest(\MailPoetTasks\Release\GitHubController::RELEASE_SOURCE_BRANCH);
|
||||
})
|
||||
->addCode(function () {
|
||||
return $this->releaseDeleteDownloadedZip();
|
||||
})
|
||||
->run();
|
||||
}
|
||||
|
||||
@ -1279,29 +1321,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
$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() {
|
||||
$circleciController = $this->createCircleCiController();
|
||||
$path = $circleciController->downloadLatestBuild(self::ZIP_BUILD_PATH);
|
||||
@ -1309,12 +1328,6 @@ class RoboFile extends \Robo\Tasks {
|
||||
$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) {
|
||||
$jiraController = $this->createJiraController();
|
||||
$version = $jiraController->getVersion($version);
|
||||
@ -1611,9 +1624,9 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
$annotationReaderProvider = new \MailPoet\Doctrine\Annotations\AnnotationReaderProvider();
|
||||
$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([
|
||||
'driverClass' => \MailPoet\Doctrine\ConnectionFactory::DRIVER_CLASS,
|
||||
'driver' => \MailPoet\Doctrine\ConnectionFactory::DRIVER,
|
||||
'platform' => new $platformClass,
|
||||
], $configuration);
|
||||
}
|
||||
@ -1622,8 +1635,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
$testType = $opts['test_type'] ?? 'acceptance';
|
||||
$this->doctrineGenerateCache();
|
||||
return $this->taskExec(
|
||||
'COMPOSE_HTTP_TIMEOUT=200 docker compose run ' .
|
||||
(isset($opts['wordpress-version']) && $opts['wordpress-version'] ? '-e WORDPRESS_VERSION=' . $opts['wordpress-version'] . ' ' : '') .
|
||||
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
|
||||
(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-hpos-sync']) && $opts['enable-hpos-sync'] ? '-e ENABLE_HPOS_SYNC=1 ' : '') .
|
||||
@ -1637,7 +1649,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
(isset($opts['skip-group']) && $opts['skip-group'] ? '--skip-group ' . $opts['skip-group'] . ' ' : '') .
|
||||
(isset($opts['stop-on-fail']) && $opts['stop-on-fail'] ? '-f ' : '') .
|
||||
(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 {
|
||||
|
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.
@ -1,4 +1,4 @@
|
||||
@import '../components-automation/colors';
|
||||
@import 'colors';
|
||||
|
||||
.mailpoet-automation-analytics-title {
|
||||
color: $color-gutenberg-grey-700;
|
||||
@ -12,7 +12,7 @@
|
||||
color: $color-gutenberg-grey-900;
|
||||
}
|
||||
|
||||
.mailpoet-automation-status {
|
||||
.mailpoet-analytics-badge {
|
||||
display: inline-block;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
@import '../components-automation/colors';
|
||||
@import './colors';
|
||||
|
||||
.mailpoet-automation-analytics-overview {
|
||||
background: $color-white;
|
||||
|
@ -1,4 +1,4 @@
|
||||
@import '../../components-automation/colors';
|
||||
@import '../colors';
|
||||
|
||||
.mailpoet-automation-editor-stats-placeholder {
|
||||
.mailpoet-automation-stats-label {
|
||||
@ -20,8 +20,8 @@
|
||||
.mailpoet-automation-editor-step-icon {
|
||||
background: $color-gutenberg-grey-100;
|
||||
border-radius: 50%;
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
height: 49px;
|
||||
width: 49px;
|
||||
}
|
||||
|
||||
.mailpoet-automation-editor-step-title {
|
||||
|
@ -1,4 +1,5 @@
|
||||
@import '../../components-automation/colors';
|
||||
@import '../colors';
|
||||
@import 'mixins';
|
||||
|
||||
.mailpoet-analytics-main-value {
|
||||
font-size: 13px;
|
||||
@ -7,6 +8,14 @@
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.mailpoet-analytics-badge {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mailpoet-analytics-badge-text {
|
||||
@include badge;
|
||||
}
|
||||
|
||||
.mailpoet-automation-analytics-email-name {
|
||||
max-width: 300px;
|
||||
}
|
||||
@ -15,6 +24,24 @@
|
||||
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 {
|
||||
color: $color-gutenberg-grey-600;
|
||||
font-size: 12px;
|
||||
|
@ -1,4 +1,4 @@
|
||||
@import '../../components-automation/colors';
|
||||
@import '../colors';
|
||||
|
||||
.mailpoet-analytics-tabs {
|
||||
background: $color-white;
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import 'mixins';
|
||||
@import 'general';
|
||||
@import 'email';
|
||||
@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-subscribers {
|
||||
@ -14,7 +15,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet-analytics-activity-modal,
|
||||
.mailpoet-automation-analytics .woocommerce-table__item {
|
||||
a.mailpoet-analytics-orders__customer {
|
||||
align-items: flex-start;
|
||||
@ -26,9 +26,7 @@
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet-automation-analytics .woocommerce-table__item {
|
||||
.mailpoet-automations-analytics-order-products {
|
||||
align-items: center;
|
||||
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 {
|
||||
margin: 24px;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
@import '../../components-automation/colors';
|
||||
@import '../colors';
|
||||
|
||||
.mailpoet-analytics-clear-filters {
|
||||
margin-right: 8px;
|
||||
@ -26,7 +26,7 @@
|
||||
grid-template-columns: 20px 1fr;
|
||||
|
||||
.mailpoet-automation-colored-icon {
|
||||
padding: 2px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
p {
|
||||
@ -39,55 +39,3 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,6 @@
|
||||
|
||||
.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 {
|
||||
|
@ -1,15 +1,12 @@
|
||||
// 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 > div {
|
||||
.block-editor-block-icon {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
height: 24px;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.block-editor-block-icon {
|
||||
&.has-colors {
|
||||
svg {
|
||||
fill: currentColor;
|
||||
@ -29,10 +26,9 @@
|
||||
// indicated size.
|
||||
// See: https://github.com/WordPress/gutenberg/pull/9828
|
||||
svg {
|
||||
margin: -4px;
|
||||
max-height: 32px;
|
||||
max-width: 32px;
|
||||
min-height: 26px;
|
||||
min-width: 26px;
|
||||
max-height: 24px;
|
||||
max-width: 24px;
|
||||
min-height: 20px;
|
||||
min-width: 20px;
|
||||
}
|
||||
}
|
||||
|
@ -81,13 +81,6 @@
|
||||
box-sizing: content-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 8px;
|
||||
padding: 12px;
|
||||
position: relative;
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
@import 'colors';
|
||||
|
||||
.mailpoet-automation-status {
|
||||
background: $color-gutenberg-grey-100;
|
||||
border-radius: 2px;
|
||||
color: $color-gutenberg-grey-800;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
line-height: 16px;
|
||||
margin-right: 4px;
|
||||
padding: 4px 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mailpoet-automation-status-success {
|
||||
background: $color-wp-green-0;
|
||||
color: $color-wp-green-60;
|
||||
}
|
||||
|
||||
.mailpoet-automation-status-warning {
|
||||
background: $color-wp-yellow-0;
|
||||
color: $color-wp-yellow-60;
|
||||
}
|
||||
|
||||
.mailpoet-automation-status-error {
|
||||
background: $color-wp-red-0;
|
||||
color: $color-wp-red-60;
|
||||
}
|
@ -30,6 +30,8 @@
|
||||
.tox {
|
||||
/* Small style changes to better fit TinyMCE to our editor */
|
||||
&.tox-tinymce-inline {
|
||||
border: 1px solid $color-editor-border-content;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.05);
|
||||
|
||||
/* Fix for fixed TinyMCE toolbar to be above WP menu */
|
||||
@ -50,11 +52,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Override white button color when not selected or manipulated to let them match the background */
|
||||
.tox-tbtn:not(.tox-tbtn--enabled):not(:hover):not(:active) {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Slightly smaller TinyMCE button */
|
||||
.tox-tbtn:not(.tox-tbtn--select) {
|
||||
height: 28px;
|
||||
|
@ -1,16 +1,11 @@
|
||||
.mailpoet_history_wrapper {
|
||||
display: grid;
|
||||
grid-gap: $grid-gap;
|
||||
grid-template-columns: 26px 26px auto;
|
||||
display: flex;
|
||||
padding: 12px 20px;
|
||||
|
||||
.mailpoet_reset_template {
|
||||
justify-self: end;
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_history_arrow {
|
||||
cursor: pointer;
|
||||
margin-right: 20px;
|
||||
|
||||
svg {
|
||||
display: inline-block;
|
||||
|
@ -23,7 +23,8 @@
|
||||
height: 100%;
|
||||
left: 0;
|
||||
margin: 0 !important;
|
||||
overflow: hidden auto;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
|
@ -155,8 +155,3 @@
|
||||
.mailpoet_popup .mailpoet_browser_preview_toggle {
|
||||
top: -30px;
|
||||
}
|
||||
|
||||
.mailpoet_newsletter_styles label {
|
||||
display: block;
|
||||
margin-bottom: $grid-gap-half;
|
||||
}
|
||||
|
@ -40,7 +40,8 @@
|
||||
|
||||
.mailpoet_post_scroll_container {
|
||||
max-height: 400px;
|
||||
overflow: hidden scroll;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.mailpoet_settings_posts_single_post {
|
||||
|
@ -40,7 +40,8 @@
|
||||
|
||||
.mailpoet_product_scroll_container {
|
||||
max-height: 400px;
|
||||
overflow: hidden scroll;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.mailpoet_settings_products_single_product {
|
||||
|
@ -47,7 +47,7 @@
|
||||
background: $color-white;
|
||||
border: 1px solid $color-editor-border-content;
|
||||
margin-bottom: 9px;
|
||||
padding: 28px 9px (18px - 10px);
|
||||
padding: 28px 9px (18px - 10px) 9px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Fix for settings toolbar placement in header
|
||||
.edit-post-header {
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
// Fix for default appender appearance
|
||||
// We don't use any default block (WP Post editor has paragraph)
|
||||
// and CSS distributed within packages is works only with the paragraph block
|
||||
@ -126,7 +132,6 @@ h2 {
|
||||
|
||||
.edit-post-visual-editor {
|
||||
background-color: $color-white;
|
||||
height: 100%; // This is needed to catch all clicks to deselect a block
|
||||
padding: 50px 10px 100px;
|
||||
}
|
||||
|
||||
@ -135,19 +140,22 @@ h2 {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
// Hide block selector header with close button on desktops
|
||||
@include respond-to(not-small-screen) {
|
||||
.editor-inserter-sidebar__header {
|
||||
display: none;
|
||||
// Close button animation
|
||||
.edit-post-header-toolbar.edit-post-header-toolbar__left
|
||||
> .edit-post-header-toolbar__inserter-toggle {
|
||||
svg {
|
||||
transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
|
||||
}
|
||||
|
||||
&.is-pressed svg {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
// We don't have any patterns so we don't want to display tabs in the inserter panel
|
||||
.block-editor-inserter__tablist-and-close-button {
|
||||
display: none !important;
|
||||
}
|
||||
// Hide block selector header with close button on desktops
|
||||
|
||||
// Scrollable inserter sidebar panel
|
||||
.block-editor-inserter__tabs .block-editor-inserter__block-list {
|
||||
overflow-y: auto;
|
||||
@include respond-to(not-small-screen) {
|
||||
.edit-post-editor__inserter-panel-header {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
.form-placement-option-list {
|
||||
display: grid;
|
||||
grid-gap: $grid-gap;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
margin: 0 -8px;
|
||||
}
|
||||
|
||||
.form-placement-option {
|
||||
height: $form-placement-option-height;
|
||||
text-align: center;
|
||||
width: $form-placement-option-width;
|
||||
}
|
||||
|
||||
.form-placement-settings {
|
||||
|
@ -1,33 +1,9 @@
|
||||
// Fix for settings toolbar placement in header
|
||||
.edit-post-header {
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
// Header buttons spacing
|
||||
.mailpoet-editor-header-button {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
|
||||
@media (min-width: 600px) {
|
||||
margin-right: 12px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
|
||||
// Close button animation
|
||||
.editor-document-tools__left > .edit-post-header-toolbar__inserter-toggle {
|
||||
svg {
|
||||
transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
|
||||
}
|
||||
|
||||
&.edit-post-header-toolbar__inserter-toggle.is-pressed svg {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide preview button on mobile
|
||||
@include respond-to(small-screen) {
|
||||
.mailpoet-preview-button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
padding: 6px;
|
||||
pointer-events: auto;
|
||||
position: relative;
|
||||
|
@ -124,12 +124,8 @@
|
||||
padding-left: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
// This style hides the horizontal scrollbar in Firefox browser and add space for the support beacon
|
||||
// This style hides the horizontal scrollbar in Firefox browser
|
||||
.interface-interface-skeleton__sidebar {
|
||||
overflow-x: hidden;
|
||||
|
||||
div[role='tabpanel'] {
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ $task-icon-size: 32px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
justify-content: center;
|
||||
line-height: 20px;
|
||||
place-content: center;
|
||||
|
||||
p {
|
||||
color: $color-text-light;
|
||||
|
@ -67,8 +67,6 @@ p.sender_email_address_warning:first-child {
|
||||
.mailpoet-subscribers-in-plan {
|
||||
font-size: 18px;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.mailpoet-subscribers-in-plan-spacer {
|
||||
display: inline-block;
|
||||
@ -92,140 +90,27 @@ p.sender_email_address_warning:first-child {
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain_wrapper {
|
||||
ol {
|
||||
counter-reset: item;
|
||||
|
||||
li {
|
||||
counter-increment: item;
|
||||
list-style: none;
|
||||
margin: 24px 0 0 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
li:before {
|
||||
align-items: center;
|
||||
border: 1px solid #007cba;
|
||||
border-radius: 99999px;
|
||||
color: #007cba;
|
||||
content: counter(item);
|
||||
display: inline-flex;
|
||||
height: 24px;
|
||||
justify-content: center;
|
||||
margin-left: -44px;
|
||||
margin-right: 16px;
|
||||
position: absolute;
|
||||
width: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain_step_header {
|
||||
padding: 2px 0 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain {
|
||||
th,
|
||||
td {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.mailpoet_table_header {
|
||||
font-weight: 700 !important;
|
||||
text-align: center !important; // to prevent being overwritten by widefat table classes
|
||||
}
|
||||
|
||||
.dns_record_type_column {
|
||||
font-weight: 550 !important;
|
||||
padding: 16px;
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.mailpoet-form-input {
|
||||
border: 1px solid #757575;
|
||||
border-radius: 2px;
|
||||
width: 100%;
|
||||
text-align: center !important; // to prevent being overwritten by widefat table classes
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain_status {
|
||||
align-items: center;
|
||||
border-radius: 2px;
|
||||
display: inline-flex;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
gap: 4px;
|
||||
margin-left: 8px;
|
||||
padding: 4px 6px;
|
||||
|
||||
&.mailpoet_manage_sender_domain_status_valid {
|
||||
background: #edfaef;
|
||||
color: #005c12;
|
||||
}
|
||||
|
||||
&.mailpoet_manage_sender_domain_status_invalid {
|
||||
background: #fcf0f1;
|
||||
color: #8a2424;
|
||||
}
|
||||
|
||||
&.mailpoet_manage_sender_domain_status_pending {
|
||||
background: #f0f0f0;
|
||||
color: #757575;
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain_error {
|
||||
background: #fcf0f1;
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
grid-template-columns: auto 1fr;
|
||||
margin-bottom: 8px;
|
||||
padding: 12px 16px;
|
||||
|
||||
svg {
|
||||
color: #8a2424;
|
||||
height: 24px;
|
||||
margin-top: -2px;
|
||||
width: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.mailpoet_manage_sender_domain_item_error {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
grid-template-columns: auto 1fr;
|
||||
margin-top: 8px;
|
||||
|
||||
svg {
|
||||
color: #cc1818;
|
||||
height: 18px;
|
||||
margin-top: 1px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
strong {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
ins {
|
||||
background: #22918b;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
del {
|
||||
background: #fae8e8;
|
||||
color: #cc1818;
|
||||
text-decoration: none;
|
||||
}
|
||||
.mailpoet_manage_sender_domain_actions {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
body .components-modal__screen-overlay {
|
||||
z-index: 9999999; // increased to overlay Gutenberg block inserter
|
||||
}
|
||||
|
||||
.mailpoet-help-modal.components-modal__frame,
|
||||
.mailpoet-premium-modal.components-modal__frame,
|
||||
.mailpoet-welcome-wizard-confirmation-modal.components-modal__frame {
|
||||
.mailpoet-premium-modal.components-modal__frame {
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user