Skip to content

Commit 4e32c9b

Browse files
author
zhaoyongqiang
committed
Merge branch 'dev/4.0.1' of github.com:AgoraIO/API-Examples into dev/4.0.1
2 parents 0dfa5b2 + 8a35690 commit 4e32c9b

19 files changed

Lines changed: 652 additions & 46 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@Library('agora-build-pipeline-library') _
2+
3+
pipelineLoad(this, "ApiExample", "workflow", "", "", "api-examples")
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// -*- mode: groovy -*-
2+
// vim: set filetype=groovy :
3+
@Library('agora-build-pipeline-library') _
4+
import groovy.transform.Field
5+
6+
buildUtils = new agora.build.BuildUtils()
7+
8+
compileConfig = [
9+
"sourceDir": "api-examples",
10+
"non-publish": [
11+
"command": "./.github/ci/build/build_android.sh",
12+
"extraArgs": "",
13+
],
14+
"publish": [
15+
"command": "./.github/ci/build/build_android.sh",
16+
"extraArgs": "",
17+
]
18+
]
19+
20+
def doBuild(buildVariables) {
21+
preCommand = '''
22+
export ANDROID_NDK_ROOT="${HOME}/Library/Android/android-ndk-r21e"
23+
'''
24+
type = params.Package_Publish ? "publish" : "non-publish"
25+
command = compileConfig.get(type).command
26+
preCommand = compileConfig.get(type).get("preCommand", "")
27+
postCommand = compileConfig.get(type).get("postCommand", "")
28+
extraArgs = compileConfig.get(type).extraArgs
29+
extraArgs += " " + params.getOrDefault("extra_args", "")
30+
commandConfig = [
31+
"command": command,
32+
"sourceRoot": "${compileConfig.sourceDir}",
33+
"extraArgs": extraArgs,
34+
]
35+
loadResources(["config.json", "artifactory_utils.py"])
36+
buildUtils.customBuild(commandConfig, preCommand, postCommand)
37+
}
38+
39+
def doPublish(buildVariables) {
40+
if (!params.Package_Publish) {
41+
return
42+
}
43+
(shortVersion, releaseVersion) = buildUtils.getBranchVersion()
44+
def archiveInfos = [
45+
[
46+
"type": "ARTIFACTORY",
47+
"archivePattern": "*.zip",
48+
"serverPath": "ApiExample/${shortVersion}/${buildVariables.buildDate}/${env.platform}",
49+
"serverRepo": "SDK_repo"
50+
]
51+
]
52+
archive.archiveFiles(archiveInfos)
53+
sh "rm -rf *.zip || true"
54+
}
55+
56+
pipelineLoad(this, "ApiExample", "build", "android", "apiexample_linux")

