Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/reusable-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ on:
use-phar:
type: boolean
required: true
parallel:
type: number
required: false
default: 4

jobs:
run-test:
Expand Down Expand Up @@ -149,4 +153,8 @@ jobs:
WP_CLI_TEST_DBTYPE: ${{ inputs.dbtype }}
TEST_PACKAGE: 'wp-cli/${{ inputs.test-package }}'
WP_CLI_TEST_DBSOCKET: '${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock'
# Spread the scenarios of the package over as many workers as the runner has cores,
# each with a test database of its own, as prepared by `composer prepare-tests`.
# Not in Docker containers, as these would not see the Phar under test.
WP_CLI_TEST_PARALLEL: ${{ inputs.parallel }}
run: composer test
9 changes: 5 additions & 4 deletions bin/test-phar
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ for RELEASE in $RELEASES; do
for REPO in $REPOS; do

echo "Testing ${RELEASE}:${REPO}..."
BEHAT_TAGS=$(BEHAT_FEATURES_FOLDER=${BUILD_DIR}/vendor/${REPO}/features php ${BUILD_DIR}/vendor/wp-cli/wp-cli-tests/utils/behat-tags.php)
echo "Behat Tags: $BEHAT_TAGS"
# The test runner of wp-cli/wp-cli-tests derives the environment-specific tags from the
# features of the package, and spreads its scenarios over WP_CLI_TEST_PARALLEL workers.
export BEHAT_FEATURES_FOLDER="vendor/${REPO}/features"

set +e
"${BUILD_DIR}/vendor/bin/behat" --format progress $BEHAT_TAGS --strict --suite $REPO
"${BUILD_DIR}/vendor/bin/run-behat-tests" --suite "$REPO"
if [ $? -ne 0 ]; then
"${BUILD_DIR}/vendor/bin/behat" --format progress $BEHAT_TAGS --strict --suite $REPO --rerun
"${BUILD_DIR}/vendor/bin/run-behat-tests" --suite "$REPO" --rerun
if [ $? -ne 0 ]; then
FAILED_PACKAGES="$FAILED_PACKAGES ${RELEASE}:${REPO}"
fi
Expand Down
11 changes: 6 additions & 5 deletions bin/test-source
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

if [ "$TEST_PACKAGE" == "all" ]; then
REPOS="wp-cli/wp-cli-bundle
wp-cli-/wp-cli
wp-cli/wp-cli
$(cat ${BUILD_DIR}/vendor/wp-cli/wp-cli-bundle/composer.json | grep -oE "wp-cli/([a-z\-]*)-command")"
fi

Expand All @@ -43,13 +43,14 @@ for REPO in $REPOS; do

echo "Testing package $REPO..."

BEHAT_TAGS=$(BEHAT_FEATURES_FOLDER=${BUILD_DIR}/vendor/${REPO}/features php ${BUILD_DIR}/vendor/wp-cli/wp-cli-tests/utils/behat-tags.php)
echo "Behat Tags: $BEHAT_TAGS"
# The test runner of wp-cli/wp-cli-tests derives the environment-specific tags from the
# features of the package, and spreads its scenarios over WP_CLI_TEST_PARALLEL workers.
export BEHAT_FEATURES_FOLDER="vendor/${REPO}/features"

set +e
"${BUILD_DIR}/vendor/bin/behat" --format progress $BEHAT_TAGS --strict --suite $REPO
"${BUILD_DIR}/vendor/bin/run-behat-tests" --suite "$REPO"
if [ $? -ne 0 ]; then
"${BUILD_DIR}/vendor/bin/behat" --format progress $BEHAT_TAGS --strict --suite $REPO --rerun
"${BUILD_DIR}/vendor/bin/run-behat-tests" --suite "$REPO" --rerun
if [ $? -ne 0 ]; then
FAILED_PACKAGES="$FAILED_PACKAGES ${RELEASE}:${REPO}"
fi
Expand Down
Loading