mirror of
https://github.com/elementor/hello-theme.git
synced 2026-07-27 14:01:37 +08:00
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
425 lines
16 KiB
YAML
425 lines
16 KiB
YAML
name: Playwright with Specific Hello Plus Version
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
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
|
|
tag:
|
|
description: "Provide @tag or a keyword"
|
|
required: false
|
|
type: string
|
|
workflow_call:
|
|
inputs:
|
|
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
|
|
type: string
|
|
tag:
|
|
description: "Provide @tag or a keyword"
|
|
required: false
|
|
type: string
|
|
|
|
concurrency:
|
|
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('plus-{0}-{1}', github.run_id, github.event.inputs.hello_plus_version || github.ref) }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
|
|
jobs:
|
|
build-plus-components:
|
|
name: Build Plus Components (Hello Theme + Hello Plus)
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
hello-theme-version: ${{ steps.set-versions.outputs.hello-theme-version }}
|
|
hello-plus-version: ${{ steps.set-versions.outputs.hello-plus-version }}
|
|
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: |
|
|
HELLO_PLUS_VERSION="${{ inputs.hello_plus_version }}"
|
|
HELLO_THEME_SOURCE="${{ inputs.hello_theme_version || 'main' }}"
|
|
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_SOURCE}" >> $GITHUB_OUTPUT
|
|
|
|
ARTIFACT_NAME="plus-ht${HELLO_THEME_SOURCE}-hp${HELLO_PLUS_VERSION}-${{ 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 Hello Plus
|
|
run: |
|
|
HELLO_PLUS_VERSION="${{ steps.set-versions.outputs.hello-plus-version }}"
|
|
mkdir -p ./tmp
|
|
|
|
if [[ "$HELLO_PLUS_VERSION" == "latest-stable" ]]; then
|
|
curl --location -o ./hello-plus.zip https://downloads.wordpress.org/plugin/hello-plus.latest-stable.zip
|
|
elif [[ "$HELLO_PLUS_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
curl --location -o ./hello-plus.zip "https://downloads.wordpress.org/plugin/hello-plus.${HELLO_PLUS_VERSION}.zip"
|
|
else
|
|
echo "Unsupported Hello Plus version format: ${HELLO_PLUS_VERSION}"
|
|
exit 1
|
|
fi
|
|
|
|
unzip -q ./hello-plus.zip
|
|
mv ./hello-plus ./tmp/hello-plus
|
|
|
|
- name: Download Elementor Core
|
|
id: download-elementor
|
|
env:
|
|
ELEMENTOR_CORE_BRANCH: main
|
|
run: bash .github/scripts/download-elementor-core.sh
|
|
|
|
- name: Upload plus build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.set-versions.outputs.artifact-name }}
|
|
path: |
|
|
./hello-elementor-*.zip
|
|
./tmp/hello-plus
|
|
./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 "| Hello Plus | ${{ steps.set-versions.outputs.hello-plus-version }} | WordPress.org |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Elementor Core | ${{ steps.download-elementor.outputs.effective-version }} | GitHub Releases |" >> $GITHUB_STEP_SUMMARY
|
|
|
|
plus-playwright-tests:
|
|
name: Hello Theme + Hello Plus Tests
|
|
needs: [build-plus-components]
|
|
if: github.event.inputs.tag == ''
|
|
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:
|
|
- 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-plus-components.outputs.artifact-name }}
|
|
path: ./
|
|
|
|
- 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 }}
|
|
HELLO_PLUS_VERSION: ${{ env.HELLO_PLUS_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 (Plus Matrix)
|
|
if: steps.extract-version-tests.outputs.tests-available == 'true'
|
|
run: |
|
|
export TEST_TITLE="Hello Theme Plus Test - HT ${HELLO_THEME_VERSION} + HP ${HELLO_PLUS_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 plus test results
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: plus-test-results-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }}
|
|
path: test-results/
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
- name: Upload Plus Playwright HTML report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: plus-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }}
|
|
path: playwright-report/
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
- name: Stop wp-env
|
|
if: always()
|
|
run: npx wp-env stop || true
|
|
|
|
plus-playwright-tagged-tests:
|
|
name: Plus Tagged Tests
|
|
needs: [build-plus-components]
|
|
if: ${{ github.event.inputs.tag }}
|
|
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
|
|
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-plus-components.outputs.artifact-name }}
|
|
path: ./
|
|
|
|
- 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 }}
|
|
HELLO_PLUS_VERSION: ${{ env.HELLO_PLUS_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: |
|
|
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 plus tagged test results
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: plus-tagged-test-results-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }}
|
|
path: test-results/
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
- name: Upload Plus Tagged Playwright HTML report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: plus-tagged-playwright-report-ht${{ env.HELLO_THEME_VERSION }}-hp${{ env.HELLO_PLUS_VERSION }}
|
|
path: playwright-report/
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
- name: Stop wp-env
|
|
if: always()
|
|
run: npx wp-env stop || true
|
|
|
|
plus-matrix-results:
|
|
needs: [plus-playwright-tests, plus-playwright-tagged-tests]
|
|
if: needs.plus-playwright-tests.result != 'skipped' || needs.plus-playwright-tagged-tests.result != 'skipped'
|
|
runs-on: ubuntu-22.04
|
|
name: Plus Matrix - Test Results
|
|
steps:
|
|
- name: Plus Matrix test status
|
|
run: echo "Plus Matrix test status is - ${{ needs.plus-playwright-tests.result }}"
|
|
|
|
- name: Check Plus Matrix status
|
|
if: ${{ needs.plus-playwright-tests.result != 'success' && needs.plus-playwright-tests.result != 'skipped' }}
|
|
run: exit 1
|