-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (59 loc) · 1.84 KB
/
tests.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
51
52
53
54
55
56
57
58
59
60
61
name: Tests
on: pull_request
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- 8.1
- 7.4
- 5.6
wp:
- "*"
subdir_install:
- 0
include:
- php: 7.4
wp: "*"
subdir_install: 1
- php: 5.6
wp: "5.2.*"
subdir_install: 0
services:
mysql:
image: mysql:5
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
env:
DB_HOST: 127.0.0.1
WP_DB_USER: wp
WP_DB_PASS: password
WP_DB_NAME: wp_tests
TEST_SUBDIRECTORY_INSTALL: ${{ matrix.subdir_install }}
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }} / Sub-dir ${{ matrix.subdir_install }}
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli
- name: Create database
env:
MYSQL_TCP_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
mysql -u root -h ${DB_HOST} -e "CREATE DATABASE ${WP_DB_NAME};"
mysql -u root -h ${DB_HOST} -e "CREATE USER ${WP_DB_USER} IDENTIFIED BY '${WP_DB_PASS}';"
mysql -u root -h ${DB_HOST} -e "GRANT ALL PRIVILEGES ON ${WP_DB_NAME}.* TO ${WP_DB_USER};"
- uses: actions/checkout@v4
- run: composer validate --strict
- run: composer require --dev --no-update roots/wordpress:${{ matrix.wp }} wp-phpunit/wp-phpunit:${{ matrix.wp }}
- run: composer install --no-progress --no-interaction
- run: composer show
- name: Run PHPUnit
run: composer test
env:
WP_DB_HOST: ${{ env.DB_HOST }}:${{ job.services.mysql.ports[3306] }}