Skip to content

Commit

Permalink
Merge pull request #304 from AgoraIO/dev/4.0.1
Browse files Browse the repository at this point in the history
Dev/4.0.1
  • Loading branch information
plutoless authored Sep 29, 2022
2 parents d4be906 + 7ce11fd commit 09bc8eb
Show file tree
Hide file tree
Showing 167 changed files with 6,153 additions and 1,020 deletions.
5 changes: 4 additions & 1 deletion .github/ci/build/build_android.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildUtils = new agora.build.BuildUtils()

compileConfig = [
"sourceDir": "api-examples",
"docker": "null",
"non-publish": [
"command": "./.github/ci/build/build_android.sh",
"extraArgs": "",
Expand All @@ -25,12 +26,14 @@ def doBuild(buildVariables) {
command = compileConfig.get(type).command
preCommand = compileConfig.get(type).get("preCommand", "")
postCommand = compileConfig.get(type).get("postCommand", "")
docker = compileConfig.docker
extraArgs = compileConfig.get(type).extraArgs
extraArgs += " " + params.getOrDefault("extra_args", "")
commandConfig = [
"command": command,
"sourceRoot": "${compileConfig.sourceDir}",
"extraArgs": extraArgs,
"docker": docker,
]
loadResources(["config.json", "artifactory_utils.py"])
buildUtils.customBuild(commandConfig, preCommand, postCommand)
Expand All @@ -53,4 +56,4 @@ def doPublish(buildVariables) {
sh "rm -rf *.zip || true"
}

pipelineLoad(this, "ApiExample", "build", "android", "apiexample_linux")
pipelineLoad(this, "ApiExample", "build", "android", "apiexample_linux")
5 changes: 3 additions & 2 deletions .github/ci/build/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# pr: output test.zip to workspace dir
# others: Rename the zip package name yourself, But need copy it to workspace dir
##################################

echo Package_Publish: $Package_Publish
echo is_tag_fetch: $is_tag_fetch
echo arch: $arch
Expand Down Expand Up @@ -77,7 +78,7 @@ mkdir ./$unzip_name/rtc/samples/API-example
cp -rf ./Android/APIExample$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/-A/g')/** ./$unzip_name/rtc/samples/API-example

7za a -tzip result.zip -r $unzip_name
cp result.zip $WORKSPACE/withAPIExample_$zip_name
mv result.zip $WORKSPACE/withAPIExample_$(date "+%d%H%M")_$zip_name

# install android sdk
which java
Expand Down Expand Up @@ -125,7 +126,7 @@ sed -i -e "s#jniLibs/#jniLibs2/#g" agora-simple-filter/src/main/cpp/CMakeLists.t
./gradlew :app:assembleDebug
cp app/build/outputs/apk/debug/app-debug.apk ./APIExample_Android_$(date "+%y%m%d%H").apk
7za a -tzip result.zip -r *.apk
cp result.zip $WORKSPACE/APIExample_Android$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/_A/g')_apk.zip
mv result.zip $WORKSPACE/APIExample_Android$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only | cut -d "_" -f 1 | sed -e 's/a/_A/g')_$(date "+%y%m%d%H%M")_apk.zip
ls $WORKSPACE
cd -

2 changes: 1 addition & 1 deletion .github/ci/build/build_ios.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def doPublish(buildVariables) {
sh "rm -rf *.zip || true"
}

pipelineLoad(this, "ApiExample", "build", "ios", "apiexample_linux")
pipelineLoad(this, "ApiExample", "build", "ios", "apiexample_mac")
30 changes: 25 additions & 5 deletions .github/ci/build/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ rm ./$unzip_name/commits
rm ./$unzip_name/package_size_report.txt
mkdir ./$unzip_name/samples
mkdir ./$unzip_name/samples/API-Example
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi

cp -rf ./iOS/** ./$unzip_name/samples/API-Example

result=$(echo $sdk_url | grep "audio")
Expand All @@ -74,17 +81,30 @@ then
rm -rf ./$unzip_name/samples/API-Example/APIExample
mv ./$unzip_name/samples/API-Example/APIExample-Audio ./$unzip_name/samples/APIExample-Audio
mv ./$unzip_name/samples/APIExample-Audio/sdk.podspec ./$unzip_name/
sed -i "s|pod 'sdk', :path => 'sdk.podspec'|pod 'sdk', :path => '../../sdk.podspec'|" ./$unzip_name/samples/APIExample-Audio/Podfile
sed -i "s|pod 'Agora|#pod 'Agora|" ./$unzip_name/samples/APIExample-Audio/Podfile
python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample-Audio/Podfile
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi
./.github/ci/build/build_ios_ipa.sh ./$unzip_name/samples/APIExample-Audio

else
echo "不包含"
rm -rf ./$unzip_name/samples/API-Example/APIExample-Audio
mv ./$unzip_name/samples/API-Example/APIExample ./$unzip_name/samples/APIExample
mv ./$unzip_name/samples/APIExample/sdk.podspec ./$unzip_name/
sed -i "s|pod 'sdk', :path => 'sdk.podspec'|pod 'sdk', :path => '../../sdk.podspec'|" ./$unzip_name/samples/APIExample/Podfile
sed -i "s|pod 'Agora|#pod 'Agora|" ./$unzip_name/samples/APIExample/Podfile
python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample/Podfile
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi
./.github/ci/build/build_ios_ipa.sh ./$unzip_name/samples/APIExample
fi

rm -rf ./$unzip_name/samples/API-Example
7za a -tzip result.zip -r $unzip_name
cp result.zip $WORKSPACE/withAPIExample_$zip_name
cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
118 changes: 118 additions & 0 deletions .github/ci/build/build_ios_ipa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
CURRENT_PATH=$PWD

# 获取项目目录
PROJECT_PATH="$( cd "$1" && pwd )"

cd ${PROJECT_PATH} && pod install

if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi

# 项目target名
TARGET_NAME=${PROJECT_PATH##*/}

KEYCENTER_PATH=${PROJECT_PATH}"/"${TARGET_NAME}"/Common/KeyCenter.swift"

# 打包环境
CONFIGURATION=Development

#工程文件路径
APP_PATH="${PROJECT_PATH}/${TARGET_NAME}.xcworkspace"

#工程配置路径
PBXPROJ_PATH="${PROJECT_PATH}/${TARGET_NAME}.xcodeproj/project.pbxproj"
echo PBXPROJ_PATH: $PBXPROJ_PATH

# 主项目工程配置
# Debug
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH
# Release
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH

# 屏幕共享Extension
# Debug
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH
# Release
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH

# SimpleFilter
# Debug
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1726AFFFA6002E1373:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1726AFFFA6002E1373:buildSettings:DEVELOPMENT_TEAM ''" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1726AFFFA6002E1373:buildSettings:PROVISIONING_PROFILE_SPECIFIER ''" $PBXPROJ_PATH
# Release
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1826AFFFA6002E1373:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1826AFFFA6002E1373:buildSettings:DEVELOPMENT_TEAM ''" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:8B10BE1826AFFFA6002E1373:buildSettings:PROVISIONING_PROFILE_SPECIFIER ''" $PBXPROJ_PATH

# 读取APPID环境变量
echo AGORA_APP_ID:$APP_ID
echo $AGORA_APP_ID

echo PROJECT_PATH: $PROJECT_PATH
echo TARGET_NAME: $TARGET_NAME
echo KEYCENTER_PATH: $KEYCENTER_PATH
echo APP_PATH: $APP_PATH

#修改Keycenter文件
python3 /tmp/jenkins/api-examples/.github/ci/build/modify_ios_keycenter.py $KEYCENTER_PATH 0
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi

# Xcode clean
xcodebuild clean -workspace "${APP_PATH}" -configuration "${CONFIGURATION}" -scheme "${TARGET_NAME}"

# 时间戳
CURRENT_TIME=$(date "+%Y-%m-%d %H-%M-%S")

# 归档路径
ARCHIVE_PATH="${PROJECT_PATH}/${TARGET_NAME} ${CURRENT_TIME}/${TARGET_NAME}.xcarchive"
# 编译环境

# 导出路径
EXPORT_PATH="${PROJECT_PATH}/${TARGET_NAME} ${CURRENT_TIME}"

# plist路径
PLIST_PATH="${PROJECT_PATH}/ExportOptions.plist"

echo PLIST_PATH: $PLIST_PATH

# archive 这边使用的工作区间 也可以使用project
xcodebuild archive -workspace "${APP_PATH}" -scheme "${TARGET_NAME}" -configuration "${CONFIGURATION}" -archivePath "${ARCHIVE_PATH}" -destination 'generic/platform=iOS'

# 导出ipa
xcodebuild -exportArchive -archivePath "${ARCHIVE_PATH}" -exportPath "${EXPORT_PATH}" -exportOptionsPlist "${PLIST_PATH}"

rm -rf "${EXPORT_PATH}/${TARGET_NAME}.xcarchive"
rm -rf "${EXPORT_PATH}/Packaging.log"
rm -rf "${EXPORT_PATH}/ExportOptions.plist"
rm -rf "${EXPORT_PATH}/DistributionSummary.plist"

#复原Keycenter文件
python3 /tmp/jenkins/api-examples/.github/ci/build/modify_ios_keycenter.py $KEYCENTER_PATH 1
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi




2 changes: 1 addition & 1 deletion .github/ci/build/build_mac.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def doPublish(buildVariables) {
sh "rm -rf *.zip || true"
}

pipelineLoad(this, "ApiExample", "build", "mac", "apiexample_linux")
pipelineLoad(this, "ApiExample", "build", "mac", "apiexample_mac")
25 changes: 19 additions & 6 deletions .github/ci/build/build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,25 @@ rm -rf ./$unzip_name/bin
rm ./$unzip_name/commits
rm ./$unzip_name/package_size_report.txt
mkdir ./$unzip_name/samples
mkdir ./$unzip_name/samples/API-Example
cp -rf ./macOS/** ./$unzip_name/samples/API-Example
mv ./$unzip_name/samples/API-Example/sdk.podspec ./$unzip_name/
sed -i "s|pod 'sdk', :path => 'sdk.podspec'|pod 'sdk', :path => '../../sdk.podspec'|" ./$unzip_name/samples/API-Example/Podfile
sed -i "s|pod 'Agora|#pod 'Agora|" ./$unzip_name/samples/API-Example/Podfile
mkdir ./$unzip_name/samples/APIExample
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi
cp -rf ./macOS/** ./$unzip_name/samples/APIExample
mv ./$unzip_name/samples/APIExample/sdk.podspec ./$unzip_name/
python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample/Podfile
if [ $? -eq 0 ]; then
echo "success"
else
echo "failed"
exit 1
fi

./.github/ci/build/build_mac_ipa.sh ./$unzip_name/samples/APIExample

7za a -tzip result.zip -r $unzip_name
# 7za a -tzip result.zip -r Agora_Native_SDK_for_Mac_FULL
cp result.zip $WORKSPACE/withAPIExample_$zip_name
cp result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
109 changes: 109 additions & 0 deletions .github/ci/build/build_mac_ipa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
CURRENT_PATH=$PWD

# 获取项目目录
PROJECT_PATH="$( cd "$1" && pwd )"

cd ${PROJECT_PATH} && pod install
if [ $? -eq 0 ]; then
echo " pod install success"
else
echo " pod install failed"
exit 1
fi

# 项目target名
TARGET_NAME=${PROJECT_PATH##*/}

