infer 静态代码扫描学习
https://testerhome.com/topics/30910
brew install jenkins
2.构建执行 shell,填入以下信息
project_path="/Users/xx/.jenkins/workspace/infer"
WEBHOOK_URL=xxx
cd $project_path/xx
git pull
cd $project_path/xx
git pull
#初始化
xcodebuild -workspace xx.xcworkspace -scheme xx clean
cd $project_path
#删除上次的文件
rm -rf xcodebuild.log
rm -rf infer-out
rm -rf compile_commands.json
#执行命令
#第一步
#xcodebuild -workspace xx.xcworkspace -scheme xx -sdk iphonesimulator -arch x86_64 COMPILER_INDEX_STORE_ENABLE=NO| tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json
#第二步
infer run --keep-going --compilation-database-escaped compile_commands.json
#生成报告
infer-explore --html
#获取当前时间
time2=$(date '+%Y%m%d_%H%M%S')
cd $project_path/infer-out
#打包报告
tar cvf $time2.tar report.html
scp /Users/didi/Documents/didi/project/infer-out/$time2.tar root@xx.xx.xx.xx:/usr/share/nginx/html
#登录远程服务器
ssh root@xx.xx.xx.xx "cd /usr/share/nginx/html ; tar xvf $time2.tar ;mv report.html $time2; rm -rf $time2.tar; chmod -R 777 $time2"
url="http://xx.xx.xx.x:9999/$time2/"
BUILD_USER_RD="xx"
message="{\"text\": \"IOS静态扫描执行结束,点击${url}可查看报告,请@${BUILD_USER_RD} 关注执行结果\"}"
curl -XPOST -H "Content-Type: application/json;charset=utf-8" ${WEBHOOK_URL} -d "${message}"