-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 1.42 KB
/
php-tests.yml
File metadata and controls
61 lines (49 loc) · 1.42 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
name: PHP Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
# dorny/test-reporter needs these to post check runs and PR annotations.
permissions:
checks: write
pull-requests: write
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
coverage: none
- name: Install npm dependencies
run: npm ci
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Start WordPress environment
run: npm run env:start
- name: Wait for WordPress to be ready
run: |
echo "Waiting for WordPress test environment to be ready..."
timeout 120 bash -c 'until curl -s http://localhost:3333 > /dev/null; do sleep 2; done'
echo "WordPress is ready!"
- name: Run PHPUnit
run: npm run test:php
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: PHPUnit Results
path: phpunit-results.xml
reporter: java-junit
fail-on-error: true