KEYCENTER_PATH=${PROJECT_PATH}"/"${TARGET_NAME}"/Common/KeyCenter.swift"

# 打包环境
CONFIGURATION=developer-id

#工程文件路径
APP_PATH="${PROJECT_PATH}/${TARGET_NAME}.xcworkspace"

#工程配置路径
PBXPROJ_PATH="${PROJECT_PATH}/${TARGET_NAME}.xcodeproj/project.pbxproj"
echo PBXPROJ_PATH: $PBXPROJ_PATH

# 主项目工程配置
# Debug
/usr/libexec/PlistBuddy -c "Set :objects:03896D5324F8A011008593CD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5324F8A011008593CD:buildSettings:CODE_SIGN_IDENTITY 'Developer ID Application'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5324F8A011008593CD:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5324F8A011008593CD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexamplemac'" $PBXPROJ_PATH
# Release
/usr/libexec/PlistBuddy -c "Set :objects:03896D5424F8A011008593CD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5424F8A011008593CD:buildSettings:CODE_SIGN_IDENTITY 'Developer ID Application'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5424F8A011008593CD:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH
/usr/libexec/PlistBuddy -c "Set :objects:03896D5424F8A011008593CD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexamplemac'" $PBXPROJ_PATH

# SimpleFilter
# Debug
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7E272518D600E95B87:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7E272518D600E95B87:buildSettings:DEVELOPMENT_TEAM ''" $PBXPROJ_PATH
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7E272518D600E95B87:buildSettings:PROVISIONING_PROFILE_SPECIFIER ''" $PBXPROJ_PATH
# # Release
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7F272518D600E95B87:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7F272518D600E95B87:buildSettings:DEVELOPMENT_TEAM ''" $PBXPROJ_PATH
# /usr/libexec/PlistBuddy -c "Set :objects:8BD4AE7F272518D600E95B87:buildSettings:PROVISIONING_PROFILE_SPECIFIER ''" $PBXPROJ_PATH

