1
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-07-27 14:01:37 +08:00
hello-theme/.github/workflows/playwright-with-specific-elementor-version.yml
Hein van Vlastuin 3e7b26d055
Some checks failed
Lint / PHPCS (push) Failing after 0s
Build / Build theme (push) Failing after 0s
Lint / ESLint (push) Failing after 0s
PHPUnit / File Diff (push) Failing after 4s
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.5 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.6 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - Test Results (push) Successful in 2s
Unskip welcome theme test (#666)
2026-06-11 15:05:22 +02:00

410 lines
15 KiB
YAML

name: Playwright with Specific Elementor Version
on:
workflow_dispatch:
inputs:
core_branch:
description: "Elementor Core Branch"
required: true
hello_theme_version:
description: "Hello Theme version to test (e.g., 3.4.4 or main)"
required: false
default: "main"
tag:
description: "Provide @tag or a keyword"
required: false
workflow_call:
inputs:
core_branch:
description: "Elementor Core Branch"
required: true
type: string
hello_theme_version:
description: "Hello Theme version to test (e.g., 3.4.4 or main)"
required: false
type: string
tag:
description: "Provide @tag or a keyword"
required: false
type: string
secrets:
CLOUD_DEVOPS_TOKEN:
required: true
concurrency:
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('core-{0}-{1}', github.run_id, github.event.inputs.core_branch || github.ref) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
actions: read
id-token: write
jobs:
build-core-components:
name: Build Core Components (Hello Theme + Elementor)
runs-on: ubuntu-22.04
outputs:
hello-theme-version: ${{ steps.set-versions.outputs.hello-theme-version }}
elementor-core-branch: ${{ steps.set-versions.outputs.elementor-core-branch }}
elementor-version: ${{ steps.download-elementor.outputs.effective-version }}
artifact-name: ${{ steps.set-versions.outputs.artifact-name }}
steps:
- name: Checkout Hello Theme
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
- name: Setup PHP
uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2
with:
php-version: "8.1"
tools: composer
coverage: none
- name: Set version variables
id: set-versions
run: |
ELEMENTOR_CORE_BRANCH="${{ inputs.core_branch || 'main' }}"
HELLO_THEME_SOURCE="${{ inputs.hello_theme_version || 'main' }}"
HT_VERSION=$(node -p "require('./package.json').version")
echo "ELEMENTOR_CORE_BRANCH=${ELEMENTOR_CORE_BRANCH}" >> $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-theme-input=${HELLO_THEME_SOURCE}" >> $GITHUB_OUTPUT
echo "elementor-core-branch=${ELEMENTOR_CORE_BRANCH}" >> $GITHUB_OUTPUT
ARTIFACT_NAME="core-ht${HELLO_THEME_SOURCE}-el${ELEMENTOR_CORE_BRANCH}-${{ github.run_id }}"
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
- name: Preserve workflow infrastructure
run: cp -r .github .github-main-backup
- name: Checkout specific Hello Theme version
run: |
if [[ "$HELLO_THEME_SOURCE" != "main" ]]; then
bash .github/scripts/resolve-version-ref.sh checkout "$HELLO_THEME_SOURCE" --fetch
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
fi
- name: Restore main branch workflow infrastructure
run: |
if [[ "$HELLO_THEME_SOURCE" != "main" ]]; then
rm -rf .github
mv .github-main-backup .github
else
rm -rf .github-main-backup
fi
echo "HELLO_THEME_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Build Hello Theme
uses: ./.github/workflows/build-theme
with:
PACKAGE_VERSION: ${{ env.HELLO_THEME_VERSION }}
BUILD_SCRIPT_PATH: "npm run build:prod"
- name: Download Elementor Core
id: download-elementor
env:
ELEMENTOR_CORE_BRANCH: ${{ steps.set-versions.outputs.elementor-core-branch }}
run: bash .github/scripts/download-elementor-core.sh
- name: Upload core build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-versions.outputs.artifact-name }}
path: |
./hello-elementor-*.zip
./tmp/elementor
retention-days: 3
- name: Generate build summary
run: |
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
echo "| Component | Version | Source |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|---------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Hello Theme | ${{ env.HELLO_THEME_VERSION }} (${{ env.HELLO_THEME_SOURCE }}) | GitHub |" >> $GITHUB_STEP_SUMMARY
echo "| Elementor Core | ${{ steps.download-elementor.outputs.effective-version }} | GitHub Releases |" >> $GITHUB_STEP_SUMMARY
core-playwright-tests:
name: Hello Theme + Elementor Tests
needs: [build-core-components]
if: github.event.inputs.tag == ''
env:
HELLO_THEME_VERSION: ${{ needs.build-core-components.outputs.hello-theme-version }}
ELEMENTOR_VERSION: ${{ needs.build-core-components.outputs.elementor-version }}
RUN_IDENTIFIER: core-${{ github.event.inputs.hello_theme_version || github.ref }}-${{ github.run_id }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Hello Theme
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract tests from target version
id: extract-version-tests
run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
- name: Setup PHP
uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2
with:
php-version: "8.1"
tools: composer
coverage: none
- name: Install Dependencies
run: |
export PUPPETEER_SKIP_DOWNLOAD=true
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm ci --prefer-offline --no-audit --no-fund --silent
composer install --no-dev --no-scripts --optimize-autoloader --quiet
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-core-components.outputs.artifact-name }}
path: ./
- name: Verify Elementor artifact
run: test -f ./tmp/elementor/elementor.php
- name: Extract Hello Theme build
uses: ./.github/actions/extract-hello-theme-zip
- name: Update wp-env.json file
env:
PHP_VERSION: "8.1"
WP_CORE_VERSION: "latest"
HELLO_THEME_VERSION: ${{ env.HELLO_THEME_VERSION }}
ELEMENTOR_VERSION: ${{ env.ELEMENTOR_VERSION }}
run: node ./.github/scripts/build-wp-env.js
- name: Install WordPress environment
run: |
echo "Starting WordPress environment with retry logic..."
for i in {1..5}; do
echo "Attempt $i/5: Starting wp-env..."
if npx wp-env start; then
echo "WordPress environment started successfully"
break
else
echo "Attempt $i failed"
if [ $i -eq 5 ]; then
echo "All attempts failed, exiting..."
exit 1
else
echo "Waiting 30 seconds before retry..."
npx wp-env stop || true
sleep 30
fi
fi
done
- name: Setup WordPress environment (activate plugins and themes)
run: |
npx wp-env run cli bash hello-elementor-config/setup.sh
npx wp-env run tests-cli bash hello-elementor-config/setup.sh
- name: WordPress and plugin information
run: |
npx wp-env run cli wp --info
- name: Install Playwright
run: npx playwright install chromium
- name: Run Hello Theme tests only (Core Matrix)
if: steps.extract-version-tests.outputs.tests-available == 'true'
run: |
export TEST_TITLE="Hello Theme Core Test - HT ${HELLO_THEME_VERSION} + EL ${ELEMENTOR_VERSION}"
export DAILY_MATRIX_WORKFLOW=true
echo "Running tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}"
GREP_INVERT_FLAG='--grep-invert="should navigate to correct pages from Quick Links"'
echo "Skipping known failing test: 'should navigate to correct pages from Quick Links'"
eval npm run test:playwright -- tests/playwright/tests/ $GREP_INVERT_FLAG
- name: Skip tests - version incompatible
if: steps.extract-version-tests.outputs.tests-available != 'true'
run: |
echo "Skipping tests for Hello Theme ${{ inputs.hello_theme_version || 'main' }}"
echo "Reason: ${{ steps.extract-version-tests.outputs.test-source-type }}"
echo "This is expected for older versions that predate Playwright testing"
- name: Upload core test results
uses: actions/upload-artifact@v4
if: always()
with:
name: core-test-results-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }}
path: test-results/
if-no-files-found: ignore
retention-days: 3
- name: Upload Core Playwright HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: core-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }}
path: playwright-report/
if-no-files-found: ignore
retention-days: 3
- name: Stop wp-env
if: always()
run: npx wp-env stop || true
core-playwright-tagged-tests:
name: Core Tagged Tests
needs: [build-core-components]
if: ${{ github.event.inputs.tag }}
env:
HELLO_THEME_VERSION: ${{ needs.build-core-components.outputs.hello-theme-version }}
ELEMENTOR_VERSION: ${{ needs.build-core-components.outputs.elementor-version }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Hello Theme
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract tests from target version
id: extract-version-tests
run: bash .github/scripts/resolve-version-ref.sh extract-playwright-tests "${{ inputs.hello_theme_version || 'main' }}" --fetch
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
- name: Setup PHP
uses: shivammathur/setup-php@9882bed06691b3a085010c1602ce43ef18f15c5b # v2
with:
php-version: "8.1"
tools: composer
coverage: none
- name: Install Dependencies
run: |
export PUPPETEER_SKIP_DOWNLOAD=true
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm ci --prefer-offline --no-audit --no-fund --silent
composer install --no-dev --no-scripts --optimize-autoloader --quiet
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-core-components.outputs.artifact-name }}
path: ./
- name: Verify Elementor artifact
run: test -f ./tmp/elementor/elementor.php
- name: Extract Hello Theme build
uses: ./.github/actions/extract-hello-theme-zip
- name: Update wp-env.json file
env:
PHP_VERSION: "8.1"
WP_CORE_VERSION: "latest"
HELLO_THEME_VERSION: ${{ env.HELLO_THEME_VERSION }}
ELEMENTOR_VERSION: ${{ env.ELEMENTOR_VERSION }}
run: node ./.github/scripts/build-wp-env.js
- name: Install WordPress environment
run: |
echo "Starting WordPress environment with retry logic..."
for i in {1..5}; do
echo "Attempt $i/5: Starting wp-env..."
if npx wp-env start; then
echo "WordPress environment started successfully"
break
else
echo "Attempt $i failed"
if [ $i -eq 5 ]; then
echo "All attempts failed, exiting..."
exit 1
else
echo "Waiting 30 seconds before retry..."
npx wp-env stop || true
sleep 30
fi
fi
done
- name: Setup WordPress environment (activate plugins and themes)
run: |
npx wp-env run cli bash hello-elementor-config/setup.sh
npx wp-env run tests-cli bash hello-elementor-config/setup.sh
- name: Install Playwright
run: npx playwright install chromium
- name: Run Hello Theme tagged tests only
if: steps.extract-version-tests.outputs.tests-available == 'true'
run: |
export DAILY_MATRIX_WORKFLOW=true
echo "Running tagged tests from: ${{ steps.extract-version-tests.outputs.test-source-type }}"
# Only run Hello Theme tests with the specified tag
npm run test:playwright -- tests/playwright/tests/ --grep="${{ github.event.inputs.tag }}"
- name: Skip tagged tests - version incompatible
if: steps.extract-version-tests.outputs.tests-available != 'true'
run: |
echo "Skipping tagged tests for Hello Theme ${{ inputs.hello_theme_version || 'main' }}"
echo "Reason: ${{ steps.extract-version-tests.outputs.test-source-type }}"
echo "This is expected for older versions that predate Playwright testing"
- name: Upload core tagged test results
uses: actions/upload-artifact@v4
if: always()
with:
name: core-tagged-test-results-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }}
path: test-results/
if-no-files-found: ignore
retention-days: 3
- name: Upload Core Tagged Playwright HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: core-tagged-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-el${{ env.ELEMENTOR_VERSION }}
path: playwright-report/
if-no-files-found: ignore
retention-days: 3
- name: Stop wp-env
if: always()
run: npx wp-env stop || true
core-matrix-results:
needs: [core-playwright-tests, core-playwright-tagged-tests]
if: needs.core-playwright-tests.result != 'skipped' || needs.core-playwright-tagged-tests.result != 'skipped'
runs-on: ubuntu-22.04
name: Core Matrix - Test Results
steps:
- name: Core Matrix test status
run: echo "Core Matrix test status is - ${{ needs.core-playwright-tests.result }}"
- name: Check Core Matrix status
if: ${{ needs.core-playwright-tests.result != 'success' && needs.core-playwright-tests.result != 'skipped' }}
run: exit 1