Skip to content

Commit 346aa98

Browse files
authored
New Test
1 parent 5d6195e commit 346aa98

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: PHP 7.4 WordPress Latest Test
2+
3+
on:
4+
# Run on pushes to main branch and on all pull requests
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
# Allow manually triggering the workflow
9+
workflow_dispatch:
10+
11+
# Cancels all previous workflow runs for the same branch that have not yet completed
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
php74-wp-latest-test:
21+
name: Test PHP 7.4 with latest WordPress
22+
runs-on: ubuntu-latest
23+
24+
services:
25+
mysql:
26+
image: mysql:5.7
27+
env:
28+
MYSQL_ALLOW_EMPTY_PASSWORD: false
29+
MYSQL_ROOT_PASSWORD: root
30+
MYSQL_DATABASE: wordpress_test
31+
ports:
32+
- 3306:3306
33+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/[email protected]
38+
39+
- name: Setup PHP 7.4
40+
uses: shivammathur/[email protected]
41+
with:
42+
php-version: '7.4'
43+
extensions: mysqli, curl, zip, intl, gd, mbstring, fileinfo, xml
44+
coverage: none
45+
tools: composer:v2
46+
47+
- name: Install Subversion
48+
run: sudo apt-get update && sudo apt-get install -y subversion
49+
50+
- name: Remove the PHP platform requirement
51+
run: composer config --unset platform.php
52+
53+
- name: Install Composer dependencies
54+
uses: ramsey/[email protected]
55+
with:
56+
dependency-versions: highest
57+
composer-options: "--prefer-dist --no-progress"
58+
59+
- name: Prepare Database
60+
run: |
61+
# Drop the database if it exists to avoid creation error
62+
mysql -u root --password=root --host=127.0.0.1 --port=3306 -e "DROP DATABASE IF EXISTS wordpress_test;"
63+
mysql -u root --password=root --host=127.0.0.1 --port=3306 -e "CREATE DATABASE IF NOT EXISTS wordpress_test;"
64+
65+
- name: Setup WP Tests
66+
run: |
67+
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 latest
68+
working-directory: ${{ github.workspace }}/tests
69+
70+
- name: Run plugin test
71+
run: vendor/bin/phpunit --config phpunit.xml
72+
73+
- name: Report test status
74+
if: ${{ always() }}
75+
run: |
76+
if [ ${{ job.status }} == 'success' ]; then
77+
echo "✅ Tests passed successfully on PHP 7.4 with the latest WordPress version"
78+
else
79+
echo "❌ Tests failed on PHP 7.4 with the latest WordPress version"
80+
exit 1
81+
fi

0 commit comments

Comments
 (0)