# 读取APPID环境变量
echo AGORA_APP_ID:$APP_ID
echo $AGORA_APP_ID

echo PROJECT_PATH: $PROJECT_PATH
echo TARGET_NAME: $TARGET_NAME
echo KEYCENTER_PATH: $KEYCENTER_PATH
echo APP_PATH: $APP_PATH

#修改Keycenter文件

python3 /tmp/jenkins/api-examples/.github/ci/build/modify_ios_keycenter.py $KEYCENTER_PATH 0
if [ $? -eq 0 ]; then
echo "修改Keycenter文件 success"
else
echo "修改Keycenter文件 failed"
exit 1
fi
# Xcode clean
xcodebuild clean -workspace "${APP_PATH}" -configuration "${CONFIGURATION}" -scheme "${TARGET_NAME}"

# 时间戳
CURRENT_TIME=$(date "+%Y-%m-%d %H-%M-%S")

# 归档路径
ARCHIVE_PATH="${PROJECT_PATH}/${TARGET_NAME} ${CURRENT_TIME}/${TARGET_NAME}.xcarchive"
# 编译环境

# 导出路径
EXPORT_PATH="${PROJECT_PATH}/${TARGET_NAME} ${CURRENT_TIME}"

# plist路径
PLIST_PATH="${PROJECT_PATH}/ExportOptions.plist"

