-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (80 loc) · 2.26 KB
/
wp-unit-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: PHP WP Unit Tests
env:
COMPOSER_VER: "2.7.9"
on:
push:
branches: [ "master", "main", "dev" ]
pull_request:
types: [synchronize, opened, reopened]
permissions: {}
jobs:
phpunit:
name: ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.4, 8.0, 8.1, 8.2, 8.3 ]
services:
mysql:
image: mariadb:latest
ports:
- '3306: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
- uses: shivammathur/setup-php@v2
name: Set up PHP
with:
php-version: ${{ matrix.php-version }}
coverage: none
- uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php-version }}
version: ${{ env.COMPOSER_VER }}
- name: Run UnitTests
run: composer run phpunit
wp-unit:
name: ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.4, 8.0, 8.1, 8.2, 8.3 ]
services:
mysql:
image: mariadb:latest
ports:
- '3306: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
- uses: shivammathur/setup-php@v2
name: Set up PHP
with:
php-version: ${{ matrix.php-version }}
coverage: none
- name: Install PHP Dependencies
uses: ramsey/composer-install@v2
- name: Set up WordPress and WordPress Test Library
uses: sjinks/setup-wordpress-test-library@master
with:
version: latest
- 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
run: vendor/bin/phpunit -c php-wp-unit.xml