-
Notifications
You must be signed in to change notification settings - Fork 14
113 lines (97 loc) · 3.79 KB
/
test.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Friends
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4']
phpunit: ['6.3.1']
wordpress: ['6.0', 'trunk']
include:
- php: '5.6'
phpunit: '5.7.21'
wordpress: '6.0'
- php: '7.2'
phpunit: '6.3.1'
wordpress: '6.0'
- php: '7.2'
phpunit: '6.3.1'
wordpress: 'trunk'
- php: '7.3'
phpunit: '7.2.7'
wordpress: '6.0'
- php: '7.4'
phpunit: '8.1.6'
wordpress: 'trunk'
- php: '8.0'
phpunit: '8.5.16'
wordpress: 'trunk'
- php: '8.1'
phpunit: '9.5.27'
wordpress: 'trunk'
- php: '8.2'
phpunit: '9.5.27'
wordpress: 'trunk'
services:
mariadb:
image: mariadb:lts
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress_test
name: "Tests: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}} - WordPress: ${{matrix.wordpress}}"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql
tools: phpunit-polyfills composer
ini-values: error_reporting=E_ALL, display_errors=On
coverage: none
- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"${{ job.services.mariadb.ports[3306] }}" --silent; do
sleep 1
done
- name: 'Composer: set PHPUnit version for tests'
if: ${{ matrix.phpunit != 'auto' }}
run: composer require --dev --no-update phpunit/phpunit:"${{ matrix.phpunit }}"
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies for PHP < 8.2
if: ${{ matrix.php < 8.2 }}
uses: "ramsey/composer-install@v2"
# For PHP 8.2 and above, we need to install with ignore platform reqs as not all dependencies allow it yet.
- name: Install Composer dependencies for PHP >= 8.2
if: ${{ matrix.php >= 8.2 }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs
- name: "Lint PHP files against parse errors - PHP < 7.0"
if: ${{ matrix.phpunit == 'auto' && matrix.php < 7.0 }}
run: composer lint-lt70
- name: "Lint PHP files against parse errors - PHP 7.x"
if: ${{ matrix.phpunit == 'auto' && startsWith( matrix.php, '7' ) }}
run: composer lint7
- name: "Lint PHP files against parse errors - PHP >= 8.0"
if: ${{ matrix.phpunit == 'auto' && matrix.php >= 8.0 }}
run: composer lint-gte80
# Scan the logs for failing tests and surface that information by creating annotations and log file decorations.
- name: Setup problem matcher to provide annotations for PHPUnit test errors and failures
# The JSON file is provided by the `shivammathur/setup-php` action. See https://github.com/shivammathur/setup-php#problem-matchers.
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install the test environment
run: bash bin/install-wp-tests.sh wordpress_test root wordpress 127.0.0.1:${{ job.services.mariadb.ports[3306] }} ${{ matrix.wordpress }} true
- name: Run the unit tests
run: composer test
- name: Run the multisite unit tests
env:
WP_MULTISITE: 1
run: composer test