1
1
name : CI
2
2
3
- on : [push, pull_request]
3
+ on : # yamllint disable-line rule:truthy
4
+ workflow_dispatch :
5
+ pull_request :
6
+ push :
7
+ branches :
8
+ - " master"
9
+ - " develop"
10
+
11
+ permissions :
12
+ contents : " read"
13
+
14
+ concurrency :
15
+ group : " ${{ github.workflow }}-${{ github.ref }}"
16
+ cancel-in-progress : true
4
17
5
18
jobs :
6
19
run :
7
- runs-on : ${{ matrix.operating-system }}
8
- services :
9
- mysql :
10
- image : mysql:5.7
11
- env :
12
- MYSQL_ALLOW_EMPTY_PASSWORD : false
13
- MYSQL_ROOT_PASSWORD : root
14
- MYSQL_DATABASE : wordpress_test
15
- ports :
16
- - 3306:3306
17
- options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
20
+ runs-on : ubuntu-22.04
18
21
strategy :
19
22
matrix :
20
- operating-system : [ ubuntu-latest ]
21
23
php-versions : [ '8.0', '8.1', '8.2', '8.3' ]
22
- wp : [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', 'latest' ]
23
- name : PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} with WP ${{ matrix.wp }}
24
+ core : [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', 'latest' ]
25
+ name : Test PHP ${{ matrix.php-versions }} with WP ${{ matrix.core }}
24
26
steps :
25
27
- name : Checkout
26
28
uses : actions/checkout@v1
27
29
28
- - name : Setup PHP
30
+ - name : Set up PHP
29
31
uses : shivammathur/setup-php@v2
30
32
with :
31
- php-version : ${{ matrix.php-versions }}
32
- coverage : xdebug # optional, setup coverage driver
33
-
34
- - name : Install all depedencies
35
- run : composer update
36
-
37
- - name : Install WP Tests
38
- run : bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp }} true
39
-
40
- - name : phpunit tests
41
- run : ./vendor/bin/phpunit
33
+ php-version : ${{ matrix.php_version }}
34
+ ini-file : development
35
+ coverage : none
36
+
37
+ - name : Override PHP version in composer.json
38
+ run : composer config platform.php ${{ matrix.php_version }}
39
+
40
+ - name : Composer install
41
+ run : composer install -o
42
+
43
+ - name : Setup Node
44
+ uses : actions/setup-node@v4
45
+ with :
46
+ node-version : ' 20.11.*'
47
+ cache : npm
48
+
49
+ - name : Install JS dependencies
50
+ run : npm ci
51
+
52
+ - name : Launch environment
53
+ run : WP_ENV_PHP_VERSION=${{ matrix.php_version }} WP_ENV_CORE=WordPress/WordPress#${{ matrix.core }} npm run env:start-ci
54
+
55
+ - name : Updates dependencies for tests
56
+ run : npm run env run tests-wordpress composer update -- -W --working-dir=/var/www/html/wp-content/plugins/wp-http-blocklist/
57
+
58
+ - name : Update Yoast dependencies
59
+ run : npm run env run tests-wordpress composer update -- --dev yoast/phpunit-polyfills -W --working-dir=/var/www/html/wp-content/plugins/wp-http-blocklist/
60
+
61
+ - name : Test PHP
62
+ run : npm run test:php
0 commit comments