Files
FastDeploy/scripts/check_approval.sh
Longzhi Wang 21f138f68b
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
Publish Job / publish_pre_check (push) Has been cancelled
Publish Job / print_publish_pre_check_outputs (push) Has been cancelled
Publish Job / FD-Clone-Linux (push) Has been cancelled
Publish Job / Show Code Archive Output (push) Has been cancelled
Publish Job / BUILD_SM8090 (push) Has been cancelled
Publish Job / BUILD_SM8689 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8090 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8689 (push) Has been cancelled
Publish Job / Run FD Image Build (push) Has been cancelled
Publish Job / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
Publish Job / Run FastDeploy LogProb Tests (push) Has been cancelled
Publish Job / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
Publish Job / Run Base Tests (push) Has been cancelled
Publish Job / Run Accuracy Tests (push) Has been cancelled
Publish Job / Run Stable Tests (push) Has been cancelled
CI Images Build / FD-Clone-Linux (push) Has been cancelled
CI Images Build / Show Code Archive Output (push) Has been cancelled
CI Images Build / CI Images Build (push) Has been cancelled
CI Images Build / BUILD_SM8090 (push) Has been cancelled
CI Images Build / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
CI Images Build / Run FastDeploy LogProb Tests (push) Has been cancelled
CI Images Build / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
CI Images Build / Run Base Tests (push) Has been cancelled
CI Images Build / Publish Docker Images Pre Check (push) Has been cancelled
[CI] Add env ci (#5331)
* test

* [CI] Add env ci

* test donw
2025-12-02 19:31:25 +08:00

108 lines
4.6 KiB
Bash

# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ -z ${BRANCH} ]; then
BRANCH="develop"
fi
FD_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
approval_line=`curl -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/PaddlePaddle/FastDeploy/pulls/${PR_ID}/reviews?per_page=10000`
failed_num=0
echo_list=()
function check_approval(){
local echo_line="$1"
shift
person_num=`echo $@|awk '{for (i=2;i<=NF;i++)print $i}'`
APPROVALS=`echo ${approval_line}|python ${FD_ROOT}/scripts/check_pr_approval.py $1 $person_num`
if [[ "${APPROVALS}" == "FALSE" && "${echo_line}" != "" ]]; then
add_failed "${failed_num}. ${echo_line}"
fi
}
function add_failed(){
failed_num=`expr $failed_num + 1`
echo_list="${echo_list[@]}$1"
}
HAS_CUSTOM_REGISTRER=`git diff -U0 upstream/$BRANCH | grep '^\+' | grep -zoE "PD_BUILD_(STATIC_)?OP" || true`
if [ ${HAS_CUSTOM_REGISTRER} ] && [ "${PR_ID}" != "" ]; then
echo_line1="You must have one FastDeploy RD (qingqing01(dangqingqing), Jiang-Jia-Jun(jiangjiajun), heavengate(dengkaipeng)) approval for adding custom op.\n"
echo_line2="You must have one QA(DDDivano(zhengtianyu)) approval for adding custom op.\n"
echo_line3="You must have one PaddlePaddle RD (XiaoguangHu01(huxiaoguang), jeff41404(gaoxiang), phlrain(liuhongyu)) approval for adding custom op.\n"
check_approval "$echo_line1" 1 qingqing01 Jiang-Jia-Jun heavengate
check_approval "$echo_line2" 1 DDDivano
check_approval "$echo_line3" 1 XiaoguangHu01 jeff41404 phlrain
fi
WORKER_OR_CONFIG_LIST=(
"fastdeploy/model_executor/graph_optimization"
)
HAS_WORKER_OR_CONFIG_MODIFY=`git diff upstream/$BRANCH --name-only | grep -E $(printf -- "-e %s " "${WORKER_OR_CONFIG_LIST[@]}") || true`
if [ "${HAS_WORKER_OR_CONFIG_MODIFY}" != "" ] && [ "${PR_ID}" != "" ]; then
echo_line1="You must have one FastDeploy RD gongshaotian(gongshaotian) approval for modifing [$(IFS=', '; echo "${WORKER_OR_CONFIG_LIST[*]}")]."
check_approval "$echo_line1" 1 gongshaotian
fi
SPECULATIVE_DECODING_LIST=(
"fastdeploy/spec_decode"
"custom_ops/gpu_ops/speculate_decoding"
)
HAS_SPECULATIVE_DECODING_MODIFY=`git diff upstream/$BRANCH --name-only | grep -E $(printf -- "-e %s " "${SPECULATIVE_DECODING_LIST[@]}") || true`
if [ "${HAS_SPECULATIVE_DECODING_MODIFY}" != "" ] && [ "${PR_ID}" != "" ]; then
echo_line1="You must have one FastDeploy RD (freeliuzc(liuzichang01), Deleter-D(wangyanpeng04)) approval for modifing [$(IFS=', '; echo "${SPECULATIVE_DECODING_LIST[*]}")]."
check_approval "$echo_line1" 1 freeliuzc Deleter-D
fi
ENV_FILE="fastdeploy/envs.py"
HAS_ENV_MODIFY=$(git diff upstream/$BRANCH --name-only | grep -E "^${ENV_FILE}$" || true)
if [ "${HAS_ENV_MODIFY}" != "" ] && [ "${PR_ID}" != "" ]; then
echo_line1="You must have one FastDeploy RD (yuanlehome(liuyuanle), rainyfly(chenjian26), Wanglongzhi2001(wanglongzhi)) approval for modifying [${ENV_FILE}]."
check_approval "$echo_line1" 1 yuanlehome rainyfly Wanglongzhi2001
fi
if [[ "${BRANCH}" != "develop" ]] && [[ -n "${PR_ID}" ]]; then
pr_info=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \
https://api.github.com/repos/PaddlePaddle/FastDeploy/pulls/${PR_ID})
pr_title=$(echo "$pr_info" | jq -r '.title')
echo "==> PR title: ${pr_title}"
has_cp_tag=$(echo "$pr_title" | grep -o "\[Cherry-Pick\]" || true)
has_pr_number=$(echo "$pr_title" | grep -oE "#[0-9]{2,6}" || true)
if [[ -z "$has_cp_tag" ]] || [[ -z "$has_pr_number" ]]; then
echo_line="Cherry-Pick PR must come from develop and the title must contain [Cherry-Pick] and the original develop PR number (e.g., #5010). Approval required from FastDeploy RD: qingqing01(dangqingqing), Jiang-Jia-Jun(jiangjiajun), heavengate(dengkaipeng)."
check_approval "$echo_line" 1 qingqing01 Jiang-Jia-Jun heavengate
fi
fi
if [ -n "${echo_list}" ];then
echo "****************"
echo -e "${echo_list[@]}"
echo "There are ${failed_num} approved errors."
echo "****************"
fi
if [ -n "${echo_list}" ]; then
exit 6
fi