Jetpack block performance #2457
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: Jetpack block performance | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
jobs: | |
block-performance: | |
name: "Performance tests" | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 # 2023-04-18: Some runs exceeded 50 minutes | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'WordPress/gutenberg' | |
path: 'gutenberg' | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('gutenberg/**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Build Gutenberg | |
working-directory: gutenberg | |
run: | | |
npm ci | |
npx playwright install chromium --with-deps | |
npm run build:packages | |
- name: Setup tools for Jetpack | |
uses: ./.github/actions/tool-setup | |
- name: Build Production Jetpack | |
run: | | |
pnpm install | |
pnpm jetpack build plugins/jetpack -v --production | |
- name: Environment set-up | |
working-directory: tools/e2e-commons | |
env: | |
CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }} | |
run: | | |
# Gutenberg Performance tests require disable-animations.php test | |
# plugin to be available on a site. Below we inject the mapping for | |
# that plugin into a Docker config file. | |
echo "e2e:" >> ../docker/jetpack-docker-config.yml | |
echo " volumeMappings:" >> ../docker/jetpack-docker-config.yml | |
echo " gutenberg/packages/e2e-tests/plugins/disable-animations.php: /var/www/html/wp-content/plugins/disable-animations.php" >> ../docker/jetpack-docker-config.yml | |
mkdir results | |
pnpm config:decrypt | |
pnpm env:start | |
# The twentytwentyone theme is required for the post-editor test suite. | |
pnpm jetpack docker --type e2e --name t1 wp theme install twentytwentyone | |
- name: Run performance tests | |
working-directory: tools/e2e-commons | |
run: | | |
node ./bin/performance.js | |
- name: Environment tear-down | |
if: ${{ always() }} | |
working-directory: tools/e2e-commons | |
continue-on-error: true | |
run: | | |
pnpm run tunnel:off | |
# Update permissions to workaround https://github.com/actions/cache/issues/753 | |
sudo chown -R runner:docker "$GITHUB_WORKSPACE/tools/docker" | |
- name: Upload test artifacts | |
if: ${{ always() }} | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-output-block-perf | |
path: tools/e2e-commons/results | |
include-hidden-files: true | |
test-reports: | |
name: "Trigger test report workflow" | |
runs-on: ubuntu-latest | |
if: ${{ ! cancelled() }} | |
needs: block-performance | |
steps: | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.E2E_TEST_REPORTS_TOKEN }} | |
repository: automattic/jetpack-e2e-reports | |
event-type: block-perf | |
client-payload: '{"run_id": "${{github.run_id}}", "repository": "${{github.repository}}"}' | |
slack-notification: | |
name: "Slack notification" | |
runs-on: ubuntu-latest | |
if: ${{ ! cancelled() }} | |
needs: [block-performance] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up tools | |
uses: ./.github/actions/tool-setup | |
- name: Build action | |
env: | |
COMPOSER_ROOT_VERSION: dev-trunk | |
run: | | |
pnpm install | |
composer install | |
composer build-development | |
working-directory: ./projects/github-actions/test-results-to-slack | |
- name: "Send notification" | |
uses: ./projects/github-actions/test-results-to-slack | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
slack_channel: ${{ secrets.SLACK_E2E_CHANNEL }} | |
slack_icon_emoji: ":jetpack:" | |
suite_name: "blocks performance" |