自動化パッケージのいくつかの実践

2929 ワード

この2,3日ネット上で自動梱包の文章を探して、精(Chao)心(Xi)整(Xiu)理(Gai)は2部の梱包書類を整理しました.

テストの友达、テストバッグをください。兄はもううんざりしていません。


shell
# 
project_path="XXX"
#xcworkspace  
xcworkspace="XXX.xcworkspace"
#scheme  
scheme="XXX"
# 
profilename="XXX"

# 
today=`date +%Y%m%d%H%M%S`
# 
ipaName="LDPX_HomeTest_V2.03_"

#archive  
archivePath="XXX"
xcarchiveName=".xcarchive"
archiveRPath=$archivePath$ipaName$today$xcarchiveName

# ipa 
ipaPath="XXX"
ipa=".ipa"
ipaPathR=$ipaPath$ipaName$today$ipa
cd $project_path

echo $ipaPathR
echo $archiveRPath

echo "clean start..."
xcodebuild clean -workspace $xcworkspace -scheme CMCC_CY -configuration release
echo "clean end."
echo "compile start......"
# archive , archive  
xcodebuild archive -workspace $xcworkspace -scheme $scheme -configuration release -sdk iphoneos9.2  IPHONEOS_DEPLOYMENT_TARGET=8.0 -archivePath $archiveRPath;
echo "compile end."
echo "xcodebuild archive start......"
# xcrun  xcodebuild -exportArchive  ipa 
xcodebuild -exportArchive -archivePath $archiveRPath -exportPath $ipaPathR -exportFormat IPA -exportProvisioningProfile $profilename

echo "******xcodebuild archive  end.******"
echo $ipaPathR
echo $archiveRPath
echo "******xcodebuild archive  end.******"

python
# -*- coding: utf-8 -*-
import os
import sys
import time
#  
project_path = "XXX"

#activePath
activePath = "XXX/XXX.xcarchive"

#  ipa 
targerIPA_parth = "XXX"

# 
cerName = "XXX"

# 
#LDPX_Test_V2.01_B1.00_20161226.ipa

# 
#LDPX_TestHome_V2.01_B1.00_20161226.ipa

# 
#LDPX_V2.01_B1.00_20161226.ipa

ipaName = "LDPX_HomeTest_V2.03_"

#    build 
def clean_project_mkdir_build():
    os.system('cd %s;xcodebuild clean -workspace "CMCC_CY.xcworkspace" -scheme CMCC_CY -configuration release' % project_path) # clean  

def build_project():
    print("build release start")
    os.system ('xcodebuild -list')
    os.system ('cd %s;xcodebuild archive -workspace "CMCC_CY.xcworkspace" -scheme CMCC_CY -configuration release -sdk iphoneos9.2  IPHONEOS_DEPLOYMENT_TARGET=8.0 -archivePath %s;' % (project_path,activePath))

#  ipa  
def build_ipa():
    global ipa_filename
    timeSr = time.strftime('%Y%m%d%H%M%S.ipa',time.localtime(time.time()))
    ipa_filename = ipaName + timeSr
    
    os.system ('xcodebuild -exportArchive -archivePath %s -exportPath %s/%s -exportFormat IPA -exportProvisioningProfile %s'%(activePath,targerIPA_parth,ipa_filename,cerName))

def main():
    #  
    clean_project_mkdir_build()
    #  coocaPods   
    build_project()
    #  ipa  
    build_ipa()

#  
main()

後続の最適化可能部分
  • と新しいコードライブラリ
  • メール通知関連テスト担当者
  • スクリプトとフレキシブルポイント(副次的...結局プロジェクトディレクトリ、名前は頻繁に変更することはできません)