Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/actions/extract-hello-theme-zip/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Extract Hello theme zip for wp-env
description: Populates ./tmp/hello-elementor from the theme zip without moving sibling ./tmp trees
runs:
using: composite
steps:
- name: Extract
shell: bash
run: |
set -euo pipefail
HT_ZIP=$(find . -maxdepth 5 -name 'hello-elementor-*.zip' -type f ! -path './.git/*' | head -1)
if [[ -z "${HT_ZIP}" ]]; then
echo "No Hello Theme build ZIP found"
ls -la ./
exit 1
fi
echo "Found Hello Theme build: ${HT_ZIP}"
mkdir -p ./tmp/hello-elementor ./tmp/ht-zip-staging
unzip -q "${HT_ZIP}" -d ./tmp/ht-zip-staging
shopt -s dotglob nullglob
if [[ -d ./tmp/ht-zip-staging/hello-elementor ]]; then
mv ./tmp/ht-zip-staging/hello-elementor/* ./tmp/hello-elementor/
else
mv ./tmp/ht-zip-staging/* ./tmp/hello-elementor/
fi
shopt -u dotglob nullglob
rm -rf ./tmp/ht-zip-staging
if [[ ! -f ./tmp/hello-elementor/style.css ]]; then
echo "Extracted theme missing style.css"
ls -la ./tmp/hello-elementor/
exit 1
fi
echo "Hello Theme ready at ./tmp/hello-elementor/"
91 changes: 66 additions & 25 deletions .github/scripts/workflow-trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,63 @@
* Adapted for Hello Theme compatibility testing
*/

function shouldOmitElementorCoreBranchInputOnRetry( error, inputs, workflowId ) {
const message = String( error.message || '' );
return (
/unexpected inputs provided/i.test( message ) &&
inputs &&
Object.prototype.hasOwnProperty.call( inputs, 'elementor_core_branch' ) &&
String( workflowId ).includes( 'hello-plus' )
);
}

function failWorkflowDispatch( workflowId, error ) {
// eslint-disable-next-line no-console
console.error( 'Failed to trigger workflow:', error.message );
throw new Error( `Failed to trigger workflow ${ workflowId }: ${ error.message }` );
}

async function dispatchWorkflowWithElementorCoreBranchRetry( github, context, workflowId, ref, inputs ) {
try {
await github.rest.actions.createWorkflowDispatch( {
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowId,
ref,
inputs,
} );
// eslint-disable-next-line no-console
console.log( 'Workflow dispatch sent successfully' );
return;
} catch ( error ) {
if ( ! shouldOmitElementorCoreBranchInputOnRetry( error, inputs, workflowId ) ) {
failWorkflowDispatch( workflowId, error );
}
}

const fallbackInputs = { ...inputs };
delete fallbackInputs.elementor_core_branch;

// eslint-disable-next-line no-console
console.log(
'Retrying workflow dispatch without elementor_core_branch (target workflow on ref does not declare this input yet).',
);

try {
await github.rest.actions.createWorkflowDispatch( {
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowId,
ref,
inputs: fallbackInputs,
} );
// eslint-disable-next-line no-console
console.log( 'Workflow dispatch sent successfully' );
} catch ( error ) {
failWorkflowDispatch( workflowId, error );
}
}

