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

Improve run.sh #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 12 additions & 10 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ SKIP_INIT=${3-false}

# Configure WordPress versions

rm -rf old/.wp-env.override.json
rm -rf new/.wp-env.override.json
Comment on lines -16 to -17
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no directories here.

rm -f old/.wp-env.override.json
rm -f new/.wp-env.override.json

if [[ $OLD_VERSION == 'trunk' ]]; then
OLD_VERSION='master'
Expand All @@ -27,19 +27,19 @@ fi
echo "Old version: $OLD_VERSION"

if [[ $OLD_VERSION != 'latest' ]]; then
if [[ "$OLD_VERSION" == *".zip"* ]]; then
echo "{\"core\":\"$OLD_VERSION\"}" >> old/.wp-env.override.json
if [[ $OLD_VERSION == *.zip* ]]; then
printf '{"core":"%s"}' "$OLD_VERSION" >> old/.wp-env.override.json
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printf is the master at mixing literals with variables 👴🏻

else
echo "{\"core\":\"WordPress/WordPress#$OLD_VERSION\"}" >> old/.wp-env.override.json
printf '{"core":"WordPress/WordPress#%s"}' "$OLD_VERSION" >> old/.wp-env.override.json
fi
fi

echo "New version: $NEW_VERSION"

if [[ "$NEW_VERSION" == *".zip"* ]]; then
echo "{\"core\":\"$NEW_VERSION\"}" >> new/.wp-env.override.json
if [[ "$NEW_VERSION" == *.zip* ]]; then
printf '{"core":"%s"}' "$NEW_VERSION" >> new/.wp-env.override.json
else
echo "{\"core\":\"WordPress/WordPress#$NEW_VERSION\"}" >> new/.wp-env.override.json
printf '{"core":"WordPress/WordPress#%s"}' "$NEW_VERSION" >> new/.wp-env.override.json
fi

if [[ $SKIP_INIT != 'true' ]]; then
Expand Down Expand Up @@ -105,9 +105,10 @@ 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
node ../scripts/results.js "Server-Timing (Block Theme)" before.csv after.csv

cd -
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes to the previous working directory


# 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)

Expand All @@ -125,8 +126,9 @@ 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
node ../scripts/results.js "Server-Timing (Classic Theme)" before.csv after.csv

cd -

# Shutdown sites again

cd ../
(cd old && npm run wp-env --silent stop)
(cd new && npm run wp-env --silent stop)