diff --git a/.github/actions/extract-hello-theme-zip/action.yml b/.github/actions/extract-hello-theme-zip/action.yml new file mode 100644 index 00000000..c7d5a1be --- /dev/null +++ b/.github/actions/extract-hello-theme-zip/action.yml @@ -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/" diff --git a/.github/scripts/workflow-trigger.js b/.github/scripts/workflow-trigger.js index 6a64db3e..0f408ec0 100644 --- a/.github/scripts/workflow-trigger.js +++ b/.github/scripts/workflow-trigger.js @@ -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 @@ -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; @@ -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 @@ -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, @@ -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 ) ); } } @@ -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 { @@ -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, @@ -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 ) ); diff --git a/.github/workflows/daily-test-matrix.yml b/.github/workflows/daily-test-matrix.yml index 8718b079..9d0d9f41 100644 --- a/.github/workflows/daily-test-matrix.yml +++ b/.github/workflows/daily-test-matrix.yml @@ -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 } @@ -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 @@ -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' }}' }; } diff --git a/.github/workflows/playwright-with-specific-elementor-version.yml b/.github/workflows/playwright-with-specific-elementor-version.yml index 61b2a90f..670f3ef4 100644 --- a/.github/workflows/playwright-with-specific-elementor-version.yml +++ b/.github/workflows/playwright-with-specific-elementor-version.yml @@ -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: @@ -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: diff --git a/.github/workflows/playwright-with-specific-hello-plus-version.yml b/.github/workflows/playwright-with-specific-hello-plus-version.yml index 88385d35..443ba889 100644 --- a/.github/workflows/playwright-with-specific-hello-plus-version.yml +++ b/.github/workflows/playwright-with-specific-hello-plus-version.yml @@ -6,13 +6,21 @@ on: hello_plus_version: description: "Hello Plus version to test (e.g., 1.7.2 or latest-stable)" required: true + type: string hello_theme_version: description: "Hello Theme version to test (e.g., 3.4.4 or main)" required: false default: "main" + type: string + elementor_core_branch: + description: "Elementor version (same as Core matrix core_branch: latest-stable, x.y.z, or main)" + required: false + default: "latest-stable" + type: string tag: description: "Provide @tag or a keyword" required: false + type: string workflow_call: inputs: hello_plus_version: @@ -23,6 +31,11 @@ on: description: "Hello Theme version to test (e.g., 3.4.4 or main)" required: false type: string + elementor_core_branch: + description: "Elementor version (same semantics as Core matrix core_branch)" + required: false + type: string + default: "latest-stable" tag: description: "Provide @tag or a keyword" required: false @@ -43,7 +56,7 @@ jobs: outputs: hello-theme-version: ${{ steps.set-versions.outputs.hello-theme-version }} hello-plus-version: ${{ steps.set-versions.outputs.hello-plus-version }} - hello-theme-source: ${{ steps.set-versions.outputs.hello-theme-source }} + elementor-version: ${{ steps.download-elementor.outputs.effective-version }} artifact-name: ${{ steps.set-versions.outputs.artifact-name }} steps: - name: Checkout Hello Theme @@ -54,123 +67,30 @@ jobs: - name: Set version variables and Hello Plus version id: set-versions run: | - # Set Hello Plus version from input (released versions only) HELLO_PLUS_VERSION="${{ inputs.hello_plus_version }}" - - # Hello Theme source ref (main or specific GA version) - always use main actions - # Always use main actions regardless of source version - this is the key principle - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - HELLO_THEME_SOURCE="${{ inputs.hello_theme_version || 'main' }}" - else - HELLO_THEME_SOURCE="main" - fi - - # Current Hello Theme version from package.json (actual version string) + HELLO_THEME_INPUT="${{ inputs.hello_theme_version || 'main' }}" + ELEMENTOR_CORE_BRANCH="${{ inputs.elementor_core_branch || 'latest-stable' }}" HT_VERSION=$(node -p "require('./package.json').version") echo "HELLO_PLUS_VERSION=${HELLO_PLUS_VERSION}" >> $GITHUB_ENV - echo "HELLO_THEME_SOURCE=${HELLO_THEME_SOURCE}" >> $GITHUB_ENV echo "HELLO_THEME_VERSION=${HT_VERSION}" >> $GITHUB_ENV echo "hello-theme-version=${HT_VERSION}" >> $GITHUB_OUTPUT echo "hello-plus-version=${HELLO_PLUS_VERSION}" >> $GITHUB_OUTPUT + echo "hello-theme-input=${HELLO_THEME_INPUT}" >> $GITHUB_OUTPUT + echo "elementor-core-branch=${ELEMENTOR_CORE_BRANCH}" >> $GITHUB_OUTPUT - # Create artifact name - ARTIFACT_NAME="plus-ht${HELLO_THEME_SOURCE}-hp${HELLO_PLUS_VERSION}-$(date +%Y%m%d-%H%M)" + ARTIFACT_NAME="plus-ht${HELLO_THEME_INPUT}-hp${HELLO_PLUS_VERSION}-el${ELEMENTOR_CORE_BRANCH}-${{ github.run_id }}" echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT - echo "Hello Theme version: ${HT_VERSION}" - echo "Hello Theme source: ${HELLO_THEME_SOURCE}" - echo "Hello Plus Version: ${HELLO_PLUS_VERSION}" - - - name: Validate and preserve workflow infrastructure - run: | - set -e # Exit on any error - - echo "DEBUG: Validating version $HELLO_THEME_SOURCE" - - # Validate version exists (if not main) - if [[ "$HELLO_THEME_SOURCE" != "main" ]]; then - git fetch --all --tags - if ! git rev-parse --verify "v$HELLO_THEME_SOURCE" >/dev/null 2>&1 && ! git rev-parse --verify "$HELLO_THEME_SOURCE" >/dev/null 2>&1; then - echo "ERROR: Version $HELLO_THEME_SOURCE not found" - exit 1 - fi - echo "Version $HELLO_THEME_SOURCE exists" - fi - - # Preserve entire .github directory - echo "DEBUG: Preserving .github directory from main branch" - if ! cp -r .github .github-main-backup; then - echo "ERROR: Failed to preserve .github directory" - exit 1 - fi - echo ".github directory preserved" - - - name: Checkout specific Hello Theme version - run: | - set -e # Exit on any error - - if [[ "$HELLO_THEME_SOURCE" != "main" ]]; then - echo "DEBUG: Checking out Hello Theme version: $HELLO_THEME_SOURCE" - - # Attempt checkout with proper error handling - if git checkout "v$HELLO_THEME_SOURCE" 2>/dev/null || git checkout "$HELLO_THEME_SOURCE" 2>/dev/null; then - echo "Successfully checked out $HELLO_THEME_SOURCE" - else - echo "ERROR: Failed to checkout $HELLO_THEME_SOURCE" - exit 1 - fi - - # Validate package.json version matches - ACTUAL_VERSION=$(node -p "require('./package.json').version") - if [[ "$ACTUAL_VERSION" != "$HELLO_THEME_SOURCE" ]]; then - echo "ERROR: Version mismatch - Expected: $HELLO_THEME_SOURCE, Got: $ACTUAL_VERSION" - exit 1 - fi - echo "Version validated: $ACTUAL_VERSION" - - echo "HELLO_THEME_SOURCE_TYPE=git-tag" >> $GITHUB_ENV - else - echo "DEBUG: Using main branch" - echo "HELLO_THEME_SOURCE_TYPE=git-branch" >> $GITHUB_ENV - fi - - - name: Restore main branch workflow infrastructure - run: | - set -e # Exit on any error - - if [[ "$HELLO_THEME_SOURCE" != "main" ]]; then - echo "DEBUG: Restoring .github directory from main branch" - - # Remove old .github and restore main version - if ! rm -rf .github; then - echo "ERROR: Failed to remove old .github directory" - exit 1 - fi - - if ! mv .github-main-backup .github; then - echo "ERROR: Failed to restore .github directory" - exit 1 - fi - - echo "Main branch actions restored" - echo "DEBUG: Using $HELLO_THEME_SOURCE source code with main branch actions" - else - # Clean up backup if we didn't need it - rm -rf .github-main-backup 2>/dev/null || true - echo "DEBUG: Using main branch (no restore needed)" - fi - - # Set final version for build - FINAL_VERSION=$(node -p "require('./package.json').version") - echo "HELLO_THEME_VERSION=$FINAL_VERSION" >> $GITHUB_ENV - echo "DEBUG: Final state - Version: $FINAL_VERSION, Actions: main branch" + echo "Hello Theme version: ${HT_VERSION} (tests ref: ${HELLO_THEME_INPUT})" + echo "Hello Plus version: ${HELLO_PLUS_VERSION}" + echo "Elementor core branch: ${ELEMENTOR_CORE_BRANCH}" - name: Build Hello Theme uses: ./.github/workflows/build-theme with: - PACKAGE_VERSION: ${{ env.HELLO_THEME_VERSION }} + PACKAGE_VERSION: ${{ steps.set-versions.outputs.hello-theme-version }} BUILD_SCRIPT_PATH: "npm run build:prod" - name: Download Hello Plus @@ -178,17 +98,14 @@ jobs: HELLO_PLUS_VERSION="${{ steps.set-versions.outputs.hello-plus-version }}" echo "Downloading Hello Plus version: ${HELLO_PLUS_VERSION}" - # Create Hello Plus build directory mkdir -p ./tmp if [[ "$HELLO_PLUS_VERSION" == "latest-stable" ]]; then - # Download latest stable from WordPress.org curl --location -o ./hello-plus.zip https://downloads.wordpress.org/plugin/hello-plus.latest-stable.zip unzip -q ./hello-plus.zip mv ./hello-plus ./tmp/hello-plus echo "Hello Plus latest-stable downloaded and extracted" elif [[ "$HELLO_PLUS_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - # Download specific version from WordPress.org curl --location -o ./hello-plus.zip "https://downloads.wordpress.org/plugin/hello-plus.${HELLO_PLUS_VERSION}.zip" unzip -q ./hello-plus.zip mv ./hello-plus ./tmp/hello-plus @@ -199,6 +116,34 @@ jobs: exit 1 fi + - name: Download Elementor Core + id: download-elementor + run: | + ELEMENTOR_CORE_BRANCH="${{ steps.set-versions.outputs.elementor-core-branch }}" + echo "Downloading Elementor Core: ${ELEMENTOR_CORE_BRANCH}" + + mkdir -p ./tmp + + if [[ "$ELEMENTOR_CORE_BRANCH" == "latest-stable" ]]; then + curl --location -o ./elementor-core.zip https://downloads.wordpress.org/plugin/elementor.latest-stable.zip + unzip -q ./elementor-core.zip + mv ./elementor ./tmp/elementor + echo "Elementor latest-stable downloaded and extracted" + echo "effective-version=latest-stable" >> $GITHUB_OUTPUT + elif [[ "$ELEMENTOR_CORE_BRANCH" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + curl --location -o ./elementor-core.zip "https://downloads.wordpress.org/plugin/elementor.${ELEMENTOR_CORE_BRANCH}.zip" + unzip -q ./elementor-core.zip + mv ./elementor ./tmp/elementor + echo "Elementor ${ELEMENTOR_CORE_BRANCH} downloaded and extracted" + echo "effective-version=${ELEMENTOR_CORE_BRANCH}" >> $GITHUB_OUTPUT + else + echo "GitHub artifacts for Elementor branches not implemented; using latest-stable" + curl --location -o ./elementor-core.zip https://downloads.wordpress.org/plugin/elementor.latest-stable.zip + unzip -q ./elementor-core.zip + mv ./elementor ./tmp/elementor + echo "effective-version=latest-stable" >> $GITHUB_OUTPUT + fi + - name: Upload plus build artifacts uses: actions/upload-artifact@v4 with: @@ -206,25 +151,20 @@ jobs: path: | ./hello-elementor-*.zip ./tmp/hello-plus + ./tmp/elementor retention-days: 3 - - name: Cleanup backup files - if: always() - run: | - echo "DEBUG: Cleaning up backup files" - rm -rf .github-main-backup 2>/dev/null || true - echo "Cleanup complete" - - name: Generate build summary run: | echo "## Build Summary" >> $GITHUB_STEP_SUMMARY echo "|-----------------|----------------------------|-----------------------|" >> $GITHUB_STEP_SUMMARY echo "| Component | Version | Source |" >> $GITHUB_STEP_SUMMARY echo "|-----------------|----------------------------|-----------------------|" >> $GITHUB_STEP_SUMMARY - echo "| Hello Theme | ${{ env.HELLO_THEME_VERSION }} (${{ env.HELLO_THEME_INPUT }}) | ${{ env.HELLO_THEME_SOURCE_TYPE }} |" >> $GITHUB_STEP_SUMMARY + echo "| Hello Theme | ${{ steps.set-versions.outputs.hello-theme-version }} (${{ steps.set-versions.outputs.hello-theme-input }}) | github (checkout ref) |" >> $GITHUB_STEP_SUMMARY echo "| Hello Plus | ${{ steps.set-versions.outputs.hello-plus-version }} | WordPress.org |" >> $GITHUB_STEP_SUMMARY + echo "| Elementor Core | ${{ steps.download-elementor.outputs.effective-version }} | WordPress.org |" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - echo "**Strategy:** GitHub source for Hello Theme (always built), WordPress.org for Hello Plus" >> $GITHUB_STEP_SUMMARY + echo "**Strategy:** Same Hello Theme build ref as Core matrix; WordPress.org for Hello Plus and Elementor" >> $GITHUB_STEP_SUMMARY plus-playwright-tests: name: Hello Theme + Hello Plus Tests @@ -233,6 +173,7 @@ jobs: env: HELLO_THEME_VERSION: ${{ needs.build-plus-components.outputs.hello-theme-version }} HELLO_PLUS_VERSION: ${{ needs.build-plus-components.outputs.hello-plus-version }} + ELEMENTOR_VERSION: ${{ needs.build-plus-components.outputs.elementor-version }} RUN_IDENTIFIER: plus-${{ github.event.inputs.hello_theme_version || github.ref }}-${{ github.run_id }} runs-on: ubuntu-22.04 steps: @@ -344,32 +285,7 @@ jobs: path: ./ - 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: @@ -377,7 +293,7 @@ jobs: WP_CORE_VERSION: "latest" HELLO_THEME_VERSION: ${{ env.HELLO_THEME_VERSION }} HELLO_PLUS_VERSION: ${{ env.HELLO_PLUS_VERSION }} - ELEMENTOR_VERSION: "latest-stable" + ELEMENTOR_VERSION: ${{ env.ELEMENTOR_VERSION }} run: node ./.github/scripts/build-wp-env.js - name: Install WordPress environment @@ -464,6 +380,7 @@ jobs: env: HELLO_THEME_VERSION: ${{ needs.build-plus-components.outputs.hello-theme-version }} HELLO_PLUS_VERSION: ${{ needs.build-plus-components.outputs.hello-plus-version }} + ELEMENTOR_VERSION: ${{ needs.build-plus-components.outputs.elementor-version }} runs-on: ubuntu-22.04 steps: - name: Checkout Hello Theme @@ -574,32 +491,7 @@ jobs: path: ./ - 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: @@ -607,7 +499,7 @@ jobs: WP_CORE_VERSION: "latest" HELLO_THEME_VERSION: ${{ env.HELLO_THEME_VERSION }} HELLO_PLUS_VERSION: ${{ env.HELLO_PLUS_VERSION }} - ELEMENTOR_VERSION: "latest-stable" + ELEMENTOR_VERSION: ${{ env.ELEMENTOR_VERSION }} run: node ./.github/scripts/build-wp-env.js - name: Install WordPress environment @@ -687,10 +579,3 @@ jobs: - name: Check Plus Matrix status if: ${{ needs.plus-playwright-tests.result != 'success' && needs.plus-playwright-tests.result != 'skipped' }} run: exit 1 - - - name: Cleanup backup files (final) - if: always() - run: | - echo "DEBUG: Final cleanup of any remaining backup files" - rm -rf .github-main-backup 2>/dev/null || true - echo "Final cleanup complete"