/**
* Triggers a workflow and waits for it to appear in the runs list
* @param {Object} github - GitHub API client
Expand Down Expand Up @@ -43,26 +100,10 @@ async function triggerWorkflowAndWait( github, context, core, config ) {
// eslint-disable-next-line no-console
console.log( `Inputs:`, JSON.stringify( inputs, null, 2 ) );

// Trigger the workflow
try {
await github.rest.actions.createWorkflowDispatch( {
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowId,
ref,
inputs,
} );

// eslint-disable-next-line no-console
console.log( '✅ Workflow dispatch sent successfully' );
} catch ( error ) {
// eslint-disable-next-line no-console
console.error( '❌ Failed to trigger workflow:', error.message );
throw new Error( `Failed to trigger workflow ${ workflowId }: ${ error.message }` );
}
await dispatchWorkflowWithElementorCoreBranchRetry( github, context, workflowId, ref, inputs );

// eslint-disable-next-line no-console
console.log( 'Waiting for workflow run to appear...' );
console.log( 'Waiting for workflow run to appear...' );

// Wait and find the specific run with better detection
let newRun = null;
Expand Down Expand Up @@ -93,7 +134,7 @@ async function triggerWorkflowAndWait( github, context, core, config ) {
if ( candidateRuns.length > 0 ) {
newRun = candidateRuns[ 0 ];
// eslint-disable-next-line no-console
console.log( `Found ${ candidateRuns.length } candidate runs, selected newest: ${ newRun.id }` );
console.log( `Found ${ candidateRuns.length } candidate runs, selected newest: ${ newRun.id }` );
// eslint-disable-next-line no-console
console.log( ` Created: ${ newRun.created_at }` );
// eslint-disable-next-line no-console
Expand All @@ -115,9 +156,9 @@ async function triggerWorkflowAndWait( github, context, core, config ) {
const runUrl = `https://github.com/${ context.repo.owner }/${ context.repo.repo }/actions/runs/${ newRun.id }`;

// eslint-disable-next-line no-console
console.log( `Successfully captured run ID for ${ combination }: ${ newRun.id }` );
console.log( `Successfully captured run ID for ${ combination }: ${ newRun.id }` );
// eslint-disable-next-line no-console
console.log( `📋 Run URL: ${ runUrl }` );
console.log( `Run URL: ${ runUrl }` );

return {
runId: newRun.id,
Expand All @@ -140,7 +181,7 @@ async function applyTriggerDelay( combination, timing ) {
const delaySeconds = timing.triggerDelays[ combination ];
if ( delaySeconds > 0 ) {
// eslint-disable-next-line no-console
console.log( `⏱️ Applying ${ delaySeconds }s delay to prevent race condition...` );
console.log( `Applying ${ delaySeconds }s delay to prevent race condition...` );
await new Promise( ( resolve ) => setTimeout( resolve, delaySeconds * 1000 ) );
}
}
Expand All @@ -161,7 +202,7 @@ async function waitForWorkflowCompletion( github, context, runId, options = {} )
} = options;

// eslint-disable-next-line no-console
console.log( `Waiting for workflow run ${ runId } to complete...` );
console.log( `Waiting for workflow run ${ runId } to complete...` );

for ( let attempt = 1; attempt <= maxAttempts; attempt++ ) {
try {
Expand All @@ -175,7 +216,7 @@ async function waitForWorkflowCompletion( github, context, runId, options = {} )

if ( 'completed' === run.status ) {
// eslint-disable-next-line no-console
console.log( `Run ${ runId } completed with conclusion: ${ run.conclusion }` );
console.log( `Run ${ runId } completed with conclusion: ${ run.conclusion }` );
return {
runId,
status: run.status,
Expand All @@ -189,7 +230,7 @@ async function waitForWorkflowCompletion( github, context, runId, options = {} )

if ( logProgress && ( 0 === attempt % 10 || attempt <= 5 ) ) {
// eslint-disable-next-line no-console
console.log( `Run ${ runId } is ${ run.status } (attempt ${ attempt }/${ maxAttempts })` );
console.log( `Run ${ runId } is ${ run.status } (attempt ${ attempt }/${ maxAttempts })` );
}

await new Promise( ( resolve ) => setTimeout( resolve, pollInterval ) );
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/daily-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,8 @@ jobs:
fi

if [[ -n "$hp_ver" ]]; then
# Hello Plus matrix
TARGETED_TESTS="${TARGETED_TESTS}{\"combination\":\"${combination}\",\"name\":\"${name}\",\"hello_theme_version\":\"${ht_ver}\",\"hello_plus_version\":\"${hp_ver}\",\"delay\":${delay}}"
TARGETED_TESTS="${TARGETED_TESTS}{\"combination\":\"${combination}\",\"name\":\"${name}\",\"hello_theme_version\":\"${ht_ver}\",\"hello_plus_version\":\"${hp_ver}\",\"elementor_version\":\"${el_ver}\",\"delay\":${delay}}"
else
# Elementor matrix
TARGETED_TESTS="${TARGETED_TESTS}{\"combination\":\"${combination}\",\"name\":\"${name}\",\"hello_theme_version\":\"${ht_ver}\",\"elementor_version\":\"${el_ver}\",\"delay\":${delay}}"
fi
}
Expand Down Expand Up @@ -407,26 +405,26 @@ jobs:

# Plus Matrix: Hello Theme × Hello Plus
# Main Hello Theme combinations
add_test_combination "ht-main-hp-latest" "Hello Theme main + Hello Plus ${HP_VERSION}" "main" "" "$HP_VERSION" $((DELAY_COUNTER * 15))
add_test_combination "ht-main-hp-latest" "Hello Theme main + Hello Plus ${HP_VERSION}" "main" "$EL_VERSION" "$HP_VERSION" $((DELAY_COUNTER * 15))
DELAY_COUNTER=$((DELAY_COUNTER + 1))

if [[ -n "$HELLO_PLUS_PREVIOUS" ]]; then
IFS=',' read -ra HP_PREV_ARRAY <<< "$HELLO_PLUS_PREVIOUS"
for hp_prev in "${HP_PREV_ARRAY[@]}"; do
add_test_combination "ht-main-hp-prev" "Hello Theme main + Hello Plus ${hp_prev}" "main" "" "$hp_prev" $((DELAY_COUNTER * 15))
add_test_combination "ht-main-hp-prev" "Hello Theme main + Hello Plus ${hp_prev}" "main" "$EL_VERSION" "$hp_prev" $((DELAY_COUNTER * 15))
DELAY_COUNTER=$((DELAY_COUNTER + 1))
done
fi

# GA Hello Theme combinations (if detected)
if [[ "$HT_VERSION_FOR_MATRIX" != "main" ]]; then
add_test_combination "ht-ga-hp-latest" "Hello Theme ${HT_VERSION_FOR_MATRIX} (GA) + Hello Plus ${HP_VERSION}" "$HT_VERSION_FOR_MATRIX" "" "$HP_VERSION" $((DELAY_COUNTER * 15))
add_test_combination "ht-ga-hp-latest" "Hello Theme ${HT_VERSION_FOR_MATRIX} (GA) + Hello Plus ${HP_VERSION}" "$HT_VERSION_FOR_MATRIX" "$EL_VERSION" "$HP_VERSION" $((DELAY_COUNTER * 15))
DELAY_COUNTER=$((DELAY_COUNTER + 1))

if [[ -n "$HELLO_PLUS_PREVIOUS" ]]; then
IFS=',' read -ra HP_PREV_ARRAY <<< "$HELLO_PLUS_PREVIOUS"
for hp_prev in "${HP_PREV_ARRAY[@]}"; do
add_test_combination "ht-ga-hp-prev" "Hello Theme ${HT_VERSION_FOR_MATRIX} (GA) + Hello Plus ${hp_prev}" "$HT_VERSION_FOR_MATRIX" "" "$hp_prev" $((DELAY_COUNTER * 15))
add_test_combination "ht-ga-hp-prev" "Hello Theme ${HT_VERSION_FOR_MATRIX} (GA) + Hello Plus ${hp_prev}" "$HT_VERSION_FOR_MATRIX" "$EL_VERSION" "$hp_prev" $((DELAY_COUNTER * 15))
DELAY_COUNTER=$((DELAY_COUNTER + 1))
done
fi
Expand Down Expand Up @@ -498,10 +496,10 @@ jobs:
hello_theme_version: '${{ matrix.hello_theme_version || 'main' }}'
};
} else {
// Plus workflow: needs hello_plus_version and hello_theme_version
inputs = {
hello_plus_version: '${{ matrix.hello_plus_version || 'latest-stable' }}',
hello_theme_version: '${{ matrix.hello_theme_version || 'main' }}'
hello_theme_version: '${{ matrix.hello_theme_version || 'main' }}',
elementor_core_branch: '${{ matrix.elementor_version || 'main' }}'
};
}

Expand Down
54 changes: 2 additions & 52 deletions .github/workflows/playwright-with-specific-elementor-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,32 +345,7 @@ jobs:
fi

- name: Extract Hello Theme build
run: |
echo "Extracting Hello Theme build..."
HT_ZIP=$(find . -name "hello-elementor-*.zip" -type f | head -1)

if [ -n "$HT_ZIP" ]; then
echo "Found Hello Theme build: $HT_ZIP"
mkdir -p ./tmp
unzip -q "$HT_ZIP" -d ./tmp/

if [ -d "./tmp/hello-elementor" ]; then
echo "Hello Theme extracted to ./tmp/hello-elementor/"
elif [ -d "./tmp" ] && [ "$(ls -A ./tmp/)" ]; then
mkdir -p ./tmp/hello-elementor-temp
mv ./tmp/* ./tmp/hello-elementor-temp/ 2>/dev/null || true
mv ./tmp/hello-elementor-temp ./tmp/hello-elementor
echo "Hello Theme organized at ./tmp/hello-elementor/"
else
echo "Theme content not found in expected location"
exit 1
fi
else
echo "No Hello Theme build ZIP found"
echo "Available files:"
ls -la ./
exit 1
fi
uses: ./.github/actions/extract-hello-theme-zip

- name: Update wp-env.json file
env:
Expand Down Expand Up @@ -627,32 +602,7 @@ jobs:
fi

- name: Extract Hello Theme build
run: |
echo "Extracting Hello Theme build..."
HT_ZIP=$(find . -name "hello-elementor-*.zip" -type f | head -1)

if [ -n "$HT_ZIP" ]; then
echo "Found Hello Theme build: $HT_ZIP"
mkdir -p ./tmp
unzip -q "$HT_ZIP" -d ./tmp/

if [ -d "./tmp/hello-elementor" ]; then
echo "Hello Theme extracted to ./tmp/hello-elementor/"
elif [ -d "./tmp" ] && [ "$(ls -A ./tmp/)" ]; then
mkdir -p ./tmp/hello-elementor-temp
mv ./tmp/* ./tmp/hello-elementor-temp/ 2>/dev/null || true
mv ./tmp/hello-elementor-temp ./tmp/hello-elementor
echo "Hello Theme organized at ./tmp/hello-elementor/"
else
echo "Theme content not found in expected location"
exit 1
fi
else
echo "No Hello Theme build ZIP found"
echo "Available files:"
ls -la ./
exit 1
fi
uses: ./.github/actions/extract-hello-theme-zip

- name: Update wp-env.json file
env:
Expand Down
Loading
Loading