Add WordPress Playground and WP Performance Tests integration
This commit is contained in:
91
.github/workflows/playground-tests.yml
vendored
Normal file
91
.github/workflows/playground-tests.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
name: WordPress Playground Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, feature/*, bugfix/* ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
name: Code Quality Check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Verify package.json and package-lock.json
|
||||
run: |
|
||||
echo "Verifying package.json and package-lock.json are in sync"
|
||||
npm ci --dry-run
|
||||
|
||||
- name: Lint JavaScript files
|
||||
run: |
|
||||
echo "Linting JavaScript files"
|
||||
# Add your linting command here when you have one
|
||||
# For example: npm run lint
|
||||
|
||||
playground-test:
|
||||
name: WordPress Playground Tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: code-quality
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install WordPress Playground CLI
|
||||
run: npm install -g @wordpress/playground-tools
|
||||
|
||||
- name: Create plugin zip
|
||||
run: |
|
||||
mkdir -p dist
|
||||
zip -r dist/plugin.zip . -x "node_modules/*" "dist/*" ".git/*"
|
||||
|
||||
- name: Run tests with WordPress Playground
|
||||
run: |
|
||||
# Start WordPress Playground with our blueprint
|
||||
wp-playground start --blueprint playground/blueprint.json --port 8888 &
|
||||
|
||||
# Wait for WordPress Playground to be ready
|
||||
echo "Waiting for WordPress Playground to be ready..."
|
||||
timeout 60 bash -c 'until curl -s http://localhost:8888; do sleep 2; done'
|
||||
|
||||
# Run Cypress tests against WordPress Playground
|
||||
npm run test:single:headless
|
||||
|
||||
performance-test:
|
||||
name: WordPress Performance Tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: code-quality
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: WordPress Performance Tests
|
||||
uses: wptrt/wordpress-plugin-performance-tests@v1
|
||||
with:
|
||||
plugin-slug: wp-plugin-starter-template-for-ai-coding
|
||||
php-version: '8.0'
|
||||
wp-version: 'latest'
|
||||
test-type: 'all'
|
||||
Reference in New Issue
Block a user