Repository navigation
97 lines (82 loc) · 2.71 KB
/
Copy pathtest-unit-php.yml
File metadata and controls
97 lines (82 loc) · 2.71 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
90
91
92
93
94
95
name: PHP Unit Tests
on:
push:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
- '.wp-env.json'
branches:
- master
- release/*
pull_request:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/**'
- '.wp-env.json'
- '.github/workflows/tests-unit-php.yml'
# Cancel in-progress runs for the same workflow and branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-php:
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
timeout-minutes: 60
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
wp: ['5.9.1']
include:
- php: '8.5'
wp: 'master'
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 'lts/*'
cache: 'npm'
- name: Setup PHP with Composer
uses: ./.github/actions/setup-php-composer
with:
php-version: ${{ matrix.php }}
extensions: 'mysql'
tools: 'composer'
- name: Dump autoload
run: composer dump-autoload --no-interaction
- name: Install Node dependencies
run: npm ci
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Start wp-env
run: |
echo "WP_ENV_PHP_VERSION: $WP_ENV_PHP_VERSION"
echo "WP_ENV_CORE: $WP_ENV_CORE"
npm run env:start -- --debug
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ format('WordPress/WordPress#{0}', matrix.wp) }}
- name: Run tests
run: |
npm run test:php
npm run test:php:multisite
- name: Stop wp-env
if: always()
run: npm run env:stop