-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.15 KB
/
unit-tests.yml
File metadata and controls
89 lines (74 loc) · 2.15 KB
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
name: Unit Tests
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.1', '8.2', '8.3']
wp: ['latest']
mysql: ['8.0']
include:
- php: '8.3'
wp: '6.6'
mysql: '8.0'
- php: '8.4'
wp: 'latest'
mysql: '8.0'
experimental: true
- php: '8.5'
wp: 'latest'
mysql: '8.0'
experimental: true
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }} - MySQL ${{ matrix.mysql }}"
continue-on-error: ${{ matrix.experimental == true }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup MySQL
uses: ankane/setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli
coverage: none
- name: Set PHPUnit version
run: |
if [[ "${{ matrix.php }}" > "8.0" ]]; then
echo "PHPUNIT=9.*" >> $GITHUB_ENV
else
echo "PHPUNIT=5.7.*||6.*||7.5.*||8.5.*" >> $GITHUB_ENV
fi
- name: Set up PHPUnit
run: composer require --no-update phpunit/phpunit:"$PHPUNIT"
- name: Install dependencies for PHP < 8.0
if: ${{ matrix.php < 8.0 }}
uses: ramsey/composer-install@v3
- name: Install dependencies for PHP >= 8.0
if: ${{ matrix.php >= 8.0 }}
uses: ramsey/composer-install@v3
with:
composer-options: --ignore-platform-reqs
- name: Set up WordPress test environment
run: |
sudo apt-get install -y subversion
bash phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
- name: Run tests (single site)
run: vendor/bin/phpunit
- name: Run tests (multisite)
env:
WP_MULTISITE: 1
run: vendor/bin/phpunit