本文是之前发版时候出过一个问题,把debug版发出去了。沉痛反思:
形成检查清单
- 版本号统一检查
- uni模块测试流程检查
- 版本类型检查
- 功能检查:主要功能点,app - uni/h5/flutter流程正常 等
自动化检查
- 脚本、工具检查关键节点。协同开发人员,测试人员等
关于自动化检查,这篇也是呼应android studio 自定义备注后续
自动检查
主要就是为了在运行或打包的时候能够自动检查不合规的地方。如下脚本中,都制定了打包过程中才继续生效:
# 检查是否为Archive操作
if [ "$ACTION" == "archive" ]; then
关于版本检查
主要检查打包类型,多target的版本是否一致

xxx.png
Build Phases中添加脚本:

xxx.png
# 获取当前的构建目标
ACTION=$(echo $ACTION)
# 检查是否为Archive操作
if [ "$ACTION" == "archive" ]; then
# 获取当前的构建配置
CONFIGURATION=$(echo $CONFIGURATION)
echo "Current Configuration: $CONFIGURATION"
# 检查是否为Release配置
if [ "$CONFIGURATION" != "Release" ]; then
# 使用AppleScript弹出一个需要用户确认的对话框
osascript <<EOF
tell application "System Events"
activate
display dialog "archive-scheme配置有误,非Release,请检查." buttons {"OK"} default button 1 with title "archive配置异常警告⚠️" with icon caution
end tell
EOF
exit 1
fi
fi
效果如:

xxx.png
打包过程中如果有这类错误,就弹框提醒了。
代码检查
# 获取当前的构建目标
ACTION=$(echo $ACTION)
# 检查是否为Archive操作
if [ "$ACTION" == "archive" ]; then
# 定义文件路径
FILE_PATH="/Users/zyj-xxt/Documents/项目开发/git/ios/xxt/xxt-ios/app/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.m"
# 定义需要检查的代码片段
EXPECTED_CODE_FRAGMENT="#if !defined\(SV_APP_EXTENSIONS\) && TARGET_OS_IOS\\
self.frame = \[UIApplication sharedApplication\].keyWindow.bounds;\\
UIInterfaceOrientation orientation = \[UIApplication sharedApplication\].statusBarOrientation;"
# 使用grep检查文件中是否包含预期的代码片段
if ! grep -Fq "$EXPECTED_CODE_FRAGMENT" "$FILE_PATH"; then
# 如果没有找到预期的代码片段,则弹出对话框提醒
osascript <<EOF
tell application "System Events"
activate
end tell
tell application "Finder"
activate
end tell
set theDialogText to "SVProgressHUD.m类positionHUD方法中610行需要更新.\n\n"
set theBoldRedText to "请参考:https://developer.aliyun.com/article/1517999"
set theDialogTitle to "打包代码检查警告⚠️"
set theDialogButtons to {"OK"}
set theDialogDefaultButton to 1
display dialog theDialogText & theBoldRedText buttons theDialogButtons default button theDialogDefaultButton with title theDialogTitle with icon stop
EOF
exit 1
fi
fi
检查这个的目的是啥呢,是升级了SVProgressHUD的版本,但是有一些版本兼容的问题。所以,避免把不正常的代码发上去,做了一些检查。

xxx.png
okk,到此为止。