Skip to content

Commit 34d188b

Browse files
Check whl size (#34767)
1 parent 8fb17fc commit 34d188b

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

paddle/scripts/paddle_build.sh

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,18 +689,18 @@ function get_precision_ut_mac() {
689689
on_precision=1
690690
re=$(cat ut_list|awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}')
691691
UT_list_prec_1='ut_list_prec2'
692-
for case in $UT_list; do
693-
flag=$(echo $case|grep -oE $re)
692+
for ut_case in $UT_list; do
693+
flag=$(echo $ut_case|grep -oE $re)
694694
if [ -n "$flag" ];then
695695
if [ -z "$UT_list_prec" ];then
696-
UT_list_prec="^$case$"
696+
UT_list_prec="^$ut_case$"
697697
elif [[ "${#UT_list_prec}" -gt 10000 ]];then
698-
UT_list_prec_1="$UT_list_prec_1|^$case$"
698+
UT_list_prec_1="$UT_list_prec_1|^$ut_case$"
699699
else
700-
UT_list_prec="$UT_list_prec|^$case$"
700+
UT_list_prec="$UT_list_prec|^$ut_case$"
701701
fi
702702
else
703-
echo ${case} "won't run in PRECISION_TEST mode."
703+
echo ${ut_case} "won't run in PRECISION_TEST mode."
704704
fi
705705
done
706706
fi
@@ -722,6 +722,32 @@ function fetch_upstream_develop_if_not_exist() {
722722
fi
723723
}
724724

725+
function check_whl_size() {
726+
if [ ! "${pr_whl_size}" ];then
727+
echo "pr whl size not found "
728+
exit 1
729+
fi
730+
731+
set +x
732+
dev_whl_size=`du -m ${PADDLE_ROOT}/build/python/dist/*.whl|awk '{print $1}'`
733+
echo "dev_whl_size: ${dev_whl_size}"
734+
735+
whldiffSize=`expr ${pr_whl_size} - ${dev_whl_size}`
736+
if [ ${whldiffSize} -gt 10 ] ; then
737+
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
738+
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 22334008 22361972`
739+
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
740+
if [ "${APPROVALS}" == "FALSE" ]; then
741+
echo "=========================================================================================="
742+
echo "This PR make the release paddlepaddle whl size growth exceeds 10 M."
743+
echo "Then you must have one RD (jim19930609 (Recommend) or JiabinYang) approval for this PR\n"
744+
echo "=========================================================================================="
745+
exit 6
746+
fi
747+
fi
748+
set -x
749+
}
750+
725751
function generate_upstream_develop_api_spec() {
726752
fetch_upstream_develop_if_not_exist
727753
cur_branch=`git branch | grep \* | cut -d ' ' -f2`
@@ -730,6 +756,9 @@ function generate_upstream_develop_api_spec() {
730756
cmake_gen $1
731757
build $2
732758
cp ${PADDLE_ROOT}/python/requirements.txt /tmp
759+
pr_whl_size=`du -m ${PADDLE_ROOT}/build/python/dist/*.whl|awk '{print $1}'`
760+
echo "pr_whl_size: ${pr_whl_size}"
761+
733762

734763
git checkout $cur_branch
735764
generate_api_spec "$1" "DEV"
@@ -2234,6 +2263,7 @@ function main() {
22342263
example_code=$?
22352264
summary_check_problems $check_style_code $[${example_code_gpu} + ${example_code}] "$check_style_info" "${example_info_gpu}\n${example_info}"
22362265
assert_api_spec_approvals
2266+
check_whl_size
22372267
;;
22382268
build)
22392269
cmake_gen ${PYTHON_ABI:-""}

0 commit comments

Comments
 (0)