Implement v2 API endpoints #37
Workflow file for this run
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: Run PHPUnit Tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: wordpress_tests | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=10s | |
--health-retries=10 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP, with Composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, xml, curl, pdo_mysql | |
coverage: pcov | |
tools: composer:v2 | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Verify MySQL connection | |
run: | | |
sudo apt-get install -y mysql-client | |
mysql --host 127.0.0.1 -uroot -proot -e "SHOW DATABASES" | |
- name: Prepare WordPress Database | |
run: | | |
mysql --host 127.0.0.1 -uroot -proot -e "CREATE USER IF NOT EXISTS 'wp'@'localhost' IDENTIFIED BY 'wp';" | |
mysql --host 127.0.0.1 -uroot -proot -e "GRANT ALL PRIVILEGES ON wordpress_tests.* TO 'wp'@'localhost';" | |
mysql --host 127.0.0.1 -uroot -proot -e "FLUSH PRIVILEGES;" | |
- name: Run PHPUnit tests | |
run: vendor/bin/phpunit tests/ |