1+ # Reusable workflow: installs EmbedPress on a matrix of WordPress + PHP
2+ # version combinations and runs a suite of activation and integrity checks
3+ # (constants, DB options, CPTs, taxonomies, shortcodes, REST routes, DB
4+ # tables, CRUD, and WP_DEBUG log inspection). Called by qa.yml after the
5+ # build job provides the plugin zip artifact. Version consistency and PHP
6+ # syntax checks run as separate parallel jobs in qa.yml.
7+
18name : QA - EmbedPress Compatibility Testing
29
10+ permissions : read-all
11+
312on :
4- workflow_dispatch : # Manual trigger
5- # pull_request:
6- # branches: ["main", "dev"]
7- # push:
8- # branches: ["main"]
13+ workflow_dispatch :
14+ inputs :
15+ artifact-name :
16+ required : true
17+ type : string
18+ workflow_call :
19+ inputs :
20+ artifact-name :
21+ required : true
22+ type : string
923
1024env :
11- FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
25+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
1226
1327jobs :
14- # ──────────────────────────────────────────────────────────────────────────
15- # Job 0: Version consistency (fast, no server required, runs before matrix)
16- # ──────────────────────────────────────────────────────────────────────────
17- version-check :
18- runs-on : ubuntu-24.04
19- name : Version Consistency Check
20- steps :
21- - uses : actions/checkout@v4
22-
23- - name : Check all version numbers are consistent
24- run : |
25- # Extract each version string from its canonical location
26- V_HEADER=$(grep -oP "^\s*\*\s*Version:\s*\K[\d.]+" embedpress.php | head -1)
27- V_CONST=$(grep -oP "define\('EMBEDPRESS_VERSION',\s*\"?\K[\d.]+" includes.php | head -1)
28- V_PLG=$(grep -oP "define\('EMBEDPRESS_PLUGIN_VERSION',\s*'?\K[\d.]+" embedpress.php | head -1)
29- V_README=$(grep -oP "Stable tag:\s*\K[\d.]+" readme.txt | head -1)
30-
31- echo "Plugin header (Version:): $V_HEADER"
32- echo "EMBEDPRESS_VERSION (includes): $V_CONST"
33- echo "EMBEDPRESS_PLUGIN_VERSION (main): $V_PLG"
34- echo "readme.txt Stable tag: $V_README"
35-
36- MISMATCH=0
37- [ "$V_HEADER" != "$V_CONST" ] && echo "::error::MISMATCH: Plugin header ($V_HEADER) ≠ EMBEDPRESS_VERSION ($V_CONST)" && MISMATCH=1
38- [ "$V_HEADER" != "$V_PLG" ] && echo "::error::MISMATCH: Plugin header ($V_HEADER) ≠ EMBEDPRESS_PLUGIN_VERSION ($V_PLG)" && MISMATCH=1
39- [ "$V_HEADER" != "$V_README" ] && echo "::error::MISMATCH: Plugin header ($V_HEADER) ≠ readme.txt Stable tag ($V_README)" && MISMATCH=1
40- [ "$MISMATCH" -eq 1 ] && exit 1
41-
42- echo "✅ All version numbers are consistent: $V_HEADER"
43-
44- # ──────────────────────────────────────────────────────────────────────────
45- # Job 1: PHP syntax lint (fast, no server, runs in parallel with version-check)
46- # ──────────────────────────────────────────────────────────────────────────
47- php-syntax-check :
48- runs-on : ubuntu-24.04
49- strategy :
50- fail-fast : false
51- matrix :
52- php-version : ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]
53- name : PHP Syntax (${{ matrix.php-version }})
54- steps :
55- - uses : actions/checkout@v4
56-
57- - name : Setup PHP ${{ matrix.php-version }}
58- uses : shivammathur/setup-php@v2
59- with :
60- php-version : ${{ matrix.php-version }}
61-
62- - name : Lint all PHP files
63- run : |
64- # Find every .php file, excluding vendor (third-party) and node_modules
65- FILES=$(find . -name "*.php" \
66- -not -path "./vendor/*" \
67- -not -path "./node_modules/*" \
68- -not -path "./.git/*")
69-
70- ERRORS=0
71- while IFS= read -r file; do
72- OUTPUT=$(php -l "$file" 2>&1)
73- if [ $? -ne 0 ]; then
74- echo "::error file=$file::$OUTPUT"
75- ERRORS=$((ERRORS + 1))
76- fi
77- done <<< "$FILES"
78-
79- TOTAL=$(echo "$FILES" | wc -l | tr -d ' ')
80- if [ "$ERRORS" -gt 0 ]; then
81- echo "::error::PHP syntax errors found in $ERRORS / $TOTAL file(s) on PHP ${{ matrix.php-version }}"
82- exit 1
83- fi
84- echo "✅ All $TOTAL PHP files passed syntax check on PHP ${{ matrix.php-version }}"
85-
86- # ──────────────────────────────────────────────────────────────────────────
87- # Job 2: Build the plugin zip
88- # ──────────────────────────────────────────────────────────────────────────
89- build :
90- uses : ./.github/workflows/dist-archive.yml
91-
92- # ──────────────────────────────────────────────────────────────────────────
93- # Job 2: Matrix compatibility tests
94- # ──────────────────────────────────────────────────────────────────────────
9528 compatibility-test :
96- needs : [version-check, php-syntax-check, build]
9729 runs-on : ubuntu-24.04
30+ timeout-minutes : 10
9831 strategy :
9932 fail-fast : false
10033 matrix :
10134 include :
10235 - wp-version : " 6.9.4"
103- php-version : " 7.4 "
36+ php-version : " 8.5 "
10437 - wp-version : " 6.9.4"
105- php-version : " 8.0 "
38+ php-version : " 8.4 "
10639 - wp-version : " 6.9.4"
10740 php-version : " 8.2"
10841 - wp-version : " 6.9.4"
109- php-version : " 8.4 "
42+ php-version : " 8.0 "
11043 - wp-version : " 6.9.4"
111- php-version : " 8.5 "
44+ php-version : " 7.4 "
11245 - wp-version : " 6.5.5"
11346 php-version : " 8.1"
11447 - wp-version : " 6.0.9"
@@ -117,19 +50,19 @@ jobs:
11750 name : WP ${{ matrix.wp-version }} / PHP ${{ matrix.php-version }}
11851
11952 steps :
120- # Setup PHP environment
121- - name : Setup PHP Runtime
53+ # Setup PHP + WP-CLI via shivammathur (handles WP-CLI install automatically)
54+ - name : Setup PHP ${{ matrix.php-version }} + WP-CLI
12255 uses : shivammathur/setup-php@v2
12356 with :
12457 php-version : ${{ matrix.php-version }}
125- extensions : mysqli, mbstring, xml, gd
58+ extensions : mysqli, mbstring, xml, gd, zip
12659 tools : wp-cli
12760
12861 # Download the built artifact from the 'build' job
12962 - name : Download Built EmbedPress
13063 uses : actions/download-artifact@v4
13164 with :
132- name : ${{ needs.build.outputs .artifact-name }}
65+ name : ${{ inputs .artifact-name }}
13366 path : ./embedpress-dist
13467
13568 - name : Start Database
@@ -140,17 +73,37 @@ jobs:
14073 - name : Install WordPress Core
14174 run : |
14275 wp core download --version=${{ matrix.wp-version }} --path=./test-site --allow-root
143- cd test-site
76+ cd test-site
14477 wp config create --dbname=wordpress_test --dbuser=root --dbpass=root --dbhost=127.0.0.1 --allow-root
145- wp core install --url=http://localhost:8080 --title="EmbedPress Test" --admin_user=admin --admin_password=password --admin_email=hurayra@wpdeveloper.com --allow-root
78+ wp core install \
79+ --url=http://localhost:8080 \
80+ --title="EmbedPress Test" \
81+ --admin_user=admin \
82+ --admin_password=password \
83+ --admin_email=hurayra@wpdeveloper.com \
84+ --allow-root
85+
86+ # Install from zip (10up action uploads the plugin as a zip artifact)
87+ - name : Install EmbedPress
88+ run : |
89+ ZIP_FILE=$(find ./embedpress-dist -maxdepth 2 -name "*.zip" | head -n 1)
90+
91+ if [ -n "$ZIP_FILE" ]; then
92+ echo "Installing from zip: $ZIP_FILE"
93+ wp plugin install "$(realpath "$ZIP_FILE")" --path=./test-site --allow-root
94+ else
95+ echo "No zip found — falling back to directory copy"
96+ PLUGIN_SRC=$(find ./embedpress-dist -maxdepth 1 -mindepth 1 -type d | head -n 1)
97+ [ -z "$PLUGIN_SRC" ] && PLUGIN_SRC="./embedpress-dist"
98+ mkdir -p ./test-site/wp-content/plugins/embedpress
99+ cp -r "$PLUGIN_SRC/." ./test-site/wp-content/plugins/embedpress/
100+ fi
101+
102+ echo "Plugin directory contents:"
103+ ls ./test-site/wp-content/plugins/embedpress | head -n 15
146104
147- # Move the built plugin to the WP folder and activate
148- - name : Install and Activate EmbedPress
105+ - name : Activate EmbedPress
149106 run : |
150- mkdir -p ./test-site/wp-content/plugins/embedpress
151- cp -r ./embedpress-dist/embedpress/. ./test-site/wp-content/plugins/embedpress/
152- echo "Checking plugin directory structure:"
153- ls ./test-site/wp-content/plugins/embedpress | head -n 10
154107 cd test-site
155108 wp plugin activate embedpress --allow-root
156109
0 commit comments