From 1671e1d37e44d1e83dc496911edc1d3ef6639d8f Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Wed, 28 Aug 2024 07:57:11 -0400 Subject: [PATCH 1/5] ci(pre-push): use --parallel when detecting a macOS or Linux system --- .hooks/pre-push | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.hooks/pre-push b/.hooks/pre-push index f817179807..8b196e9915 100755 --- a/.hooks/pre-push +++ b/.hooks/pre-push @@ -15,6 +15,14 @@ printf "\n⏳ npm run test\n" npm run test printf "\n⏳ composer test\n" -vendor/bin/phpunit +# Check the OS. Windows does not support the --parallel flag. +if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then + # Use --parallel on macOS and Linux. + vendor/bin/phpunit --parallel +else + # If neither of those are detected, don't use --parallel. + vendor/bin/phpunit +fi + printf "\n✅ pre-push OK\n\n" From efb847028c3d19f37bc21acff6995ac47ed4c378 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Wed, 28 Aug 2024 08:01:34 -0400 Subject: [PATCH 2/5] chore: fix some stuff --- .hooks/pre-push | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.hooks/pre-push b/.hooks/pre-push index 8b196e9915..2f906a2130 100755 --- a/.hooks/pre-push +++ b/.hooks/pre-push @@ -14,13 +14,14 @@ npx eslint --quiet printf "\n⏳ npm run test\n" npm run test -printf "\n⏳ composer test\n" # Check the OS. Windows does not support the --parallel flag. if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then - # Use --parallel on macOS and Linux. - vendor/bin/phpunit --parallel + # Use --parallel if macOS or Linux are detected. + printf "\n⏳ composer test -- --parallel\n" + vendor/bin/paratest else # If neither of those are detected, don't use --parallel. + printf "\n⏳ composer test\n" vendor/bin/phpunit fi From a7944fd48409ddf603939a8dd15ae72bcd997228 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Wed, 28 Aug 2024 08:04:40 -0400 Subject: [PATCH 3/5] fix: capture sigint --- .hooks/pre-push | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.hooks/pre-push b/.hooks/pre-push index 2f906a2130..fd87f64c42 100755 --- a/.hooks/pre-push +++ b/.hooks/pre-push @@ -2,6 +2,9 @@ # exit on error set -e +# Properly handle SIGINT (Ctrl/Cmd+C) when running paratest. +trap 'echo "Terminating..."; kill 0' SIGINT + printf "\n⏳ composer lint\n" vendor/bin/pint --test @@ -18,12 +21,14 @@ npm run test if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then # Use --parallel if macOS or Linux are detected. printf "\n⏳ composer test -- --parallel\n" - vendor/bin/paratest + vendor/bin/paratest & else # If neither of those are detected, don't use --parallel. printf "\n⏳ composer test\n" - vendor/bin/phpunit + vendor/bin/phpunit & fi +# Wait for all background tasks to finish. +wait printf "\n✅ pre-push OK\n\n" From 18cea45c0ef5dd48cd6c17e8eef8702ae0918f62 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Wed, 28 Aug 2024 08:05:17 -0400 Subject: [PATCH 4/5] chore: remove logging --- .hooks/pre-push | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hooks/pre-push b/.hooks/pre-push index fd87f64c42..4dd00d5373 100755 --- a/.hooks/pre-push +++ b/.hooks/pre-push @@ -3,7 +3,7 @@ set -e # Properly handle SIGINT (Ctrl/Cmd+C) when running paratest. -trap 'echo "Terminating..."; kill 0' SIGINT +trap 'kill 0' SIGINT printf "\n⏳ composer lint\n" vendor/bin/pint --test From 51369f39813f998b308ccd2ea449660d863bdb80 Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Wed, 28 Aug 2024 20:18:38 -0400 Subject: [PATCH 5/5] fix: address pr feedback --- .hooks/pre-push | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.hooks/pre-push b/.hooks/pre-push index 4dd00d5373..76269d7df6 100755 --- a/.hooks/pre-push +++ b/.hooks/pre-push @@ -2,9 +2,6 @@ # exit on error set -e -# Properly handle SIGINT (Ctrl/Cmd+C) when running paratest. -trap 'kill 0' SIGINT - printf "\n⏳ composer lint\n" vendor/bin/pint --test @@ -21,14 +18,11 @@ npm run test if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then # Use --parallel if macOS or Linux are detected. printf "\n⏳ composer test -- --parallel\n" - vendor/bin/paratest & + vendor/bin/paratest else # If neither of those are detected, don't use --parallel. printf "\n⏳ composer test\n" - vendor/bin/phpunit & + vendor/bin/phpunit fi -# Wait for all background tasks to finish. -wait - printf "\n✅ pre-push OK\n\n"