Skip to content

Commit d9d124d

Browse files
author
zhangwei
committed
[Android] update ci
1 parent 8c7cdc5 commit d9d124d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

.github/ci/build/build_android.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ buildUtils = new agora.build.BuildUtils()
77

88
compileConfig = [
99
"sourceDir": "api-examples",
10-
"docker": "hub.agoralab.co/server/apiexample_build_android:latest",
1110
"non-publish": [
1211
"command": "./.github/ci/build/build_android.sh",
1312
"extraArgs": "",
@@ -64,4 +63,4 @@ def doPublish(buildVariables) {
6463
sh "rm -rf *.zip *.apk || true"
6564
}
6665

67-
pipelineLoad(this, "ApiExample", "build", "android", "apiexample_linux")
66+
pipelineLoad(this, "ApiExample", "build", "android", "RTC-Sample")

.github/ci/build/build_android.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# 'platform: string',
1818
# 'BUILD_NUMBER: string',
1919
# 'WORKSPACE: string'
20+
# 'compress_apiexample:boolean:false'
2021
#
2122
# --- Test Related: ---
2223
# PR build, zip test related to test.zip
@@ -49,10 +50,9 @@ echo release_version: $release_version
4950
echo short_version: $short_version
5051
echo pwd: `pwd`
5152
echo sdk_url: $sdk_url
52-
53+
echo compress_apiexample: $compress_apiexample
5354
unzip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT
5455
zip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT.zip
55-
5656
if [ -z "$sdk_url" ] || [ "$sdk_url" == "none" ]; then
5757
echo "sdk_url is empty"
5858
echo unzip_name: $unzip_name
@@ -74,22 +74,25 @@ else
7474
rm ./$unzip_name/rtc/package_size_report.txt
7575
rm -rf ./$unzip_name/pom
7676
fi
77-
mkdir -p ./$unzip_name/rtc/samples
78-
cp -rf ./Android/${android_direction} ./$unzip_name/rtc/samples/${android_direction} || exit 1
7977

80-
if [ $generate_project = true ]; then
81-
if [ $is_cn = true ]; then
82-
cd ./$unzip_name/rtc/samples/${android_direction} || exit 1
83-
sed -ie "s#google()#maven { url \"https\://maven.aliyun.com/repository/public\" }\n google()#g" settings.gradle
84-
sed -ie "s#https://services.gradle.org/distributions#https://mirrors.cloud.tencent.com/gradle#g" gradle/wrapper/gradle-wrapper.properties
85-
cd $WORKSPACE # 返回工作目录
86-
fi
78+
# Create API-Example directory and copy files
79+
mkdir -p ./$unzip_name/rtc/samples
80+
cp -rf ./Android/${android_direction} ./$unzip_name/rtc/samples/API-Example || exit 1
8781

88-
7za a -tzip result.zip -r $unzip_name > log.txt
89-
mv result.zip $WORKSPACE/${android_direction}_${BUILD_NUMBER}_$zip_name
82+
# Decide how to package based on compress_apiexample parameter
83+
if [ "$compress_apiexample" = "true" ]; then
84+
# Only compress API-Example code
85+
echo "Only compressing API-Example code"
86+
mkdir -p ./temp_apiexample/rtc/samples
87+
cp -rf ./$unzip_name/rtc/samples/API-Example ./temp_apiexample/rtc/samples/ || exit 1
88+
7za a -tzip result.zip -r temp_apiexample > log.txt
89+
rm -rf ./temp_apiexample
90+
mv result.zip $WORKSPACE/apiExample_${BUILD_NUMBER}_$zip_name
9091
else
92+
# Compress the entire SDK including API-Example
93+
echo "Compressing the entire SDK including API-Example"
9194
7za a -tzip result.zip -r $unzip_name > log.txt
92-
mv result.zip $WORKSPACE/${android_direction}_${BUILD_NUMBER}_$zip_name
95+
mv result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
9396
fi
9497

9598
if [ $compile_project = true ]; then
@@ -99,12 +102,10 @@ if [ $compile_project = true ]; then
99102
source ~/.bashrc
100103
export ANDROID_HOME=/usr/lib/android_sdk
101104
echo ANDROID_HOME: $ANDROID_HOME
102-
cd ./$unzip_name/rtc/samples/${android_direction} || exit 1
105+
cd ./$unzip_name/rtc/samples/API-Example || exit 1
103106
if [ -z "$sdk_url" ] || [ "$sdk_url" == "none" ]; then
104107
./cloud_build.sh false || exit 1
105108
else
106109
./cloud_build.sh true || exit 1
107110
fi
108-
fi
109-
110-
111+
fi

0 commit comments

Comments
 (0)