Create latest release channel - 6 #606
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright | |
on: | |
pull_request: | |
merge_group: | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build-plugin: | |
name: Build plugin | |
runs-on: ubuntu-latest | |
if: startsWith( github.repository, 'elementor/' ) | |
outputs: | |
changelog_diff: ${{ steps.changelog_diff_files.outputs.diff }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Check if this is only a changelog PR | |
id: changelog_diff_files | |
uses: technote-space/get-diff-action@v6 | |
with: | |
# PATTERNS are: | |
# Everything: **/* | |
# Everything in directories starting with a period: .*/**/* | |
# Not readme.txt: !readme.txt | |
PATTERNS: | | |
**/* | |
.*/**/* | |
!readme.txt | |
- name: Install Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Restore NPM Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ~/.npm | |
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
run: npm ci | |
- name: Build | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
run: npx grunt build | |
- name: Cache node modules | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
uses: actions/cache/save@v3 | |
with: | |
path: ~/.npm | |
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Save build to cache | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
uses: actions/cache/save@v3 | |
with: | |
path: ./build/* | |
key: playwright-build-${{ github.sha }} | |
Playwright: | |
name: Playwright test - ${{ matrix.testSuite }} on PHP 7.4 | |
runs-on: ubuntu-latest | |
needs: [build-plugin] | |
if: ${{ github.event.pull_request.title == null || needs.build-plugin.outputs.changelog_diff }} | |
strategy: | |
matrix: | |
testSuite: ['ai','onBoarding','video','elements-regression', 'default', 'nested-tabs', 'reverse-columns', 'container', 'nested-accordion', 'styleguide_image_link'] | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Install Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Restore NPM from cache | |
uses: actions/cache/restore@v3 | |
id: restore-npm | |
with: | |
path: ~/.npm | |
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Restore build from cache | |
uses: actions/cache/restore@v3 | |
id: restore-build | |
with: | |
path: ./build/* | |
key: playwright-build-${{ github.sha }} | |
- name: Update wp-env.json file | |
env: | |
PHP_VERSION: 7.4 | |
WP_CORE_VERSION: 'latest' | |
run: node ./.github/scripts/build-wp-env.js | |
- name: Install dependencies | |
run: npm ci | |
- name: Install WordPress environment | |
run: | | |
npm run start-local-server | |
npm run test:setup:playwright | |
- name: WordPress debug information | |
run: | | |
npx wp-env run cli "wp core version" | |
npx wp-env run cli "wp --info" | |
- name: Activate performance experiments | |
run: | | |
npx wp-env run cli "wp elementor experiments activate e_font_icon_svg,e_lazyload,e_dom_optimization,e_optimized_assets_loading,e_optimized_css_loading,additional_custom_breakpoints" | |
- name: Install playwright/test | |
run: | | |
npx playwright install chromium | |
- name: Run Playwright tests | |
run: | | |
npm run test:playwright:${{ matrix.testSuite }} | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-test-results-${{ matrix.testSuite }} | |
path: test-results/ | |
retention-days: 3 | |
test-result: | |
needs: Playwright | |
if: ${{ always() }} # Will be run even if 'Playwright' matrix will be skipped | |
runs-on: ubuntu-22.04 | |
name: Playwright - Test Results | |
steps: | |
- name: Test status | |
run: echo "Test status is - ${{ needs.Playwright.result }}" | |
- name: Check Playwright matrix status | |
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }} | |
run: exit 1 |