-
Notifications
You must be signed in to change notification settings - Fork 31
50 lines (40 loc) · 1.27 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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' # Ensuring PHP 8.1 is used
extensions: mbstring, xml, curl, pdo_mysql
coverage: pcov
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Prepare WordPress Database
run: |
mysql -e 'CREATE DATABASE wordpress_tests;' -uroot -proot
mysql -e "GRANT ALL PRIVILEGES ON wordpress_tests.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';" -uroot -proot
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot
- name: Run PHPUnit tests
run: vendor/bin/phpunit
- name: Check coding standards
run: ./vendor/bin/phpcs