1+ name : Unit Tests
2+
3+ on :
4+ push :
5+ paths-ignore :
6+ - ' **.md'
7+ - ' **.txt'
8+ pull_request :
9+ paths-ignore :
10+ - ' **.md'
11+ - ' **.txt'
12+ workflow_dispatch :
13+
14+ jobs :
15+ test :
16+ runs-on : ubuntu-latest
17+
18+ strategy :
19+ fail-fast : false
20+ matrix :
21+ php : ['7.4', '8.1', '8.2', '8.3']
22+ wp : ['latest']
23+ mysql : ['8.0']
24+
25+ include :
26+ - php : ' 8.3'
27+ wp : ' 6.6'
28+ mysql : ' 8.0'
29+ - php : ' 8.4'
30+ wp : ' latest'
31+ mysql : ' 8.0'
32+ experimental : true
33+ - php : ' 8.5'
34+ wp : ' latest'
35+ mysql : ' 8.0'
36+ experimental : true
37+
38+ name : " PHP ${{ matrix.php }} - WP ${{ matrix.wp }} - MySQL ${{ matrix.mysql }}"
39+ continue-on-error : ${{ matrix.experimental == true }}
40+
41+ steps :
42+ - name : Checkout code
43+ uses : actions/checkout@v4
44+
45+ - name : Setup MySQL
46+ uses : ankane/setup-mysql@v1
47+ with :
48+ mysql-version : ${{ matrix.mysql }}
49+
50+ - name : Install PHP
51+ uses : shivammathur/setup-php@v2
52+ with :
53+ php-version : ${{ matrix.php }}
54+ extensions : mysqli
55+ coverage : none
56+
57+ - name : Set PHPUnit version
58+ run : |
59+ if [[ "${{ matrix.php }}" > "8.0" ]]; then
60+ echo "PHPUNIT=9.*" >> $GITHUB_ENV
61+ else
62+ echo "PHPUNIT=5.7.*||6.*||7.5.*||8.5.*" >> $GITHUB_ENV
63+ fi
64+
65+ - name : Set up PHPUnit
66+ run : composer require --no-update phpunit/phpunit:"$PHPUNIT"
67+
68+ - name : Install dependencies for PHP < 8.0
69+ if : ${{ matrix.php < 8.0 }}
70+ uses : ramsey/composer-install@v3
71+
72+ - name : Install dependencies for PHP >= 8.0
73+ if : ${{ matrix.php >= 8.0 }}
74+ uses : ramsey/composer-install@v3
75+ with :
76+ composer-options : --ignore-platform-reqs
77+
78+ - name : Set up WordPress test environment
79+ run : |
80+ sudo apt-get install -y subversion
81+ bash phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
82+
83+ - name : Run tests (single site)
84+ run : vendor/bin/phpunit
85+
86+ - name : Run tests (multisite)
87+ env :
88+ WP_MULTISITE : 1
89+ run : vendor/bin/phpunit
0 commit comments