Skip to content

Commit

Permalink
Merge pull request #262 from davseve/wp-now-p-o-c
Browse files Browse the repository at this point in the history
internal: wp-now POC
  • Loading branch information
davseve authored Jul 7, 2024
2 parents bbe30a0 + 63efc65 commit a87a830
Show file tree
Hide file tree
Showing 6 changed files with 1,313 additions and 172 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/pwwpnow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Playwright wp-now

on:
workflow_dispatch:
inputs:
core_branch:
description: 'Elementor Core Branch'
required: true

# 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
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: |
**/*
.*/**/*
!readme.txt
!changelog.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
run: npm i
- name: Build
run: npx grunt build
- name: Cache node modules
uses: actions/cache/save@v3
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Save build to cache
uses: actions/cache/save@v3
with:
path: ./build/*
key: playwright-build-${{ github.sha }}

Playwright:
name: Playwright test - ${{ matrix.testSuite }} on PHP 8.0
runs-on: ubuntu-latest
needs: [build-plugin]
strategy:
matrix:
testSuite: [
'video',
]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.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: Install dependencies
run: npm i
- name: Install WordPress environment
run: |
npx wp-now start --php=8.0 --port=8888 --blueprint=./blueprint.json &
- name: Run wp-now CLI commands
run: |
wp-now cli "wp elementor experiments activate e_optimized_css_loading"
- name: Install playwright/test
run: |
npm run test:setup:playwright
npx playwright install chromium
- name: Run Playwright tests
env:
TEST_SUITE: "@${{matrix.testSuite}}"
run: npm run test:playwright
- uses: actions/upload-artifact@v3
if: failure()
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
46 changes: 46 additions & 0 deletions blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"phpExtensionBundles": ["kitchen-sink"],
"steps": [
{
"step": "defineWpConfigConsts",
"consts": {
"WP_MAX_MEMORY_LIMIT": "1024M",
"ELEMENTOR_SHOW_HIDDEN_EXPERIMENTS": true
}
},
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org/themes",
"slug": "hello-elementor"
},
"options": {
"activate": true
}
},
{
"step": "activatePlugin",
"pluginName": "elementor",
"pluginPath": ".elementor/build/"
},
{
"step": "wp-cli",
"command": "wp elementor experiments deactivate home_screen"
},
{
"step": "wp-cli",
"command": "wp elementor experiments activate e_optimized_css_loading"
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
Loading

0 comments on commit a87a830

Please sign in to comment.