diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b2434bb..2698834 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -13,6 +13,14 @@ on: type: string default: "trunk" required: true + theme: + description: "Theme to test" + type: choice + options: + - twentytwentyone + - twentytwentythree + - twentytwentyfour + required: true jobs: benchmarks: @@ -89,44 +97,36 @@ jobs: (cd old && wp-env run tests-cli wp plugin deactivate wordpress-importer) (cd new && wp-env run tests-cli wp plugin deactivate wordpress-importer) - - name: Install block theme - run: | - (cd old && wp-env run tests-cli wp theme activate twentytwentythree) - (cd new && wp-env run tests-cli wp theme activate twentytwentythree) - - - name: Benchmark Web Vitals - working-directory: wpp-research - run: | - npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 100 -p -o csv > before.csv - npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 100 -p -o csv > after.csv - node ../scripts/results.js "Web Vitals (Block Theme)" before.csv after.csv > summary.md - cat summary.md >> $GITHUB_STEP_SUMMARY - - - name: Benchmark Server-Timing - working-directory: wpp-research + - name: Post Debugging Info run: | - npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ -n 100 -p -o csv > before.csv - npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv - node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv > summary.md - cat summary.md >> $GITHUB_STEP_SUMMARY + echo "Old version – Theme info" + (cd old && npm run wp-env run tests-cli wp theme list) + echo "New version – Theme info" + (cd new && npm run wp-env run tests-cli wp theme list) - - name: Install classic theme + - name: Install theme run: | - (cd old && wp-env run tests-cli wp theme activate twentytwentyone) - (cd new && wp-env run tests-cli wp theme activate twentytwentyone) + (cd old && wp-env run tests-cli wp theme activate $THEME) + (cd new && wp-env run tests-cli wp theme activate $THEME) + env: + THEME: ${{ inputs.theme }} - name: Benchmark Web Vitals working-directory: wpp-research run: | npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 100 -p -o csv > before.csv npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 100 -p -o csv > after.csv - node ../scripts/results.js "Web Vitals (Classic Theme)" before.csv after.csv > summary.md + node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv > summary.md cat summary.md >> $GITHUB_STEP_SUMMARY + env: + THEME: ${{ inputs.theme }} - name: Benchmark Server-Timing working-directory: wpp-research run: | npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ -n 100 -p -o csv > before.csv npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv - node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv > summary.md + node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv > summary.md cat summary.md >> $GITHUB_STEP_SUMMARY + env: + THEME: ${{ inputs.theme }} diff --git a/new/.wp-env.json b/new/.wp-env.json index aa66abb..25fee07 100644 --- a/new/.wp-env.json +++ b/new/.wp-env.json @@ -8,7 +8,8 @@ ], "themes": [ "https://downloads.wordpress.org/theme/twentytwentyone.zip", - "https://downloads.wordpress.org/theme/twentytwentythree.zip" + "https://downloads.wordpress.org/theme/twentytwentythree.zip", + "WordPress/twentytwentyfour" ], "mappings": { "wp-cli.yml": "../shared/wp-cli.yml", @@ -17,6 +18,7 @@ "config": { "WP_DEBUG": false, "SCRIPT_DEBUG": false, - "SAVEQUERIES": false + "SAVEQUERIES": false, + "DISABLE_WP_CRON": true } -} +} \ No newline at end of file diff --git a/old/.wp-env.json b/old/.wp-env.json index cef1b25..55d89fc 100644 --- a/old/.wp-env.json +++ b/old/.wp-env.json @@ -8,7 +8,8 @@ ], "themes": [ "https://downloads.wordpress.org/theme/twentytwentyone.zip", - "https://downloads.wordpress.org/theme/twentytwentythree.zip" + "https://downloads.wordpress.org/theme/twentytwentythree.zip", + "WordPress/twentytwentyfour" ], "mappings": { "wp-cli.yml": "../shared/wp-cli.yml", @@ -17,6 +18,7 @@ "config": { "WP_DEBUG": false, "SCRIPT_DEBUG": false, - "SAVEQUERIES": false + "SAVEQUERIES": false, + "DISABLE_WP_CRON": true } -} +} \ No newline at end of file diff --git a/run.sh b/run.sh index 765f7f8..a030a12 100755 --- a/run.sh +++ b/run.sh @@ -9,10 +9,11 @@ fi OLD_VERSION=${1-latest} NEW_VERSION=${2-trunk} -SKIP_INIT=${3-false} -OUTPUT=${4-markdown} -SKIP_FORMATTING=${5-false} -PRINT_TO_FILES=${6-false} +THEME=${3-twentytwentyone} +SKIP_INIT=${4-false} +OUTPUT=${5-markdown} +SKIP_FORMATTING=${6-false} +PRINT_TO_FILES=${7-false} # Configure WordPress versions @@ -89,46 +90,17 @@ else fi -# Install block theme +# Install theme -(cd old && npm run wp-env --silent run tests-cli wp theme activate twentytwentythree) -(cd new && npm run wp-env --silent run tests-cli wp theme activate twentytwentythree) +(cd old && npm run wp-env --silent run tests-cli wp theme activate $THEME) +(cd new && npm run wp-env --silent run tests-cli wp theme activate $THEME) -cd ./wpp-research || exit - -# Benchmark Web Vitals +## Post debuging info. +echo "Old version – Theme info" +(cd old && npm run wp-env run tests-cli wp theme list) -npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -p -o csv > before.csv -npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -p -o csv > after.csv -if [[ $PRINT_TO_FILES == 'true' ]]; then - if [[ $OUTPUT == 'csv' ]]; then - node ../scripts/results.js "Web Vitals (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-block-theme.csv - else - node ../scripts/results.js "Web Vitals (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-block-theme.md - fi -else - node ../scripts/results.js "Web Vitals (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING -fi - -# Benchmark Server-Timing - -npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ -n 100 -p -o csv > before.csv -npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv -if [[ $PRINT_TO_FILES == 'true' ]]; then - if [[ $OUTPUT == 'csv' ]]; then - node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-block-theme.csv - else - node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-block-theme.md - fi -else - node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING -fi - -# Install classic theme - -cd ../ -(cd old && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone) -(cd new && npm run wp-env --silent run tests-cli wp theme activate twentytwentyone) +echo "New version – Theme info" +(cd new && npm run wp-env run tests-cli wp theme list) cd ./wpp-research || exit @@ -138,12 +110,12 @@ npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 2 npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -p -o csv > after.csv if [[ $PRINT_TO_FILES == 'true' ]]; then if [[ $OUTPUT == 'csv' ]]; then - node ../scripts/results.js "Web Vitals (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.csv + node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-$THEME.csv else - node ../scripts/results.js "Web Vitals (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-classic-theme.md + node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-$THEME.md fi else - node ../scripts/results.js "Web Vitals (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING + node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING fi # Benchmark Server-Timing @@ -152,12 +124,12 @@ npm run research --silent -- benchmark-server-timing -u http://localhost:8881/ npm run research --silent -- benchmark-server-timing -u http://localhost:8891/ -n 100 -p -o csv > after.csv if [[ $PRINT_TO_FILES == 'true' ]]; then if [[ $OUTPUT == 'csv' ]]; then - node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.csv + node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-$THEME.csv else - node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-classic-theme.md + node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > server-timing-$THEME.md fi else - node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv $OUTPUT $SKIP_FORMATTING + node ../scripts/results.js "Server-Timing ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING fi # Shutdown sites again