Integrate Unit Tests via PHPUnit (WIP) #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: Integration Testing | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
testing: | |
name: Run tests | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mariadb:latest | |
ports: | |
- '1337:3306' | |
env: | |
MYSQL_ROOT_PASSWORD: wordpress | |
MARIADB_INITDB_SKIP_TZINFO: 1 | |
MYSQL_USER: wordpress | |
MYSQL_PASSWORD: wordpress | |
MYSQL_DATABASE: wordpress_test | |
steps: | |
- name: Check out the source code | |
uses: actions/checkout@v3 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: none | |
php-version: "8.2" | |
- name: Install PHP Dependencies | |
uses: ramsey/composer-install@v3 | |
- name: Composer dump-autoload | |
run: composer dump-autoload | |
- name: Set up WordPress and WordPress Test Library | |
uses: sjinks/[email protected] | |
- name: Install MySQL Client | |
run: sudo apt-get update && sudo apt-get install -y mysql-client | |
- name: Verify MariaDB connection | |
run: | | |
while ! mysqladmin ping -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} --silent; do | |
sleep 1 | |
done | |
timeout-minutes: 1 | |
- name: Run PHPUnit | |
run: vendor/bin/phpunit |