Changeset 59287 for trunk/.github/workflows/reusable-phpunit-tests-v3.yml
- Timestamp:
- 10/24/2024 03:07:06 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/reusable-phpunit-tests-v3.yml
r59251 r59287 53 53 type: 'string' 54 54 default: 'example.org' 55 coverage-report: 56 description: 'Whether to generate a code coverage report.' 57 required: false 58 type: boolean 59 default: false 55 60 report: 56 61 description: 'Whether to report results to WordPress.org Hosting Tests' … … 63 68 type: boolean 64 69 default: false 70 secrets: 71 CODECOV_TOKEN: 72 description: 'The Codecov token required for uploading reports.' 73 required: false 65 74 env: 66 75 LOCAL_PHP: ${{ inputs.php }}-fpm 76 LOCAL_PHP_XDEBUG: ${{ inputs.coverage-report || false }} 77 LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-report && 'coverage' || 'develop,debug' }} 67 78 LOCAL_DB_TYPE: ${{ inputs.db-type }} 68 79 LOCAL_DB_VERSION: ${{ inputs.db-version }} … … 89 100 # - Install WordPress within the Docker container. 90 101 # - Run the PHPUnit tests. 102 # - Upload the code coverage report to Codecov.io. 103 # - Upload the HTML code coverage report as an artifact. 91 104 # - Ensures version-controlled files are not modified or deleted. 92 105 # - Checks out the WordPress Test reporter repository. 93 106 # - Submit the test results to the WordPress.org host test results. 94 107 phpunit-tests: 95 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 || '' }}108 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 || '' }} 96 109 runs-on: ${{ inputs.os }} 97 timeout-minutes: 20110 timeout-minutes: ${{ inputs.coverage-report && 120 || 20 }} 98 111 99 112 steps: … … 168 181 run: npm run env:install 169 182 170 - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }} 171 continue-on-error: ${{ inputs.allow-errors }} 172 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 ) || '' }} 183 - name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }} 184 continue-on-error: ${{ inputs.allow-errors }} 185 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 ) || '' }} 173 186 174 187 - name: Run AJAX tests 175 if: ${{ ! inputs.phpunit-test-groups }}188 if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }} 176 189 continue-on-error: ${{ inputs.allow-errors }} 177 190 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 178 191 179 192 - name: Run ms-files tests as a multisite install 180 if: ${{ inputs.multisite && ! inputs.phpunit-test-groups }}193 if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} 181 194 continue-on-error: ${{ inputs.allow-errors }} 182 195 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files 183 196 184 197 - name: Run external HTTP tests 185 if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups }}198 if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} 186 199 continue-on-error: ${{ inputs.allow-errors }} 187 200 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http … … 189 202 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 190 203 - name: Run (Xdebug) tests 191 if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups }}204 if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups && ! inputs.coverage-report }} 192 205 continue-on-error: ${{ inputs.allow-errors }} 193 206 run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ 207 208 - name: Upload test coverage report to Codecov 209 if: ${{ inputs.coverage-report }} 210 uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 211 with: 212 token: ${{ secrets.CODECOV_TOKEN }} 213 file: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml 214 flags: ${{ inputs.multisite && 'multisite' || 'single' }},php 215 fail_ci_if_error: true 216 217 - name: Upload HTML coverage report as artifact 218 if: ${{ inputs.coverage-report }} 219 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 220 with: 221 name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} 222 path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }} 223 overwrite: true 194 224 195 225 - name: Ensure version-controlled files are not modified or deleted
Note: See TracChangeset
for help on using the changeset viewer.