44 workflow_dispatch :
55 inputs :
66 core_branch :
7- description : ' Elementor Core Branch'
7+ description : " Elementor Core Branch"
88 required : true
99 hello_theme_version :
10- description : ' Hello Theme version to test (e.g., 3.4.4 or main)'
10+ description : " Hello Theme version to test (e.g., 3.4.4 or main)"
1111 required : false
12- default : ' main'
12+ default : " main"
1313 tag :
14- description : ' Provide @tag or a keyword'
14+ description : " Provide @tag or a keyword"
1515 required : false
1616 workflow_call :
1717 inputs :
1818 core_branch :
19- description : ' Elementor Core Branch'
19+ description : " Elementor Core Branch"
2020 required : true
2121 type : string
2222 hello_theme_version :
23- description : ' Hello Theme version to test (e.g., 3.4.4 or main)'
23+ description : " Hello Theme version to test (e.g., 3.4.4 or main)"
2424 required : false
2525 type : string
2626 tag :
27- description : ' Provide @tag or a keyword'
27+ description : " Provide @tag or a keyword"
2828 required : false
2929 type : string
3030 secrets :
@@ -61,13 +61,13 @@ jobs:
6161 run : |
6262 # Set Elementor Core branch from input (can be branch name or version)
6363 ELEMENTOR_CORE_BRANCH="${{ inputs.core_branch }}"
64-
64+
6565 # Hello Theme version from current repo (like Hello Commerce pattern)
6666 HT_VERSION=$(node -p "require('./package.json').version")
67-
67+
6868 # Input version for reference (main, etc.)
6969 HELLO_THEME_INPUT="${{ inputs.hello_theme_version || 'main' }}"
70-
70+
7171 # Determine source type for reporting - Hello Theme always builds from GitHub
7272 # Unlike Hello Commerce/Biz, Hello Theme doesn't download from WordPress.org
7373 if [[ "$HELLO_THEME_INPUT" == "main" ]]; then
@@ -82,23 +82,23 @@ jobs:
8282 HELLO_THEME_SOURCE_TYPE="git-branch"
8383 HELLO_THEME_SOURCE="github"
8484 fi
85-
85+
8686 echo "hello-theme-version=${HT_VERSION}" >> $GITHUB_OUTPUT
8787 echo "hello-theme-input=${HELLO_THEME_INPUT}" >> $GITHUB_OUTPUT
8888 echo "hello-theme-source-type=${HELLO_THEME_SOURCE_TYPE}" >> $GITHUB_OUTPUT
8989 echo "hello-theme-source=${HELLO_THEME_SOURCE}" >> $GITHUB_OUTPUT
9090 echo "elementor-core-branch=${ELEMENTOR_CORE_BRANCH}" >> $GITHUB_OUTPUT
9191 echo "elementor-version=${ELEMENTOR_CORE_BRANCH}" >> $GITHUB_OUTPUT
92-
92+
9393 # Set environment variables for later steps
9494 echo "HELLO_THEME_VERSION=${HT_VERSION}" >> $GITHUB_ENV
9595 echo "HELLO_THEME_INPUT=${HELLO_THEME_INPUT}" >> $GITHUB_ENV
9696 echo "HELLO_THEME_SOURCE_TYPE=${HELLO_THEME_SOURCE_TYPE}" >> $GITHUB_ENV
97-
97+
9898 # Generate artifact name using input version for readability
9999 ARTIFACT_NAME="core-ht${HELLO_THEME_INPUT}-el${ELEMENTOR_CORE_BRANCH}-${{ github.run_id }}"
100100 echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
101-
101+
102102 echo "✅ Set versions: Hello Theme=${HT_VERSION} (${HELLO_THEME_INPUT}), Elementor=${ELEMENTOR_CORE_BRANCH}"
103103
104104 - name : Build Hello Theme
@@ -107,16 +107,14 @@ jobs:
107107 PACKAGE_VERSION : ${{ steps.set-versions.outputs.hello-theme-version }}
108108 BUILD_SCRIPT_PATH : " npm run build:prod"
109109
110-
111-
112110 - name : Download Elementor Core
113111 run : |
114112 ELEMENTOR_CORE_BRANCH="${{ steps.set-versions.outputs.elementor-core-branch }}"
115113 echo "Downloading Elementor Core branch: ${ELEMENTOR_CORE_BRANCH}"
116-
114+
117115 # Create Elementor build directory
118116 mkdir -p ./tmp
119-
117+
120118 if [[ "$ELEMENTOR_CORE_BRANCH" == "latest-stable" ]]; then
121119 # Download latest stable from WordPress.org
122120 curl --location -o ./elementor-core.zip https://downloads.wordpress.org/plugin/elementor.latest-stable.zip
@@ -181,17 +179,17 @@ jobs:
181179 ls -la ./
182180 echo "Creating tmp directory if it doesn't exist:"
183181 mkdir -p ./tmp
184-
182+
185183 - name : Hybrid Test Setup - Extract tests from target version
186184 id : extract-version-tests
187185 run : |
188186 echo "🎯 HYBRID APPROACH: Always latest workflows + version-specific tests"
189187 echo "📋 Workflow infrastructure: main branch (latest build-wp-env.js, scripts, etc.)"
190188 echo "🧪 Test content: ${{ inputs.hello_theme_version || 'main' }} (matches theme functionality)"
191-
189+
192190 # Determine the target version for test extraction
193191 TARGET_VERSION="${{ inputs.hello_theme_version || 'main' }}"
194-
192+
195193 if [ "$TARGET_VERSION" = "main" ]; then
196194 echo "✅ Using main branch tests (already available)"
197195 TEST_VERSION="main"
@@ -247,12 +245,12 @@ jobs:
247245 TEST_SOURCE_TYPE="not-available"
248246 fi
249247 fi
250-
248+
251249 # Set outputs for workflow control
252250 echo "test-version=$TEST_VERSION" >> $GITHUB_OUTPUT
253251 echo "test-source-type=$TEST_SOURCE_TYPE" >> $GITHUB_OUTPUT
254252 echo "tests-available=$TESTS_AVAILABLE" >> $GITHUB_OUTPUT
255-
253+
256254 echo "✅ Hybrid setup complete:"
257255 echo " 🏗️ Workflow infrastructure: main branch"
258256 echo " 🧪 Test content: $TEST_VERSION ($TEST_SOURCE_TYPE)"
@@ -262,12 +260,12 @@ jobs:
262260 uses : actions/setup-node@v4
263261 with :
264262 node-version : 20.x
265- cache : ' npm'
263+ cache : " npm"
266264
267265 - name : Setup PHP
268266 uses : shivammathur/setup-php@v2
269267 with :
270- php-version : ' 8.1'
268+ php-version : " 8.1"
271269 tools : composer
272270 coverage : none
273271
@@ -290,10 +288,10 @@ jobs:
290288 echo "Current directory contents:"
291289 ls -la ./
292290 echo ""
293-
291+
294292 # Ensure tmp directory exists
295293 mkdir -p ./tmp
296-
294+
297295 echo "Checking for Elementor artifacts:"
298296 if [ -d "./tmp/elementor" ]; then
299297 echo "✅ Elementor directory found in tmp"
@@ -331,7 +329,7 @@ jobs:
331329 echo "✅ Elementor fallback installed"
332330 fi
333331 fi
334-
332+
335333 echo ""
336334 echo "Final verification:"
337335 echo "tmp directory contents:"
@@ -347,7 +345,7 @@ jobs:
347345 run : |
348346 echo "Extracting Hello Theme build..."
349347 HT_ZIP=$(find . -name "hello-elementor-*.zip" -type f | head -1)
350-
348+
351349 if [ -n "$HT_ZIP" ]; then
352350 echo "Found Hello Theme build: $HT_ZIP"
353351 mkdir -p ./tmp
@@ -373,16 +371,33 @@ jobs:
373371
374372 - name : Update wp-env.json file
375373 env :
376- PHP_VERSION : ' 8.1'
377- WP_CORE_VERSION : ' latest'
374+ PHP_VERSION : " 8.1"
375+ WP_CORE_VERSION : " latest"
378376 HELLO_THEME_VERSION : ${{ env.HELLO_THEME_VERSION }}
379377 ELEMENTOR_VERSION : ${{ env.ELEMENTOR_VERSION }}
380378 run : node ./.github/scripts/build-wp-env.js
381379
382380 - name : Install WordPress environment
383381 run : |
384- npx wp-env start
385-
382+ echo "Starting WordPress environment with retry logic..."
383+ for i in {1..5}; do
384+ echo "Attempt $i/5: Starting wp-env..."
385+ if npx wp-env start; then
386+ echo "✅ WordPress environment started successfully"
387+ break
388+ else
389+ echo "❌ Attempt $i failed"
390+ if [ $i -eq 5 ]; then
391+ echo "🚨 All attempts failed, exiting..."
392+ exit 1
393+ else
394+ echo "⏳ Waiting 30 seconds before retry..."
395+ npx wp-env stop || true
396+ sleep 30
397+ fi
398+ fi
399+ done
400+
386401 - name : Setup WordPress environment (activate plugins and themes)
387402 run : |
388403 npx wp-env run cli bash hello-elementor-config/setup.sh
@@ -403,7 +418,7 @@ jobs:
403418 echo "🧪 Running tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}"
404419 # Only run Hello Theme tests, not Elementor or other plugin tests
405420 npm run test:playwright -- tests/playwright/tests/
406-
421+
407422 - name : Skip tests - version incompatible
408423 if : steps.extract-version-tests.outputs.tests-available != 'true'
409424 run : |
@@ -453,10 +468,10 @@ jobs:
453468 echo "🎯 HYBRID APPROACH: Always latest workflows + version-specific tests"
454469 echo "📋 Workflow infrastructure: main branch (latest build-wp-env.js, scripts, etc.)"
455470 echo "🧪 Test content: ${{ inputs.hello_theme_version || 'main' }} (matches theme functionality)"
456-
471+
457472 # Determine the target version for test extraction
458473 TARGET_VERSION="${{ inputs.hello_theme_version || 'main' }}"
459-
474+
460475 if [ "$TARGET_VERSION" = "main" ]; then
461476 echo "✅ Using main branch tests (already available)"
462477 TEST_VERSION="main"
@@ -512,12 +527,12 @@ jobs:
512527 TEST_SOURCE_TYPE="not-available"
513528 fi
514529 fi
515-
530+
516531 # Set outputs for workflow control
517532 echo "test-version=$TEST_VERSION" >> $GITHUB_OUTPUT
518533 echo "test-source-type=$TEST_SOURCE_TYPE" >> $GITHUB_OUTPUT
519534 echo "tests-available=$TESTS_AVAILABLE" >> $GITHUB_OUTPUT
520-
535+
521536 echo "✅ Hybrid setup complete:"
522537 echo " 🏗️ Workflow infrastructure: main branch"
523538 echo " 🧪 Test content: $TEST_VERSION ($TEST_SOURCE_TYPE)"
@@ -527,12 +542,12 @@ jobs:
527542 uses : actions/setup-node@v4
528543 with :
529544 node-version : 20.x
530- cache : ' npm'
545+ cache : " npm"
531546
532547 - name : Setup PHP
533548 uses : shivammathur/setup-php@v2
534549 with :
535- php-version : ' 8.1'
550+ php-version : " 8.1"
536551 tools : composer
537552 coverage : none
538553
@@ -555,10 +570,10 @@ jobs:
555570 echo "Current directory contents:"
556571 ls -la ./
557572 echo ""
558-
573+
559574 # Ensure tmp directory exists
560575 mkdir -p ./tmp
561-
576+
562577 echo "Checking for Elementor artifacts:"
563578 if [ -d "./tmp/elementor" ]; then
564579 echo "✅ Elementor directory found in tmp"
@@ -596,7 +611,7 @@ jobs:
596611 echo "✅ Elementor fallback installed"
597612 fi
598613 fi
599-
614+
600615 echo ""
601616 echo "Final verification:"
602617 echo "tmp directory contents:"
@@ -612,7 +627,7 @@ jobs:
612627 run : |
613628 echo "Extracting Hello Theme build..."
614629 HT_ZIP=$(find . -name "hello-elementor-*.zip" -type f | head -1)
615-
630+
616631 if [ -n "$HT_ZIP" ]; then
617632 echo "Found Hello Theme build: $HT_ZIP"
618633 mkdir -p ./tmp
@@ -638,16 +653,33 @@ jobs:
638653
639654 - name : Update wp-env.json file
640655 env :
641- PHP_VERSION : ' 8.1'
642- WP_CORE_VERSION : ' latest'
656+ PHP_VERSION : " 8.1"
657+ WP_CORE_VERSION : " latest"
643658 HELLO_THEME_VERSION : ${{ env.HELLO_THEME_VERSION }}
644659 ELEMENTOR_VERSION : ${{ env.ELEMENTOR_VERSION }}
645660 run : node ./.github/scripts/build-wp-env.js
646661
647662 - name : Install WordPress environment
648663 run : |
649- npx wp-env start
650-
664+ echo "Starting WordPress environment with retry logic..."
665+ for i in {1..5}; do
666+ echo "Attempt $i/5: Starting wp-env..."
667+ if npx wp-env start; then
668+ echo "✅ WordPress environment started successfully"
669+ break
670+ else
671+ echo "❌ Attempt $i failed"
672+ if [ $i -eq 5 ]; then
673+ echo "🚨 All attempts failed, exiting..."
674+ exit 1
675+ else
676+ echo "⏳ Waiting 30 seconds before retry..."
677+ npx wp-env stop || true
678+ sleep 30
679+ fi
680+ fi
681+ done
682+
651683 - name : Setup WordPress environment (activate plugins and themes)
652684 run : |
653685 npx wp-env run cli bash hello-elementor-config/setup.sh
@@ -663,7 +695,7 @@ jobs:
663695 echo "🧪 Running tagged tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}"
664696 # Only run Hello Theme tests with the specified tag
665697 npm run test:playwright -- tests/playwright/tests/ --grep="${{ github.event.inputs.tag }}"
666-
698+
667699 - name : Skip tagged tests - version incompatible
668700 if : steps.extract-version-tests.outputs.tests-available != 'true'
669701 run : |
0 commit comments