echo PLIST_PATH: $PLIST_PATH

# archive 这边使用的工作区间 也可以使用project
xcodebuild archive -workspace "${APP_PATH}" -scheme "${TARGET_NAME}" -configuration "${CONFIGURATION}" -archivePath "${ARCHIVE_PATH}" -destination 'generic/platform=macOS'

# 导出ipa
xcodebuild -exportArchive -archivePath "${ARCHIVE_PATH}" -exportPath "${EXPORT_PATH}" -exportOptionsPlist "${PLIST_PATH}"

rm -rf "${EXPORT_PATH}/${TARGET_NAME}.xcarchive"
rm -rf "${EXPORT_PATH}/Packaging.log"
rm -rf "${EXPORT_PATH}/ExportOptions.plist"
rm -rf "${EXPORT_PATH}/DistributionSummary.plist"

#复原Keycenter文件
python3 /tmp/jenkins/api-examples/.github/ci/build/modify_ios_keycenter.py $KEYCENTER_PATH 1
if [ $? -eq 0 ]; then
echo "复原Keycenter文件 success"
else
echo "复原Keycenter文件 failed"
exit 1
fi




4 changes: 2 additions & 2 deletions .github/ci/build/build_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ xcopy /Y /E windows\APIExample Agora_Native_SDK_for_Windows_FULL\samples\API-exa
xcopy /Y /E windows\README.md Agora_Native_SDK_for_Windows_FULL\samples\API-example
xcopy /Y /E windows\README.zh.md Agora_Native_SDK_for_Windows_FULL\samples\API-example
7z a -tzip result.zip -r Agora_Native_SDK_for_Windows_FULL
copy result.zip %WORKSPACE%\\withAPIExample_%zip_name%
copy result.zip %WORKSPACE%\\withAPIExample_%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%_%zip_name%
del /F result.zip
del /F %WORKSPACE%\\%zip_name%

Expand All @@ -94,6 +94,6 @@ echo "compile start..."
call installThirdParty.bat
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" "APIExample.sln" /p:platform="Win32" /p:configuration="Release"
7z a -tzip result.zip -r Release
copy result.zip %WORKSPACE%\\APIExample-windows.zip
copy result.zip %WORKSPACE%\\APIExample_windows_%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%_Release_exe.zip
del /F result.zip
echo "compile done."
Loading

0 comments on commit 09bc8eb

Please sign in to comment.