diff --git a/.github/workflows/performance-benchmark.yml b/.github/workflows/performance-benchmark.yml new file mode 100644 index 0000000000..7e51c45ea4 --- /dev/null +++ b/.github/workflows/performance-benchmark.yml @@ -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 + with: + urls: | + / + /wp-admin/ + blueprint: './.github/workflows/performance-blueprint.json' + iterations: 5 + repetitions: 1 diff --git a/.github/workflows/performance-blueprint.json b/.github/workflows/performance-blueprint.json new file mode 100644 index 0000000000..a0ffeca35e --- /dev/null +++ b/.github/workflows/performance-blueprint.json @@ -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": { + "resource": "wordpress.org/themes", + "slug": "storefront" + }, + "ifAlreadyInstalled": "skip", + "options": { + "activate": true, + "importStarterContent": false + } + }, + { + "step": "runPHP", + "code": "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' => 'sample@example.com']));\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" + } + ] +}