Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test performance benchmark #38

Draft
wants to merge 15 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/performance-benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Performance Benchmark

on:
pull_request:
branches:
- trunk

jobs:
performance:
name: 'Run tests'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup proper PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Node install
run: npm ci

- name: Build
run: npm run build

- name: Run performance tests
uses: swissspidy/wp-performance-action@v2
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
with:
urls: |
/
/wp-admin/
blueprint: './.github/workflows/performance-blueprint.json'
iterations: 5
repetitions: 1
56 changes: 56 additions & 0 deletions .github/workflows/performance-blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"plugins": [
"woocommerce",
"email-log",
"https://github.com/woocommerce/wc-smooth-generator/releases/latest/download/wc-smooth-generator.zip"
],
"extraLibraries": [
"wp-cli"
],
"steps": [
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DEBUG": true,
"WP_CACHE": true
}
},
{
"step": "installTheme",
"themeData": {
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
"resource": "wordpress.org/themes",
"slug": "storefront"
},
"ifAlreadyInstalled": "skip",
"options": {
"activate": true,
"importStarterContent": false
}
},
{
"step": "runPHP",
"code": "<?php\nrequire '/wordpress/wp-load.php';\n\n// Create the 'Vendor' term under 'wcpv_product_vendors' taxonomy\n$term = wp_insert_term('Vendor', 'wcpv_product_vendors');\n\n// Check if the term was created successfully\nif (is_wp_error($term)) {\n echo 'Error creating term: ' . $term->get_error_message();\n} else {\n $term_id = $term['term_id'];\n // Set the term meta for 'vendor_data'\n update_term_meta($term_id, 'vendor_data', json_encode(['email' => '[email protected]']));\n echo 'Term created and meta data set successfully.';\n}\n"
},
{
"step": "wp-cli",
"command": "wp wc generate products 50"
},
{
"step": "wp-cli",
"command": "wp wc generate orders 20"
},
{
"step": "wp-cli",
"command": "wp wc generate customers 10"
},
{
"step": "wp-cli",
"command": "wp wc generate terms product_cat 100"
},
{
"step": "login",
"username": "admin"
}
]
}
Loading