.github/ci/build/build_android.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
##################################
2+
# --- Guidelines: ---
3+
#
4+
# Common Environment Variable Injected:
5+
# 'Package_Publish:boolean:true',
6+
# 'Clean_Clone:boolean:false',
7+
# 'is_tag_fetch:boolean:false',
8+
# 'is_offical_build:boolean:false',
9+
# 'repo:string',
10+
# 'base:string',
11+
# 'arch:string'
12+
# 'output:string'
13+
# 'short_version:string'
14+
# 'release_version:string'
15+
# 'build_date:string(yyyyMMdd)',
16+
# 'build_timestamp:string (yyyyMMdd_hhmm)',
17+
# 'platform: string',
18+
# 'BUILD_NUMBER: string',
19+
# 'WORKSPACE: string'
20+
#
21+
# --- Test Related: ---
22+
# PR build, zip test related to test.zip
23+
# Package build, zip package related to package.zip
24+
# --- Artifactory Related: ---
25+
# download artifactory:
26+
# python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL
27+
# upload file to artifactory:
28+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_pattern
29+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_pattern
30+
# upload folder to artifactory
31+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_folder
32+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_folder
33+
# --- Input: ----
34+
# sourcePath: see jenkins console for details.
35+
# WORKSPACE: ${WORKSPACE}
36+
# --- Output: ----
37+
# pr: output test.zip to workspace dir
38+
# others: Rename the zip package name yourself, But need copy it to workspace dir
39+
##################################
40+
41+
echo Package_Publish: $Package_Publish
42+
echo is_tag_fetch: $is_tag_fetch
43+
echo arch: $arch
44+
echo source_root: %source_root%
45+
echo output: /tmp/jenkins/${project}_out
46+
echo build_date: $build_date
47+
echo build_time: $build_time
48+
echo release_version: $release_version
49+
echo short_version: $short_version
50+
echo pwd: `pwd`
51+
echo sdk_url: $sdk_url
52+
53+
zip_name=${sdk_url##*/}
54+
echo zip_name: $zip_name
55+
56+
python3 $WORKSPACE/artifactory_utils.py --action=download_file --file=$sdk_url
57+
7za x ./$zip_name -y
58+
59+
unzip_name=`ls -S -d */ | grep Agora`
60+
echo unzip_name: $unzip_name
61+
62+
mv $unzip_name/rtc/** $unzip_name
63+
rm -rf $unzip_name/rtc
64+
rm -rf ./$unzip_name/bin
65+
rm -rf ./$unzip_name/demo
66+
rm ./$unzip_name/commits
67+
rm ./$unzip_name/package_size_report.txt
68+
mkdir ./$unzip_name/samples
69+
mkdir ./$unzip_name/samples/API-example
70+
cp -rf ./Android/** ./$unzip_name/samples/API-example
71+
7za a -tzip result.zip -r $unzip_name
72+
cp result.zip $WORKSPACE/withAPIExample_$zip_name

.github/ci/build/build_ios.groovy

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// -*- mode: groovy -*-
2+
// vim: set filetype=groovy :
3+
@Library('agora-build-pipeline-library') _
4+
import groovy.transform.Field
5+
6+
buildUtils = new agora.build.BuildUtils()
7+
8+
compileConfig = [
9+
"sourceDir": "api-examples",
10+
"non-publish": [
11+
"command": "./.github/ci/build/build_ios.sh",
12+
"extraArgs": "",
13+
],
14+
"publish": [
15+
"command": "./.github/ci/build/build_ios.sh",
16+
"extraArgs": "",
17+
]
18+
]
19+
20+
def doBuild(buildVariables) {
21+
type = params.Package_Publish ? "publish" : "non-publish"
22+
command = compileConfig.get(type).command
23+
preCommand = compileConfig.get(type).get("preCommand", "")
24+
postCommand = compileConfig.get(type).get("postCommand", "")
25+
extraArgs = compileConfig.get(type).extraArgs
26+
extraArgs += " " + params.getOrDefault("extra_args", "")
27+
commandConfig = [
28+
"command": command,
29+
"sourceRoot": "${compileConfig.sourceDir}",
30+
"extraArgs": extraArgs
31+
]
32+
loadResources(["config.json", "artifactory_utils.py"])
33+
buildUtils.customBuild(commandConfig, preCommand, postCommand)
34+
}
35+
36+
def doPublish(buildVariables) {
37+
if (!params.Package_Publish) {
38+
return
39+
}
40+
(shortVersion, releaseVersion) = buildUtils.getBranchVersion()
41+
def archiveInfos = [
42+
[
43+
"type": "ARTIFACTORY",
44+
"archivePattern": "*.zip",
45+
"serverPath": "ApiExample/${shortVersion}/${buildVariables.buildDate}/${env.platform}",
46+
"serverRepo": "SDK_repo" // ATTENTIONS: Update the artifactoryRepo if needed.
47+
]
48+
]
49+
archive.archiveFiles(archiveInfos)
50+
sh "rm -rf *.zip || true"
51+
}
52+
53+
pipelineLoad(this, "ApiExample", "build", "ios", "apiexample_linux")

.github/ci/build/build_ios.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
##################################
2+
# --- Guidelines: ---
3+
#
4+
# Common Environment Variable:
5+
# 'Package_Publish:boolean:true',
6+
# 'Clean_Clone:boolean:false',
7+
# 'is_tag_fetch:boolean:false',
8+
# 'is_offical_build:boolean:false',
9+
# 'repo:string',
10+
# 'base:string',
11+
# 'arch:string'
12+
# 'output:string'
13+
# 'short_version:string'
14+
# 'release_version:string'
15+
# 'build_date:string(yyyyMMdd)',
16+
# 'build_timestamp:string (yyyyMMdd_hhmm)',
17+
# 'platform: string',
18+
# 'BUILD_NUMBER: string',
19+
# 'WORKSPACE: string'
20+
#
21+
# --- Test Related: ---
22+
# PR build, zip test related to test.zip
23+
# Package build, zip package related to package.zip
24+
# --- Artifactory Related: ---
25+
# download artifactory:
26+
# python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL
27+
# upload file to artifactory:
28+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_pattern
29+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_pattern
30+
# upload folder to artifactory
31+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_folder
32+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_folder
33+
# --- Input: ----
34+
# sourcePath: see jenkins console for details.
35+
# WORKSPACE: ${WORKSPACE}
36+
# --- Output: ----
37+
# pr: output test.zip to workspace dir
38+
# others: Rename the zip package name yourself, But need copy it to workspace dir
39+
##################################
40+
41+
echo Package_Publish: $Package_Publish
42+
echo is_tag_fetch: $is_tag_fetch
43+
echo arch: $arch
44+
echo source_root: %source_root%
45+
echo output: /tmp/jenkins/${project}_out
46+
echo build_date: $build_date
47+
echo build_time: $build_time
48+
echo release_version: $release_version
49+
echo short_version: $short_version
50+
echo pwd: `pwd`
51+
echo sdk_url: $sdk_url
52+
53+
zip_name=${sdk_url##*/}
54+
echo zip_name: $zip_name
55+
56+
python3 $WORKSPACE/artifactory_utils.py --action=download_file --file=$sdk_url
57+
7za x ./$zip_name -y
58+
59+
unzip_name=`ls -S -d */ | grep Agora`
60+
echo unzip_name: $unzip_name
61+
62+
rm -rf ./$unzip_name/bin
63+
rm ./$unzip_name/commits
64+
rm ./$unzip_name/package_size_report.txt
65+
mkdir ./$unzip_name/samples
66+
mkdir ./$unzip_name/samples/API-example
67+
cp -rf ./iOS/** ./$unzip_name/samples/API-example
68+
7za a -tzip result.zip -r $unzip_name
69+
cp result.zip $WORKSPACE/withAPIExample_$zip_name

.github/ci/build/build_mac.groovy

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// -*- mode: groovy -*-
2+
// vim: set filetype=groovy :
3+
@Library('agora-build-pipeline-library') _
4+
import groovy.transform.Field
5+
6+
buildUtils = new agora.build.BuildUtils()
7+
8+
compileConfig = [
9+
"sourceDir": "api-examples",
10+
"non-publish": [
11+
"command": "./.github/ci/build/build_mac.sh",
12+
"extraArgs": "",
13+
],
14+
"publish": [
15+
"command": "./.github/ci/build/build_mac.sh",
16+
"extraArgs": "",
17+
]
18+
]
19+
20+
def doBuild(buildVariables) {
21+
type = params.Package_Publish ? "publish" : "non-publish"
22+
command = compileConfig.get(type).command
23+
preCommand = compileConfig.get(type).get("preCommand", "")
24+
postCommand = compileConfig.get(type).get("postCommand", "")
25+
extraArgs = compileConfig.get(type).extraArgs
26+
extraArgs += " " + params.getOrDefault("extra_args", "")
27+
commandConfig = [
28+
"command": command,
29+
"sourceRoot": "${compileConfig.sourceDir}",
30+
"extraArgs": extraArgs
31+
]
32+
loadResources(["config.json", "artifactory_utils.py"])
33+
buildUtils.customBuild(commandConfig, preCommand, postCommand)
34+
}
35+
36+
def doPublish(buildVariables) {
37+
if (!params.Package_Publish) {
38+
return
39+
}
40+
(shortVersion, releaseVersion) = buildUtils.getBranchVersion()
41+
def archiveInfos = [
42+
[
43+
"type": "ARTIFACTORY",
44+
"archivePattern": "*.zip",
45+
"serverPath": "ApiExample/${shortVersion}/${buildVariables.buildDate}/${env.platform}",
46+
"serverRepo": "SDK_repo" // ATTENTIONS: Update the artifactoryRepo if needed.
47+
]
48+
]
49+
archive.archiveFiles(archiveInfos)
50+
sh "rm -rf *.zip || true"
51+
}
52+
53+
pipelineLoad(this, "ApiExample", "build", "mac", "apiexample_linux")

.github/ci/build/build_mac.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
##################################
2+
# --- Guidelines: ---
3+
#
4+
# Common Environment Variable:
5+
# 'Package_Publish:boolean:true',
6+
# 'Clean_Clone:boolean:false',
7+
# 'is_tag_fetch:boolean:false',
8+
# 'is_offical_build:boolean:false',
9+
# 'repo:string',
10+
# 'base:string',
11+
# 'arch:string'
12+
# 'output:string'
13+
# 'short_version:string'
14+
# 'release_version:string'
15+
# 'build_date:string(yyyyMMdd)',
16+
# 'build_timestamp:string (yyyyMMdd_hhmm)',
17+
# 'platform: string',
18+
# 'BUILD_NUMBER: string',
19+
# 'WORKSPACE: string'
20+
#
21+
# --- Test Related: ---
22+
# PR build, zip test related to test.zip
23+
# Package build, zip package related to package.zip
24+
# --- Artifactory Related: ---
25+
# download artifactory:
26+
# python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL
27+
# upload file to artifactory:
28+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_pattern
29+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_pattern
30+
# upload folder to artifactory
31+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --server_path=SERVERPATH --server_repo=SERVER_REPO --with_folder
32+
# for example: python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --server_path=windows/ --server_repo=ACCS_repo --with_folder
33+
# --- Input: ----
34+
# sourcePath: see jenkins console for details.
35+
# WORKSPACE: ${WORKSPACE}
36+
# --- Output: ----
37+
# pr: output test.zip to workspace dir
38+
# others: Rename the zip package name yourself, But need copy it to workspace dir
39+
##################################
40+
41+
echo Package_Publish: $Package_Publish
42+
echo is_tag_fetch: $is_tag_fetch
43+
echo arch: $arch
44+
echo source_root: %source_root%
45+
echo output: /tmp/jenkins/${project}_out
46+
echo build_date: $build_date
47+
echo build_time: $build_time
48+
echo release_version: $release_version
49+
echo short_version: $short_version
50+
echo pwd: `pwd`
51+
echo sdk_url: $sdk_url
52+
53+
zip_name=${sdk_url##*/}
54+
echo zip_name: $zip_name
55+
56+
python3 $WORKSPACE/artifactory_utils.py --action=download_file --file=$sdk_url
57+
7za x ./$zip_name -y
58+
59+
rm -rf ./Agora_Native_SDK_for_Mac_FULL/bin
60+
rm ./Agora_Native_SDK_for_Mac_FULL/commits
61+
rm ./Agora_Native_SDK_for_Mac_FULL/package_size_report.txt
62+
mkdir ./Agora_Native_SDK_for_Mac_FULL/samples
63+
mkdir ./Agora_Native_SDK_for_Mac_FULL/samples/API-example
64+
cp -rf ./macOS/** ./Agora_Native_SDK_for_Mac_FULL/samples/API-example
65+
7za a -tzip result.zip -r Agora_Native_SDK_for_Mac_FULL
66+
cp result.zip $WORKSPACE/withAPIExample_$zip_name

0 commit comments

Comments
 (0)