patch-external: fail CI build

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/900/head
Varun Patil 2023-10-27 03:33:10 -07:00
parent c2076e2535
commit eec6e0a492
2 changed files with 40 additions and 4 deletions

View File

@ -31,10 +31,7 @@ build-js-production:
rm -f js/* && npm run build rm -f js/* && npm run build
patch-external: patch-external:
patch -p1 -N < patches/scroller-perf.patch || true bash scripts/patch-external.sh
patch -p1 -N < patches/scroller-sticky.patch || true
patch -p1 -N < patches/plyr-wrap.patch || true
patch -p1 -N < patches/videojs-vhs-1439.patch || true
watch-js: watch-js:
npm run watch npm run watch

View File

@ -0,0 +1,39 @@
#!/bin/bash
# This script is used to patch external libraries.
# If any patch fails, the script will exit with error code 1.
# Do not exit on failure so that we can print all errors at once.
set +e
# Check if the script is called from the root folder of the project.
if [ ! -f "scripts/patch-external.sh" ]; then
echo -e "\033[0;33mPlease run this script from the root folder of the project.\033[0m"
exit 1
fi
# Make sure node_modules is installed.
if [ ! -d "node_modules" ]; then
echo -e "\033[0;33mPlease run 'npm install' before running this script.\033[0m"
exit 1
fi
# Apply all patches.
HAS_ERROR=0
for patch in patches/*.patch; do
echo -e "\n\033[0;32mApplying patch: $patch\033[0m"
patch -p1 -N < $patch
if [ $? -ne 0 ]; then
echo -e "\033[0;33mFailed to apply patch: $patch\033[0m"
HAS_ERROR=1
fi
done
# Exit with error code if any patch failed.
# This way we fail the CI build.
if [ $HAS_ERROR -ne 0 ]; then
echo -e "\n\033[0;31mFailed to apply some patches. See above for details.\033[0m"
exit 1
else
echo -e "\n\033[0;32mAll patches applied successfully.\033[0m"
fi