Skip to content

Commit accb116

Browse files
committed
Speed up the tests.
1 parent dea1bdf commit accb116

File tree

1 file changed

+0
-137
lines changed

1 file changed

+0
-137
lines changed

.github/workflows/reusable-phpunit-tests-v3.yml

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -129,140 +129,3 @@ jobs:
129129
run: |
130130
echo "PHP_FPM_UID=$(id -u)" >> "$GITHUB_ENV"
131131
echo "PHP_FPM_GID=$(id -g)" >> "$GITHUB_ENV"
132-
133-
- name: Checkout repository
134-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135-
with:
136-
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
137-
persist-credentials: false
138-
139-
- name: Set up Node.js
140-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
141-
with:
142-
node-version-file: '.nvmrc'
143-
cache: npm
144-
145-
##
146-
# This allows Composer dependencies to be installed using a single step.
147-
#
148-
# Since the tests are currently run within the Docker containers where the PHP version varies,
149-
# the same PHP version needs to be configured for the action runner machine so that the correct
150-
# dependency versions are installed and cached.
151-
##
152-
- name: Set up PHP
153-
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
154-
with:
155-
php-version: '${{ inputs.php }}'
156-
coverage: none
157-
158-
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
159-
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
160-
- name: Install Composer dependencies
161-
uses: ramsey/composer-install@a2636af0004d1c0499ffca16ac0b4cc94df70565 # v3.1.0
162-
with:
163-
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
164-
165-
- name: Install npm dependencies
166-
run: npm ci
167-
168-
- name: General debug information
169-
run: |
170-
npm --version
171-
node --version
172-
curl --version
173-
git --version
174-
composer --version
175-
locale -a
176-
177-
- name: Docker debug information
178-
run: |
179-
docker -v
180-
181-
- name: Start Docker environment
182-
run: |
183-
npm run env:start
184-
185-
- name: Log running Docker containers
186-
run: docker ps -a
187-
188-
- name: WordPress Docker container debug information
189-
run: |
190-
docker compose run --rm mysql "${LOCAL_DB_CMD}" --version
191-
docker compose run --rm php php --version
192-
docker compose run --rm php php -m
193-
docker compose run --rm php php -i
194-
docker compose run --rm php locale -a
195-
env:
196-
LOCAL_DB_CMD: ${{ env.LOCAL_DB_TYPE == 'mariadb' && contains( fromJSON('["5.5", "10.0", "10.1", "10.2", "10.3"]'), env.LOCAL_DB_VERSION ) && 'mysql' || env.LOCAL_DB_TYPE }}
197-
198-
- name: Install WordPress
199-
run: npm run env:install
200-
201-
- name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }}
202-
continue-on-error: ${{ inputs.allow-errors }}
203-
run: |
204-
node ./tools/local-env/scripts/docker.js run \
205-
php ./vendor/bin/phpunit \
206-
--verbose \
207-
-c "${PHPUNIT_CONFIG}" \
208-
${{ inputs.phpunit-test-groups && '--group "${TEST_GROUPS}"' || '' }} \
209-
${{ inputs.coverage-report && '--coverage-clover "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}.xml" --coverage-html "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}"' || '' }}
210-
env:
211-
TEST_GROUPS: ${{ inputs.phpunit-test-groups }}
212-
MULTISITE_FLAG: ${{ inputs.multisite && 'multisite' || 'single' }}
213-
214-
- name: Run AJAX tests
215-
if: ${{ ! inputs.phpunit-test-groups && ! inputs.coverage-report }}
216-
continue-on-error: ${{ inputs.allow-errors }}
217-
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ajax
218-
219-
- name: Run ms-files tests as a multisite install
220-
if: ${{ inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }}
221-
continue-on-error: ${{ inputs.allow-errors }}
222-
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group ms-files
223-
224-
- name: Run external HTTP tests
225-
if: ${{ ! inputs.multisite && ! inputs.phpunit-test-groups && ! inputs.coverage-report }}
226-
continue-on-error: ${{ inputs.allow-errors }}
227-
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c "${PHPUNIT_CONFIG}" --group external-http
228-
229-
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
230-
- name: Run (Xdebug) tests
231-
if: ${{ inputs.php != '8.4' && ! inputs.phpunit-test-groups && ! inputs.coverage-report }}
232-
continue-on-error: ${{ inputs.allow-errors }}
233-
run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
234-
235-
- name: Upload test coverage report to Codecov
236-
if: ${{ inputs.coverage-report }}
237-
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
238-
with:
239-
token: ${{ secrets.CODECOV_TOKEN }}
240-
files: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}.xml
241-
flags: ${{ inputs.multisite && 'multisite' || 'single' }},php
242-
fail_ci_if_error: true
243-
244-
- name: Upload HTML coverage report as artifact
245-
if: ${{ inputs.coverage-report }}
246-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
247-
with:
248-
name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}
249-
path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}
250-
overwrite: true
251-
252-
- name: Ensure version-controlled files are not modified or deleted
253-
run: git diff --exit-code
254-
255-
- name: Checkout the WordPress Test Reporter
256-
if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }}
257-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
258-
with:
259-
repository: 'WordPress/phpunit-test-runner'
260-
path: 'test-runner'
261-
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
262-
persist-credentials: false
263-
264-
- name: Submit test results to the WordPress.org host test results
265-
if: ${{ github.ref == 'refs/heads/trunk' && inputs.report }}
266-
env:
267-
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
268-
run: docker compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php

0 commit comments

Comments
 (0)