Files
piratepoet/.circleci/config.yml
github-actions[bot] 0898ed7b56 Update used Automate Woo plugin in Circle CI
- latest version: 6.1.11
 - previous version: 6.0.33
2025-05-05 13:37:22 +02:00

1348 lines
47 KiB
YAML

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:
- slack/notify:
channel: mailpoet-dev-feeds
branch_pattern: 'trunk,release'
event: fail
custom: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Job Failed :red_circle:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Job*: ${CIRCLE_JOB}"
},
{
"type": "mrkdwn",
"text": "*Project*: $CIRCLE_PROJECT_REPONAME"
},
{
"type": "mrkdwn",
"text": "*Branch*: $CIRCLE_BRANCH"
},
{
"type": "mrkdwn",
"text": "*Author*: $CIRCLE_USERNAME"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Job"
},
"url": "${CIRCLE_BUILD_URL}"
}
]
}
]
}
anchors:
default_job_config: &default_job_config
resource_class: small
working_directory: /home/circleci/mailpoet/mailpoet
environment:
TZ: /usr/share/zoneinfo/Etc/UTC
only_trunk_and_release: &only_trunk_and_release
filters:
branches:
only:
- trunk
- release
only_release: &only_release
filters:
branches:
only:
- release
multisite_acceptance_config: &multisite_acceptance_config
multisite: 1
requires:
- unit_tests
- static_analysis_php8
<<: *only_trunk_and_release
command_add_github_key: &command_add_github_key
command: |
# Add GitHub to known_hosts (for jobs without a checkout step that need to clone repos)
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
executors:
wpcli_php_oldest:
<<: *default_job_config
docker:
- image: mailpoet/wordpress:7.4_20231129.1
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
wpcli_php_latest:
<<: *default_job_config
docker:
- image: mailpoet/wordpress:8.3_20250305.1
wpcli_php_mysql_oldest:
<<: *default_job_config
docker:
- image: mailpoet/wordpress:7.4_20231129.1
- image: cimg/mysql:5.7
wpcli_php_mysql_latest:
<<: *default_job_config
docker:
- image: mailpoet/wordpress:8.3_20250305.1
- image: cimg/mysql:8.0
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_520_ci
jobs:
build:
executor: wpcli_php_latest
resource_class: medium+
working_directory: /home/circleci/mailpoet/mailpoet
steps:
- checkout:
path: /home/circleci/mailpoet
- run:
name: 'Set PNPM store directory'
command: pnpm config set store-dir ~/.pnpm-store
- run:
name: 'Compute checksum for prefixer'
command: find prefixer -type f -not -path 'prefixer/build/*' -not -path 'prefixer/vendor/*' | sort | xargs cat | sha512sum > prefixer-checksum
- restore_cache:
key: tools-{{ checksum "tools/install.php" }}
- restore_cache:
key: composer-{{ checksum "tasks/phpstan/composer.json" }}-{{ checksum "tasks/phpstan/composer.lock" }}
- restore_cache:
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:
keys:
- pnpm-{{ checksum "../pnpm-lock.yaml" }}
- pnpm- # fallback to most recent pnpm-* if not found by checksum
- run:
name: 'Set up test environment'
command: |
COMPOSER_DEV_MODE=1 php tools/install.php
./tools/vendor/composer.phar validate --no-check-all --no-check-publish
./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 doctrine:generate-cache
../tests_env/vendor/bin/codecept build
./do twig:generate-cache
- run:
name: 'Check Prettier formatting'
command: ./do qa:prettier-check
- save_cache:
key: tools-{{ checksum "tools/install.php" }}
paths:
- tools/vendor
- save_cache:
key: composer-{{ checksum "tasks/phpstan/composer.json" }}-{{ checksum "tasks/phpstan/composer.lock" }}
paths:
- tasks/phpstan/vendor
- save_cache:
key: composer-{{ checksum "tasks/code_sniffer/composer.json" }}-{{ checksum "tasks/code_sniffer/composer.lock" }}
paths:
- tasks/code_sniffer/vendor
- save_cache:
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:
- prefixer/build
- prefixer/vendor
- vendor-prefixed
- save_cache:
key: pnpm-{{ checksum "../pnpm-lock.yaml" }}
paths:
- ~/.pnpm-store
- run:
name: Download additional WP Plugins for tests
command: |
./do download:woo-commerce-zip 9.8.3
./do download:woo-commerce-subscriptions-zip 7.4.0
./do download:woo-commerce-memberships-zip
./do download:automate-woo-zip 6.1.11
- run:
name: Dump tests ENV variables for acceptance tests
command: |
(printenv | grep WP_TEST_ > .env) || true
- persist_to_workspace:
root: /home/circleci
paths:
- .node
- mailpoet
build_premium:
executor: wpcli_php_latest
resource_class: medium
working_directory: /home/circleci/mailpoet
steps:
- attach_workspace:
at: /home/circleci
- add_ssh_keys
- run:
name: 'Add GitHub to known_hosts'
<<: *command_add_github_key
- run:
name: 'Install Premium plugin'
command: |
git clone ${MAILPOET_PREMIUM_REPO_URL} mailpoet-premium
- restore_cache:
key: premium-tools-{{ checksum "mailpoet-premium/tools/install.php" }}
- restore_cache:
key: premium-composer-{{ checksum "mailpoet-premium/composer.json" }}-{{ checksum "mailpoet-premium/composer.lock" }}
- run:
name: 'Set up test environment'
command: |
# install Premium dependencies
MAILPOET_FREE_PATH=$(pwd)/mailpoet
cd mailpoet-premium
COMPOSER_DEV_MODE=1 php tools/install.php
echo "MAILPOET_FREE_PATH=${MAILPOET_FREE_PATH}" > .env
./tools/vendor/composer.phar validate --no-check-all --no-check-publish
./do install
./do compile:all --env production
- save_cache:
key: premium-tools-{{ checksum "mailpoet-premium/tools/install.php" }}
paths:
- mailpoet-premium/tools/vendor
- save_cache:
key: premium-composer-{{ checksum "mailpoet-premium/composer.json" }}-{{ checksum "mailpoet-premium/composer.lock" }}
paths:
- mailpoet-premium/vendor
- persist_to_workspace:
root: /home/circleci
paths:
- .node
- mailpoet
static_analysis:
executor: wpcli_php_latest
resource_class: medium+
working_directory: /home/circleci/mailpoet/mailpoet
parameters:
php_version:
type: integer
default: 70400
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'Static analysis'
command: ./do qa:phpstan --php-version=<< parameters.php_version >>
security_analysis:
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: default
docker_layer_caching: false
steps:
- attach_workspace:
at: /home/circleci
- add_ssh_keys
- run:
name: 'Add GitHub to known_hosts'
<<: *command_add_github_key
- run:
name: 'Set up PHP'
command: |
sudo apt update
sudo apt install -y php8.1-cli
- run:
name: 'QA Security'
command: ./do qa:semgrep
qa_js:
executor: wpcli_php_latest
working_directory: /home/circleci/mailpoet/mailpoet
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'QA Frontend Assets'
command: ./do qa:frontend-assets
qa_php:
executor: wpcli_php_latest
working_directory: /home/circleci/mailpoet/mailpoet
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'QA PHP'
command: ./do qa:php
qa_php_oldest:
executor: wpcli_php_oldest
working_directory: /home/circleci/mailpoet/mailpoet
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'QA PHP'
command: ./do qa:php
qa_php_max_wporg:
executor: wpcli_php_max_wporg
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'QA PHP'
command: ./do qa:php-max-wporg
js_tests:
executor: wpcli_php_latest
working_directory: /home/circleci/mailpoet/mailpoet
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'Preparing test results folder'
command: mkdir test-results
- run:
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'
command: |
./do t:j test-results/mocha/junit.xml
- store_test_results:
path: test-results/mocha
- store_artifacts:
path: test-results/mocha
destination: mocha
acceptance_tests:
parallelism: 20
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: default
docker_layer_caching: false
parameters:
multisite:
type: integer
default: 0
group:
type: string
default: ''
mysql_command:
type: string
default: ''
mysql_image:
type: string
default: ''
codeception_image_version:
type: string
default: ''
wordpress_image_version:
type: string
default: ''
woo_core_version:
type: string
default: ''
woo_subscriptions_version:
type: string
default: ''
automate_woo_version:
type: string
default: ''
blockbased_theme:
type: integer
default: 0
enable_hpos:
type: integer
default: 0
enable_hpos_sync:
type: integer
default: 0
disable_hpos:
type: integer
default: 0
use_wordpress_beta:
type: boolean
default: false
use_woocommerce_beta:
type: boolean
default: false
wordpress_version:
type: string
default: ''
environment:
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
- 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
- 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
- when:
condition: ${WOOCOMMERCE_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
- 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
- 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
- run:
name: Group acceptance tests
command: |
# Convert test result filename values to be relative paths because the circleci CLI's split command requires exact matches
if [ -e $CIRCLE_INTERNAL_TASK_DATA/circle-test-results/results.json ]; then
sed -i.bak 's#/wp-core/wp-content/plugins/mailpoet/##g' $CIRCLE_INTERNAL_TASK_DATA/circle-test-results/results.json
fi
# `circleci tests split` returns different values based on the container it's run on
# in case group is defined find only tests containing the group
if [[ -n '<< parameters.group >>' ]]; then
grep -rw 'tests/acceptance' -e '@group << parameters.group >>' | sed -e "s/:.*//" | circleci tests split --split-by=timings > tests/acceptance/_groups/circleci_split_group
else
circleci tests glob "tests/acceptance/**/*Cest.php" | circleci tests split --split-by=timings > tests/acceptance/_groups/circleci_split_group
fi
cat tests/acceptance/_groups/circleci_split_group
- run:
name: Run acceptance tests
command: |
mkdir -m 777 -p tests/_output/exceptions
cd ../tests_env/docker
args=(
--steps
--debug
-vvv
--html
--xml
-g circleci_split_group
)
docker compose run -e SKIP_DEPS=1 \
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
-e CIRCLE_JOB=${CIRCLE_JOB} \
-e MULTISITE=<< parameters.multisite >> \
-e BLOCKBASED_THEME=<< parameters.blockbased_theme >> \
-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
command: |
if [ "$(ls tests/_output/exceptions/*.html)" ]; then
echo "There were some exceptions during the tests run"
exit 1
fi
- store_artifacts:
path: tests/_output
- store_test_results:
path: tests/_output
performance_tests:
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: default
docker_layer_caching: false
parameters:
mysql_command:
type: string
default: ''
mysql_image:
type: string
default: ''
wordpress_image_version:
type: string
default: ''
url:
type: string
default: 'http://localhost:9500'
us:
type: string
default: 'admin'
pw:
type: string
default: 'password'
scenario:
type: string
default: 'pullrequests'
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'Set up PHP'
command: |
sudo apt update
sudo apt install -y php8.1-cli
- 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
- 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
- run:
name: Run performance tests
command: |
mkdir -p tests/performance/_output
mkdir -p tests/performance/_screenshots
./do test:performance --url=<< parameters.url >> --pw=<< parameters.pw >> --scenario=<< parameters.scenario >>
- run:
name: Check exceptions
command: |
if [ "$(ls tests/performance/_output/exceptions/*.html)" ]; then
echo "There were some exceptions during the tests run"
exit 1
fi
- store_artifacts:
path: tests/performance/_output
- store_artifacts:
path: tests/performance/_screenshots
- store_test_results:
path: tests/performance/_output
unit_tests:
working_directory: /home/circleci/mailpoet/mailpoet
parameters:
executor:
type: string
default: wpcli_php_mysql_latest
executor: << parameters.executor >>
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: 'Prepare example.com for testing'
command: echo 127.0.0.1 example.com | sudo tee -a /etc/hosts
- run:
# Some tools we use may need different version based on PHP version used in docker
name: Ensure correct versions of tools
command: COMPOSER_DEV_MODE=1 php tools/install.php
- run:
name: 'Set up test environment'
command: source ../.circleci/setup.bash && setup php7
- run:
name: 'PHP Unit tests'
command: |
./do t:u --xml
- store_test_results:
path: tests/_output
- store_artifacts:
path: tests/_output
destination: codeception
- store_artifacts:
path: /tmp/fake-mailer/
destination: fake-mailer
integration_tests:
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: default
docker_layer_caching: false
environment:
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: ''
skip_group:
type: string
default: ''
skip_plugins:
type: integer
default: 0
enable_hpos:
type: integer
default: 0
enable_hpos_sync:
type: integer
default: 0
disable_hpos:
type: integer
default: 0
multisite:
type: integer
default: 0
mysql_command:
type: string
default: ''
mysql_image:
type: string
default: ''
woo_core_version:
type: string
default: ''
woo_subscriptions_version:
type: string
default: ''
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
- 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
- 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
- when:
condition: ${WOOCOMMERCE_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
- 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
- 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
- run:
name: 'PHP Integration tests'
command: |
mkdir -m 777 -p tests/_output/exceptions
cd ../tests_env/docker
args=(
--steps
--debug
-vvv
--html
--xml
)
if [[ -n '<< parameters.group >>' ]]; then
args+=(--group << parameters.group >>)
fi
if [[ -n '<< parameters.skip_group >>' ]]; then
args+=(--skip-group << parameters.skip_group >>)
fi
docker compose run -e SKIP_DEPS=1 \
-e CIRCLE_BRANCH=${CIRCLE_BRANCH} \
-e CIRCLE_JOB=${CIRCLE_JOB} \
-e SKIP_PLUGINS=<< parameters.skip_plugins >> \
-e WP_TEST_MAILER_ENABLE_SENDING=${WP_TEST_MAILER_ENABLE_SENDING} \
-e WP_TEST_ENABLE_NETWORK_TESTS=${WP_TEST_ENABLE_NETWORK_TESTS} \
-e WP_TEST_MAILER_MAILPOET_API=${WP_TEST_MAILER_MAILPOET_API} \
-e WP_TEST_MAILER_SENDGRID_API=${WP_TEST_MAILER_SENDGRID_API} \
-e WP_TEST_MAILER_AMAZON_ACCESS=${WP_TEST_MAILER_AMAZON_ACCESS} \
-e WP_TEST_MAILER_AMAZON_REGION=${WP_TEST_MAILER_AMAZON_REGION} \
-e WP_TEST_MAILER_AMAZON_SECRET=${WP_TEST_MAILER_AMAZON_SECRET} \
-e WP_TEST_IMPORT_MAILCHIMP_API=${WP_TEST_IMPORT_MAILCHIMP_API} \
-e WP_TEST_IMPORT_MAILCHIMP_LISTS=${WP_TEST_IMPORT_MAILCHIMP_LISTS} \
-e WP_TEST_MAILER_SMTP_HOST=${WP_TEST_MAILER_SMTP_HOST} \
-e WP_TEST_MAILER_SMTP_LOGIN=${WP_TEST_MAILER_SMTP_LOGIN} \
-e WP_TEST_MAILER_SMTP_PASSWORD=${WP_TEST_MAILER_SMTP_PASSWORD} \
-e MULTISITE=<< parameters.multisite >> \
-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
- store_artifacts:
path: tests/_output
destination: codeception
- store_artifacts:
path: /mailhog-data
destination: mailhog-data
build_release_zip:
executor: wpcli_php_mysql_latest
resource_class: large
steps:
- attach_workspace:
at: /home/circleci
- run:
name: 'Set up environment'
command: |
source ../.circleci/setup.bash && setup php7
sudo apt-get update
sudo apt-get install gettext
sed -i 's/^WP_ROOT=.*$/WP_ROOT=\/home\/circleci\/mailpoet\/wordpress/g' .env
echo ${CIRCLE_BUILD_NUM} > release_zip_build_number.txt
- run:
name: 'Build'
command: ./build.sh
- store_artifacts:
path: /home/circleci/mailpoet/mailpoet/mailpoet.zip
- persist_to_workspace:
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
qit_malware_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 Malware Scan'
command: ./do qa:qit-malware | tee tests/_output/qit-malware
- run:
name: 'Retrieve test results'
command: |
grep "Result Url" tests/_output/qit-malware | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
when: always
- store_artifacts:
path: tests/_output
qit_php_compatibility:
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 PHP Compatibility Check'
command: ./do qa:qit-php-compatibility | tee tests/_output/qit-php-compatibility
- run:
name: 'Retrieve test results'
command: |
grep "Result Url" tests/_output/qit-php-compatibility | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
when: always
- store_artifacts:
path: tests/_output
qit_activation_tests:
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 Activation Tests'
command: |
echo "Using WooCommerce RC Version"
./do qa:qit-activation --wc=rc | tee tests/_output/qit-activation
- run:
name: 'Retrieve test results'
command: |
grep "Result Url" tests/_output/qit-activation | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
when: always
- store_artifacts:
path: tests/_output
qit_woo_api_tests:
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 Woo API Tests'
command: |
echo "Using WooCommerce RC Version"
./do qa:qit-woo-api --wc=rc | tee tests/_output/qit-woo-api
- run:
name: 'Retrieve test results'
command: |
grep "Result Url" tests/_output/qit-woo-api | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
when: always
- store_artifacts:
path: tests/_output
qit_woo_e2e_tests:
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 Woo E2E Tests'
no_output_timeout: 1h # Woo E2E tests usually takes ~45m
command: |
echo "Using WooCommerce RC Version"
./do qa:qit-woo-e2e --wc=rc | tee tests/_output/qit-woo-e2e
- run:
name: 'Retrieve test results'
command: |
grep "Result Url" tests/_output/qit-woo-e2e | awk '{ print $3 }' | xargs curl -o tests/_output/report.html
when: always
- store_artifacts:
path: tests/_output
workflows:
build_and_test:
jobs:
- build:
<<: *slack-fail-post-step
- build_premium:
<<: *slack-fail-post-step
<<: *only_release
requires:
- build
- unit_tests:
<<: *slack-fail-post-step
name: unit_tests
requires:
- build
- static_analysis:
<<: *slack-fail-post-step
name: static_analysis_php7
php_version: 70400
requires:
- build
- static_analysis:
<<: *slack-fail-post-step
name: static_analysis_php8
php_version: 80300
requires:
- build
- security_analysis:
<<: *slack-fail-post-step
requires:
- build
- qa_js:
<<: *slack-fail-post-step
requires:
- build
- qa_php:
<<: *slack-fail-post-step
requires:
- build
- qa_php_oldest:
<<: *slack-fail-post-step
requires:
- build
- qa_php_max_wporg:
<<: *slack-fail-post-step
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_tests_base_and_woo
enable_hpos: 1
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_tests_woo_hpos_sync_on
group: woo
enable_hpos_sync: 1
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_tests_woo_hpos_off
group: woo
disable_hpos: 1
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_tests_blockbased_theme
group: frontend
blockbased_theme: 1
requires:
- build
- js_tests:
<<: *slack-fail-post-step
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
group: woo
enable_hpos_sync: 1
name: integration_test_woo_hpos_sync_on
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
group: woo
name: integration_test_woo_hpos_on
enable_hpos: 1
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
group: woo
disable_hpos: 1
name: integration_test_woo_hpos_off
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
skip_group: woo
skip_plugins: 1
name: integration_test_base
requires:
- build
- 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
- acceptance_tests:
<<: *slack-fail-post-step
<<: *only_release
name: acceptance_with_premium_latest
requires:
- build_premium
- unit_tests:
<<: *slack-fail-post-step
<<: *only_release
name: unit_with_premium_latest
requires:
- build_premium
- integration_tests:
<<: *slack-fail-post-step
<<: *only_release
name: integration_with_premium_latest
requires:
- build_premium
- build_release_zip:
<<: *slack-fail-post-step
requires:
- build
- acceptance_tests_base_and_woo
- js_tests
- integration_test_base
- 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
nightly:
triggers:
- schedule:
cron: '0 1 * * 1-5'
filters:
branches:
only:
- trunk
jobs:
- build:
<<: *slack-fail-post-step
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_latest
mysql_image: mysql:8.3
mysql_command: --default-authentication-plugin=mysql_native_password
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_latest_blockbased_theme
group: frontend
blockbased_theme: 1
mysql_image: mysql:8.3
mysql_command: --default-authentication-plugin=mysql_native_password
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_oldest
woo_core_version: 9.7.1
woo_subscriptions_version: 7.3.1
automate_woo_version: 6.0.33
mysql_command: --max_allowed_packet=100M
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.7.2
requires:
- build
- performance_tests:
<<: *slack-fail-post-step
name: performance_latest
url: https://mpperftesting.com
us: $WP_TEST_PERFORMANCE_US
pw: $WP_TEST_PERFORMANCE_PW
scenario: nightlytests
requires:
- build
- unit_tests:
<<: *slack-fail-post-step
name: unit_latest
requires:
- build
- unit_tests:
<<: *slack-fail-post-step
name: unit_oldest
executor: wpcli_php_mysql_oldest
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
name: integration_latest
mysql_image: mysql:8.3
mysql_command: --default-authentication-plugin=mysql_native_password
requires:
- build
- integration_tests:
<<: *slack-fail-post-step
name: integration_oldest
woo_core_version: 9.7.1
woo_subscriptions_version: 7.3.1
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 # We use image with PHP 7.4 and install required WordPress version via CLI
wordpress_version: 6.7.2
mysql_command: --max_allowed_packet=100M
mysql_image: mysql:5.5
requires:
- build
- build_premium:
<<: *slack-fail-post-step
requires:
- build
- acceptance_tests:
<<: *slack-fail-post-step
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
requires:
- build_premium
- integration_tests:
<<: *slack-fail-post-step
name: integration_with_premium_latest
requires:
- build_premium
- acceptance_tests:
<<: *slack-fail-post-step
name: acceptance_with_premium_oldest
woo_core_version: 9.7.1
woo_subscriptions_version: 7.3.1
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.7.2
requires:
- build_premium
- integration_tests:
<<: *slack-fail-post-step
name: integration_with_premium_oldest
woo_core_version: 9.7.1
woo_subscriptions_version: 7.3.1
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.7.2
mysql_command: --max_allowed_packet=100M
mysql_image: mysql:5.5
requires:
- build_premium
nightly_qit:
triggers:
- schedule:
cron: '0 2 * * 3' # Every Wednesday at 2am UTC
filters:
branches:
only:
- trunk
jobs:
- build:
<<: *slack-fail-post-step
- build_release_zip:
<<: *slack-fail-post-step
requires:
- build
- qit_security_scan:
<<: *slack-fail-post-step
requires:
- build_release_zip
- qit_activation_tests:
<<: *slack-fail-post-step
requires:
- build_release_zip
- qit_malware_scan:
<<: *slack-fail-post-step
requires:
- build_release_zip
- qit_php_compatibility:
<<: *slack-fail-post-step
requires:
- build_release_zip
- qit_woo_api_tests:
<<: *slack-fail-post-step
requires:
- build_release_zip
- qit_woo_e2e_tests:
<<: *slack-fail-post-step
requires:
- build_release_zip