Add the first set of unit tests #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
types: [ opened, synchronize ] | |
jobs: | |
phpunit: | |
name: PHPUnit ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: | |
- 3306/tcp | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
# Set health checks to wait until mysql has started | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ '7.4', '8.3' ] | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: 'none' | |
tools: composer | |
- name: Install dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
composer-options: "--no-progress --no-ansi --no-interaction" | |
- name: Install WordPress test setup | |
run: bash bin/install-wp-tests.sh wordpress_test root password 127.0.0.1:${{ job.services.mysql.ports[3306] }} latest | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Run tests | |
env: | |
WP_TESTS_DIR: /tmp/wordpress-tests-lib/ | |
run: vendor/bin/phpunit |