Skip to content

Merge branch 'main' of github.com:wptrainingteam/assert-equal-html-ex… #1

Merge branch 'main' of github.com:wptrainingteam/assert-equal-html-ex…

Merge branch 'main' of github.com:wptrainingteam/assert-equal-html-ex… #1

Workflow file for this run

name: PHP Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
# dorny/test-reporter needs these to post check runs and PR annotations.
permissions:
checks: write
pull-requests: write
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
- name: Install npm dependencies
run: npm ci
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Start WordPress environment
run: npm run env:start
- name: Wait for WordPress to be ready
run: |
echo "Waiting for WordPress test environment to be ready..."
timeout 120 bash -c 'until curl -s http://localhost:3333 > /dev/null; do sleep 2; done'
echo "WordPress is ready!"
- name: Run PHPUnit
run: |
npx wp-env run tests-cli \
--env-cwd='/var/www/html/wp-content/plugins/assert-equal-html-examples' \
vendor/bin/phpunit --log-junit phpunit-results.xml
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: PHPUnit Results
path: phpunit-results.xml
reporter: java-junit
fail-on-error: true