From 82a45ddc0b159414c3334bef3434454368f9b263 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:02:16 -0400 Subject: [PATCH 01/14] Utilize the reusable PHPUnit workflow for code coverage. --- .../workflows/reusable-phpunit-tests-v3.yml | 36 ++++- .github/workflows/test-coverage.yml | 152 ++---------------- 2 files changed, 40 insertions(+), 148 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 5acdbae89c338..e8a83bd7a7163 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -52,6 +52,11 @@ on: required: false type: 'string' default: 'example.org' + coverage-format: + description: 'The coverage report format to generate. Should be clover or html.' + required: false + type: string + default: '' report: description: 'Whether to report results to WordPress.org Hosting Tests' required: false @@ -64,6 +69,8 @@ on: default: false env: LOCAL_PHP: ${{ inputs.php }}-fpm + LOCAL_PHP_XDEBUG: ${{ inputs.coverage-format && true || false }} + LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || 'develop,debug' }} LOCAL_DB_TYPE: ${{ inputs.db-type }} LOCAL_DB_VERSION: ${{ inputs.db-version }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} @@ -88,13 +95,15 @@ jobs: # - Logs debug information about what's installed within the WordPress Docker containers. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. + # - Upload the code coverage report to Codecov.io. + # - Upload the HTML code coverage report as an artifact. # - Ensures version-controlled files are not modified or deleted. # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} - timeout-minutes: 20 + timeout-minutes: ${{ inputs.coverage-format && 120 || 20 }} steps: - name: Configure environment variables @@ -172,26 +181,43 @@ jobs: run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }} - name: Run AJAX tests - if: ${{ ! inputs.phpunit-test-groups }} + if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-format }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.phpunit-test-groups }} + if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups }} + if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - name: Run (Xdebug) tests - if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }} + if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} continue-on-error: ${{ inputs.allow-errors }} run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ + - name: Upload site report to Codecov + if: ${{ inputs.coverage-format == 'clover' }} + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }}${{ 'clover' == inputs.coverage-format && '.xml' || '' }} + flags: ${{ inputs.multisite && 'multisite' || 'single' }},php + fail_ci_if_error: true + + - name: Upload HTML coverage report as artifact + if: ${{ inputs.coverage-format == 'html' }} + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }} + path: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }} + overwrite: true + - name: Ensure version-controlled files are not modified or deleted run: git diff --exit-code diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index f6c68ff0afead..d5ecf225a0b72 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -35,160 +35,26 @@ env: PUPPETEER_SKIP_DOWNLOAD: ${{ true }} jobs: - # Runs the PHPUnit tests for WordPress. # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Sets up Node.js. - # - Sets up PHP. - # - Installs Composer dependencies. - # - Installs npm dependencies - # - Logs general debug information about the runner. - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Logs the running Docker containers. - # - Logs debug information about what's installed within the WordPress Docker containers. - # - Install WordPress within the Docker container. - # - Run the PHPUnit tests as a single site. - # - Ensures version-controlled files are not modified or deleted. - # - Upload the single site code coverage report to Codecov.io. - # - Run the PHPUnit tests as a multisite installation. - # - Ensures version-controlled files are not modified or deleted. - # - Upload the multisite code coverage report to Codecov.io. + # Creates a PHPUnit test jobs for generating code coverage reports. + # test-coverage-report: name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report (${{ matrix.format }}) - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@use/reusable-php-for-coverage permissions: contents: read - timeout-minutes: 120 if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: multisite: [ false, true ] format: [ clover, html ] - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV - echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version-file: '.nvmrc' - cache: npm - - ## - # This allows Composer dependencies to be installed using a single step. - # - # Since the tests are currently run within the Docker containers where the PHP version varies, - # the same PHP version needs to be configured for the action runner machine so that the correct - # dependency versions are installed and cached. - ## - - name: Set up PHP - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 - with: - php-version: '7.4' - coverage: none - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # v3.0.0 - with: - custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - - name: Install npm Dependencies - run: npm ci - - - name: Log debug information - run: | - echo "$GITHUB_REF" - echo "$GITHUB_EVENT_NAME" - npm --version - node --version - curl --version - git --version - composer --version - locale -a - - - name: Docker debug information - run: | - docker -v - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker compose run --rm mysql mysql --version - docker compose run --rm php php --version - docker compose run --rm php php -m - docker compose run --rm php php -i - docker compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Run tests as a single site - if: ${{ ! matrix.multisite }} - run: npm run test:php -- --verbose -c phpunit.xml.dist --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code - - - name: Upload single site report to Codecov - if: ${{ ! matrix.multisite && matrix.format == 'clover' && github.event_name != 'pull_request' }} - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage-single-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - flags: single,php - fail_ci_if_error: true - - - name: Upload single site HTML report as artifact - if: ${{ ! matrix.multisite && matrix.format == 'html' }} - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: wp-code-coverage-single-${{ github.sha }} - path: wp-code-coverage-single-${{ github.sha }} - overwrite: true - - - name: Run tests as a multisite install - if: ${{ matrix.multisite }} - run: npm run test:php -- --verbose -c tests/phpunit/multisite.xml --coverage-${{ 'html' == matrix.format && 'html' || 'clover' }} wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code - - - name: Upload multisite report to Codecov - if: ${{ matrix.multisite && matrix.format == 'clover' && github.event_name != 'pull_request' }} - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage-multisite-${{ github.sha }}${{ 'clover' == matrix.format && '.xml' || '' }} - flags: multisite,php - fail_ci_if_error: true - - - name: Upload multisite HTML report as artifact - if: ${{ matrix.multisite && matrix.format == 'html' }} - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: wp-code-coverage-multisite-${{ github.sha }} - path: wp-code-coverage-multisite-${{ github.sha }} - overwrite: true + with: + php: '8.3-fpm' + multisite: ${{ matrix.multisite }} + coverage-format: ${{ matrix.format }} + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} slack-notifications: name: Slack Notifications From ea70d9ae2940d979870218cb708a10a7796833d0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:07:45 -0400 Subject: [PATCH 02/14] Small improvements. --- .github/workflows/reusable-phpunit-tests-v3.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index e8a83bd7a7163..e79d9bbb436cf 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -67,6 +67,10 @@ on: required: false type: boolean default: false + secrets: + CODECOV_TOKEN: + description: 'The Codecov token required for uploading reports.' + required: false env: LOCAL_PHP: ${{ inputs.php }}-fpm LOCAL_PHP_XDEBUG: ${{ inputs.coverage-format && true || false }} @@ -101,7 +105,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }}${{ inputs.coverage-format && format( '({0} report)' ) || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-format && 120 || 20 }} @@ -176,7 +180,7 @@ jobs: - name: Install WordPress run: npm run env:install - - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }} + - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' with {0} report', inputs.coverage-format ) || '' }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }} From 70dbe1489a2bf3667b2e26509ba2d9b7febd3c87 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:08:48 -0400 Subject: [PATCH 03/14] Add missing argument. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index e79d9bbb436cf..c387f137a3edb 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -105,7 +105,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }}${{ inputs.coverage-format && format( '({0} report)' ) || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }}${{ inputs.coverage-format && format( '({0} report)', inputs.coverage-format ) || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-format && 120 || 20 }} From 23b30bd4dfa8c13a15222ab91d2a72b8b8e555d0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:10:53 -0400 Subject: [PATCH 04/14] Fix PHP version. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- .github/workflows/test-coverage.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index c387f137a3edb..1971ae63bf0b3 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -105,7 +105,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }}${{ inputs.coverage-format && format( '({0} report)', inputs.coverage-format ) || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-format && 120 || 20 }} diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index d5ecf225a0b72..8f6940ae1dc91 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -50,7 +50,7 @@ jobs: multisite: [ false, true ] format: [ clover, html ] with: - php: '8.3-fpm' + php: '8.3' multisite: ${{ matrix.multisite }} coverage-format: ${{ matrix.format }} secrets: From 49259d50b1b4c26319869ddd65b0f88f44c863e6 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:30:15 -0400 Subject: [PATCH 05/14] Specify a report to generate. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 1971ae63bf0b3..18527966d1c94 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -182,7 +182,7 @@ jobs: - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' with {0} report', inputs.coverage-format ) || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( '--coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} - name: Run AJAX tests if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-format }} From 14486d6f1835e999be31d94bbeee3b03f337bdcd Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:34:31 -0400 Subject: [PATCH 06/14] Fix syntax error. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 18527966d1c94..afb5e849c8267 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -182,7 +182,7 @@ jobs: - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' with {0} report', inputs.coverage-format ) || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( '--coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( '--coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, ( inputs.multisite && 'multisite' || 'single' ), github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} - name: Run AJAX tests if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-format }} From 729ddccbbcb40406f5592f060fa33e63c68fef77 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 23 Oct 2024 14:37:56 -0400 Subject: [PATCH 07/14] Add missing space. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index afb5e849c8267..7cb0fe4c24e4b 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -182,7 +182,7 @@ jobs: - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' with {0} report', inputs.coverage-format ) || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( '--coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, ( inputs.multisite && 'multisite' || 'single' ), github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' --coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, ( inputs.multisite && 'multisite' || 'single' ), github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} - name: Run AJAX tests if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-format }} From 593765380796621c77529e99517c7914c773d12c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 08:17:58 -0400 Subject: [PATCH 08/14] Fix typo and test PHPUnit vs. latest version. --- .github/workflows/phpunit-tests.yml | 4 ++-- .github/workflows/reusable-phpunit-tests-v3.yml | 6 +++--- .github/workflows/test-coverage.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 949e08d5339ca..8658ce3f9a324 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -36,7 +36,7 @@ jobs: # test-with-mysql: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk + uses: ./.github/workflows/reusable-phpunit-tests-v3.yml permissions: contents: read secrets: inherit @@ -115,7 +115,7 @@ jobs: # test-with-mariadb: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@trunk + uses: ./.github/workflows/reusable-phpunit-tests-v3.yml permissions: contents: read secrets: inherit diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 7cb0fe4c24e4b..375b7bf9bc781 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -74,7 +74,7 @@ on: env: LOCAL_PHP: ${{ inputs.php }}-fpm LOCAL_PHP_XDEBUG: ${{ inputs.coverage-format && true || false }} - LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || 'develop,debug' }} + LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || false }} LOCAL_DB_TYPE: ${{ inputs.db-type }} LOCAL_DB_VERSION: ${{ inputs.db-version }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} @@ -218,8 +218,8 @@ jobs: if: ${{ inputs.coverage-format == 'html' }} uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: - name: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }} - path: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }} + name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} + path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} overwrite: true - name: Ensure version-controlled files are not modified or deleted diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 8f6940ae1dc91..c3d24e1bd88c6 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -40,7 +40,7 @@ jobs: # test-coverage-report: name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report (${{ matrix.format }}) - uses: desrosj/wordpress-develop/.github/workflows/reusable-phpunit-tests-v3.yml@use/reusable-php-for-coverage + uses: ./.github/workflows/reusable-phpunit-tests-v3.yml permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} From 7a9f8823bad2037ed4a789b1b381e38a003745ba Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 08:28:01 -0400 Subject: [PATCH 09/14] Some small polish changes. --- .github/workflows/reusable-phpunit-tests-v3.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 375b7bf9bc781..4c726dcd788dd 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -53,7 +53,7 @@ on: type: 'string' default: 'example.org' coverage-format: - description: 'The coverage report format to generate. Should be clover or html.' + description: 'The coverage report format to generate. Supported values are clover or html.' required: false type: string default: '' @@ -74,7 +74,7 @@ on: env: LOCAL_PHP: ${{ inputs.php }}-fpm LOCAL_PHP_XDEBUG: ${{ inputs.coverage-format && true || false }} - LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || false }} + LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || 'develop,debug' }} LOCAL_DB_TYPE: ${{ inputs.db-type }} LOCAL_DB_VERSION: ${{ inputs.db-version }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} @@ -99,8 +99,8 @@ jobs: # - Logs debug information about what's installed within the WordPress Docker containers. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. - # - Upload the code coverage report to Codecov.io. - # - Upload the HTML code coverage report as an artifact. + # - Upload the code coverage report to Codecov.io when coverage format is provided. + # - Upload the HTML code coverage report as an artifact when coverage format is provided. # - Ensures version-controlled files are not modified or deleted. # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. @@ -205,12 +205,12 @@ jobs: continue-on-error: ${{ inputs.allow-errors }} run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ - - name: Upload site report to Codecov + - name: Upload test coverage report to Codecov if: ${{ inputs.coverage-format == 'clover' }} uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 with: token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage${{ inputs.multisite && '-multisite' || 'single' }}-${{ github.sha }}${{ 'clover' == inputs.coverage-format && '.xml' || '' }} + file: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}${{ 'clover' == inputs.coverage-format && '.xml' || '' }} flags: ${{ inputs.multisite && 'multisite' || 'single' }},php fail_ci_if_error: true From 0780462edfecd574c8214ba2294fc89d320a4aa0 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 09:17:11 -0400 Subject: [PATCH 10/14] Generate both reports at the same time. --- .../workflows/reusable-phpunit-tests-v3.yml | 32 +++++++++---------- .github/workflows/test-coverage.yml | 6 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 4c726dcd788dd..7d5c89183e696 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -52,11 +52,11 @@ on: required: false type: 'string' default: 'example.org' - coverage-format: - description: 'The coverage report format to generate. Supported values are clover or html.' + coverage-report: + description: 'Whether to generate a code coverage report.' required: false - type: string - default: '' + type: boolean + default: false report: description: 'Whether to report results to WordPress.org Hosting Tests' required: false @@ -73,8 +73,8 @@ on: required: false env: LOCAL_PHP: ${{ inputs.php }}-fpm - LOCAL_PHP_XDEBUG: ${{ inputs.coverage-format && true || false }} - LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-format && 'coverage' || 'develop,debug' }} + LOCAL_PHP_XDEBUG: ${{ inputs.coverage-report || false }} + LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-report && 'coverage' || 'develop,debug' }} LOCAL_DB_TYPE: ${{ inputs.db-type }} LOCAL_DB_VERSION: ${{ inputs.db-version }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} @@ -107,7 +107,7 @@ jobs: phpunit-tests: name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} - timeout-minutes: ${{ inputs.coverage-format && 120 || 20 }} + timeout-minutes: ${{ inputs.coverage-report && 120 || 20 }} steps: - name: Configure environment variables @@ -180,42 +180,42 @@ jobs: - name: Install WordPress run: npm run env:install - - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' with {0} report', inputs.coverage-format ) || '' }} + - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-format && format( ' --coverage-{0} wp-code-coverage-{1}-{2}{3}', inputs.coverage-format, ( inputs.multisite && 'multisite' || 'single' ), github.sha, ( inputs.coverage-format == 'clover' && '.xml' || '' ) ) }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && format( ' --coverage-clover wp-code-coverage-{0}-{1}.xml --coverage-html wp-code-coverage-{0}-{1}', ( inputs.multisite && 'multisite' || 'single' ), github.sha ) }} - name: Run AJAX tests - if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-format }} + if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} + if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files - name: Run external HTTP tests - if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} + if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} continue-on-error: ${{ inputs.allow-errors }} run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - name: Run (Xdebug) tests - if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups && ! inputs.coverage-format }} + if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} continue-on-error: ${{ inputs.allow-errors }} run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ - name: Upload test coverage report to Codecov - if: ${{ inputs.coverage-format == 'clover' }} + if: ${{ inputs.coverage-report }} uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 with: token: ${{ secrets.CODECOV_TOKEN }} - file: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}${{ 'clover' == inputs.coverage-format && '.xml' || '' }} + file: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml flags: ${{ inputs.multisite && 'multisite' || 'single' }},php fail_ci_if_error: true - name: Upload HTML coverage report as artifact - if: ${{ inputs.coverage-format == 'html' }} + if: ${{ inputs.coverage-report }} uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index c3d24e1bd88c6..261d8f352eda9 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -39,7 +39,7 @@ jobs: # Creates a PHPUnit test jobs for generating code coverage reports. # test-coverage-report: - name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report (${{ matrix.format }}) + name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report uses: ./.github/workflows/reusable-phpunit-tests-v3.yml permissions: contents: read @@ -48,11 +48,11 @@ jobs: fail-fast: false matrix: multisite: [ false, true ] - format: [ clover, html ] + coverage-report: [ true ] with: php: '8.3' multisite: ${{ matrix.multisite }} - coverage-format: ${{ matrix.format }} + coverage-report: ${{ matrix.coverage-report }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From c2d21108b5de98d51c905e8c83964463ee24d8a3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 09:19:53 -0400 Subject: [PATCH 11/14] Try adjusting names and fix missing or condition. --- .github/workflows/reusable-phpunit-tests-v3.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 7d5c89183e696..3807768f055af 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -105,7 +105,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: PHP ${{ inputs.php }} ${{ ! inputs.coverage-report && '/ ' || '' }}${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-report && 120 || 20 }} @@ -182,7 +182,7 @@ jobs: - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && format( ' --coverage-clover wp-code-coverage-{0}-{1}.xml --coverage-html wp-code-coverage-{0}-{1}', ( inputs.multisite && 'multisite' || 'single' ), github.sha ) }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && format( ' --coverage-clover wp-code-coverage-{0}-{1}.xml --coverage-html wp-code-coverage-{0}-{1}', ( inputs.multisite && 'multisite' || 'single' ), github.sha ) || false }} - name: Run AJAX tests if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} From e54dd1437ab7cd518b8a9a44a69423314335a033 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 09:20:47 -0400 Subject: [PATCH 12/14] Name adjust. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 3807768f055af..168d882636a3e 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -105,7 +105,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} ${{ ! inputs.coverage-report && '/ ' || '' }}${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} + name: PHP ${{ inputs.php }} ${{ ! inputs.coverage-report && '/ ' || 'with ' }}${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.phpunit-test-groups && format( ' ({0})', inputs.phpunit-test-groups ) || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: ${{ inputs.coverage-report && 120 || 20 }} From 8587ad8aaac6d663c4e5150c3e88fea950deaf38 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 09:22:25 -0400 Subject: [PATCH 13/14] Add concurrency conditions. --- .github/workflows/test-coverage.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 261d8f352eda9..704dd1d74c2e7 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -24,6 +24,13 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + # Disable permissions for all available scopes by default. # Any needed permissions should be configured at the job level. permissions: {} From 35c0cf90afe95a8bec634fe4eb5b5831508fc911 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 24 Oct 2024 09:30:21 -0400 Subject: [PATCH 14/14] Use empty string, not false. --- .github/workflows/reusable-phpunit-tests-v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 168d882636a3e..ac44fc9a93579 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -182,7 +182,7 @@ jobs: - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} continue-on-error: ${{ inputs.allow-errors }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && format( ' --coverage-clover wp-code-coverage-{0}-{1}.xml --coverage-html wp-code-coverage-{0}-{1}', ( inputs.multisite && 'multisite' || 'single' ), github.sha ) || false }} + run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}${{ inputs.phpunit-test-groups && format( ' --group {0}', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && format( ' --coverage-clover wp-code-coverage-{0}-{1}.xml --coverage-html wp-code-coverage-{0}-{1}', ( inputs.multisite && 'multisite' || 'single' ), github.sha ) || '' }} - name: Run AJAX tests if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }}