Skip to content

Commit

Permalink
Merge pull request #436 from AgoraIO/dev/4.5.0-CI
Browse files Browse the repository at this point in the history
Dev/4.5.0 ci
  • Loading branch information
tamworth authored Oct 31, 2024
2 parents 1937ee0 + 70f247a commit bcb589a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 44 deletions.
53 changes: 32 additions & 21 deletions .github/ci/build/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 28 additions & 17 deletions .github/ci/build/build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 9 additions & 5 deletions .github/ci/build/modify_podfile.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
2 changes: 1 addition & 1 deletion iOS/APIExample/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bcb589a

Please sign in to comment.