-
Notifications
You must be signed in to change notification settings - Fork 104
76 lines (74 loc) · 2.3 KB
/
php-test-plugins.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
name: Unit Testing for Plugins
on:
push:
branches:
- trunk
- 'release/**'
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test-plugins.yml'
- 'plugins/**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'tests/multisite.xml'
- 'composer.json'
- 'composer.lock'
pull_request:
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test-plugins.yml'
- 'plugins/**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'tests/multisite.xml'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize
jobs:
php-test-plugins:
name: "PHP ${{ matrix.php }} / WP ${{ matrix.wp }}"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0']
wp: [ 'latest' ]
include:
- php: '7.4'
wp: '6.4'
- php: '8.3'
wp: 'trunk'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }}
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v3
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: npm install
run: npm ci
- name: Build assets
run: npm run build
- name: Install WordPress
run: npm run wp-env start
# Note that `composer update` is required instead of `composer install`
# for the sake of PHP versions older than 8.1, which is the version of
# PHP that the composer.lock was created for.
- name: Composer update
run: npm run wp-env run tests-cli -- --env-cwd="wp-content/plugins/$(basename $(pwd))" composer update --no-interaction
- name: Running single site unit tests for plugins
run: npm run test-php-plugins
- name: Running multisite unit tests for plugins
run: npm run test-php-multisite-plugins