diff --git a/.github/ci/build/build_ios.sh b/.github/ci/build/build_ios.sh index 07517f9eb..36a48a0da 100644 --- a/.github/ci/build/build_ios.sh +++ b/.github/ci/build/build_ios.sh @@ -53,33 +53,44 @@ echo short_version: $short_version echo pwd: `pwd` echo sdk_url: $sdk_url -zip_name=${sdk_url##*/} -echo zip_name: $zip_name - -curl -o $zip_name $sdk_url || exit 1 -7za x ./$zip_name -y > log.txt - -unzip_name=`ls -S -d */ | grep Agora | sed 's/\///g'` -echo unzip_name: $unzip_name - -rm -rf ./$unzip_name/bin -rm ./$unzip_name/commits -rm ./$unzip_name/package_size_report.txt -mkdir ./$unzip_name/samples - -cp -rf ./iOS/${ios_direction} ./$unzip_name/samples/API-Example || exit 1 -ls -al ./$unzip_name/samples/API-Example/ -mv ./$unzip_name/samples/API-Example/sdk.podspec ./$unzip_name/ || exit 1 +unzip_name=Agora_Native_SDK_for_iOS_FULL +zip_name=output.zip +sdk_url_flag=false +if [ -z "$sdk_url" ]; then + sdk_url_flag=false + echo "sdk_url is empty" + echo unzip_name: $unzip_name + mkdir -p ./$unzip_name/samples + cp -rf ./iOS/${ios_direction} ./$unzip_name/samples/${ios_direction} || exit 1 + ls -al ./$unzip_name/samples/${ios_direction}/ +else + sdk_url_flag=true + zip_name=${sdk_url##*/} + echo zip_name: $zip_name + curl -o $zip_name $sdk_url || exit 1 + 7za x ./$zip_name -y > log.txt + unzip_name=`ls -S -d */ | grep Agora | sed 's/\///g'` + echo unzip_name: $unzip_name + rm -rf ./$unzip_name/bin + rm ./$unzip_name/commits + rm ./$unzip_name/package_size_report.txt + mkdir -p ./$unzip_name/samples + cp -rf ./iOS/${ios_direction} ./$unzip_name/samples/${ios_direction} || exit 1 + ls -al ./$unzip_name/samples/${ios_direction}/ + mv ./$unzip_name/samples/${ios_direction}/sdk.podspec ./$unzip_name/ || exit 1 +fi echo "work space1: $WORKSPACE" -python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/API-Example/Podfile || exit 1 - +python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/${ios_direction}/Podfile $sdk_url_flag || exit 1 +echo "start compress" 7za a -tzip result.zip -r $unzip_name > log.txt -mv result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name +echo "start move to" +echo $WORKSPACE/with${ios_direction}_${BUILD_NUMBER}_$zip_name +mv result.zip $WORKSPACE/with${ios_direction}_${BUILD_NUMBER}_$zip_name if [ $compile_project = true ]; then - cd ./$unzip_name/samples/API-Example + cd ./$unzip_name/samples/${ios_direction} ./cloud_build.sh || exit 1 cd - fi diff --git a/.github/ci/build/build_mac.sh b/.github/ci/build/build_mac.sh index 00444a1ee..a9c0fa1ee 100644 --- a/.github/ci/build/build_mac.sh +++ b/.github/ci/build/build_mac.sh @@ -51,26 +51,37 @@ echo short_version: $short_version echo pwd: `pwd` echo sdk_url: $sdk_url -zip_name=${sdk_url##*/} -echo zip_name: $zip_name - -curl -o $zip_name $sdk_url || exit 1 -7za x ./$zip_name -y > log.txt - -unzip_name=`ls -S -d */ | grep Agora` -echo unzip_name: $unzip_name - -rm -rf ./$unzip_name/bin -rm ./$unzip_name/commits -rm ./$unzip_name/package_size_report.txt -mkdir ./$unzip_name/samples +unzip_name=Agora_Native_SDK_for_iOS_FULL +zip_name=output.zip +sdk_url_flag=false +echo zip_name: $zip_name +if [ -z "$sdk_url" ]; then + sdk_url_flag=false + echo "sdk_url is empty" + echo unzip_name: $unzip_name + mkdir ./$unzip_name/samples + cp -rf ./macOS ./$unzip_name/samples/APIExample || exit 1 + ls -al ./$unzip_name/samples/API-Example/ +else + sdk_url_flag=true + zip_name=${sdk_url##*/} + echo unzip_name: $unzip_name + curl -o $zip_name $sdk_url || exit 1 + 7za x ./$zip_name -y > log.txt + unzip_name=`ls -S -d */ | grep Agora` + echo unzip_name: $unzip_name -cp -rf ./macOS ./$unzip_name/samples/APIExample || exit 1 -ls -al ./$unzip_name/samples/API-Example/ -mv ./$unzip_name/samples/APIExample/sdk.podspec ./$unzip_name/ -python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample/Podfile + rm -rf ./$unzip_name/bin + rm ./$unzip_name/commits + rm ./$unzip_name/package_size_report.txt + mkdir ./$unzip_name/samples + cp -rf ./macOS ./$unzip_name/samples/APIExample || exit 1 + ls -al ./$unzip_name/samples/API-Example/ + mv ./$unzip_name/samples/APIExample/sdk.podspec ./$unzip_name/ +fi +python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample/Podfile $sdk_url_flag 7za a -tzip result.zip -r $unzip_name cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name diff --git a/.github/ci/build/modify_podfile.py b/.github/ci/build/modify_podfile.py index c9ad317ec..787d9c7a8 100644 --- a/.github/ci/build/modify_podfile.py +++ b/.github/ci/build/modify_podfile.py @@ -1,13 +1,15 @@ import os, sys -def modfiy(path): +def modfiy(path, sdk_flag): with open(path, 'r', encoding='utf-8') as file: contents = [] for num, line in enumerate(file): if "pod 'Agora" in line: - line = '\t'+"pod 'sdk', :path => '../../sdk.podspec'" + "\n" + if sdk_flag: + line = '\t'+"pod 'sdk', :path => '../../sdk.podspec'" + "\n" elif "pod 'sdk" in line: - line = "" + if sdk_flag: + line = "" elif 'sh .download_script' in line: line = line.replace('true', 'false') + "\n" contents.append(line) @@ -19,6 +21,8 @@ def modfiy(path): fw.close() + if __name__ == '__main__': - path = sys.argv[1:][0] - modfiy(path.strip()) + path = sys.argv[1] + sdk_url_is_not_empty = sys.argv[2].lower() == 'true' + modfiy(path.strip(), sdk_url_is_not_empty) diff --git a/iOS/APIExample/cloud_build.sh b/iOS/APIExample/cloud_build.sh index e784bbc55..876662738 100755 --- a/iOS/APIExample/cloud_build.sh +++ b/iOS/APIExample/cloud_build.sh @@ -40,7 +40,7 @@ echo "work space: $WORKSPACE" echo "project path: $PROJECT_PATH" -pod install || exit 1 +pod install --repo-update || exit 1 # 打包环境 CONFIGURATION="Debug"