Skip to content

Dev/android ci #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/ci/build/build_android.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildUtils = new agora.build.BuildUtils()

compileConfig = [
"sourceDir": "api-examples",
"docker": "hub.agoralab.co/server/apiexample_build_android:latest",
"non-publish": [
"command": "./.github/ci/build/build_android.sh",
"extraArgs": "",
Expand Down Expand Up @@ -64,4 +63,4 @@ def doPublish(buildVariables) {
sh "rm -rf *.zip *.apk || true"
}

pipelineLoad(this, "ApiExample", "build", "android", "apiexample_linux")
pipelineLoad(this, "ApiExample", "build", "android", "RTC-Sample")
29 changes: 18 additions & 11 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
##################################
export PATH=$PATH:/opt/homebrew/bin

echo Package_Publish: $Package_Publish
echo is_tag_fetch: $is_tag_fetch
Expand Down Expand Up @@ -68,22 +69,29 @@ else

rm -rf ./$unzip_name/rtc/bin
rm -rf ./$unzip_name/rtc/demo
rm ./$unzip_name/rtc/commits
rm ./$unzip_name/rtc/package_size_report.txt
rm -f ./$unzip_name/.commits
rm -f ./$unzip_name/spec
rm -rf ./$unzip_name/pom
fi
mkdir -p ./$unzip_name/rtc/samples
cp -rf ./Android/${android_direction} ./$unzip_name/rtc/samples/API-Example || exit 1

mkdir -p ./$unzip_name/rtc/samples/API-Example || exit 1

if [ -d "./Android/${android_direction}" ]; then
cp -rf ./Android/${android_direction}/* ./$unzip_name/rtc/samples/API-Example/ || exit 1
else
echo "Error: Source directory ./Android/${android_direction} does not exist"
exit 1
fi

7za a -tzip result.zip -r $unzip_name > log.txt
mv result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name

if [ $compress_apiexample = true ]; then
7za a -tzip result_onlyAPIExample.zip -r ./$unzip_name/rtc/samples/API-Example >> log.txt
mv result_onlyAPIExample.zip $WORKSPACE/onlyAPIExample_${BUILD_NUMBER}_$zip_name
fi

if [ $compile_project = true ]; then
# install android sdk
which java
java --version
source ~/.bashrc
export ANDROID_HOME=/usr/lib/android_sdk
echo ANDROID_HOME: $ANDROID_HOME
cd ./$unzip_name/rtc/samples/API-Example || exit 1
if [ -z "$sdk_url" ] || [ "$sdk_url" = "none" ]; then
./cloud_build.sh false || exit 1
Expand All @@ -92,4 +100,3 @@ if [ $compile_project = true ]; then
fi
fi


29 changes: 23 additions & 6 deletions Android/APIExample-Audio/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,31 @@ ls ~/.gradle || (mkdir -p /tmp/.gradle && ln -s /tmp/.gradle ~/.gradle && touch
## use open jdk 17
SYSTEM=$(uname -s)
if [ "$SYSTEM" = "Linux" ];then
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
fi
export JAVA_HOME=/tmp/jdk-17.0.2
export ANDROID_HOME=/usr/lib/android_sdk
elif [ "$SYSTEM" = "Darwin" ];then
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export ANDROID_HOME=${ANDROID_HOME:-$HOME/Library/Android/sdk}
fi
export JAVA_HOME=/tmp/jdk-17.0.2

export PATH=$JAVA_HOME/bin:$PATH
java --version
java --version || { echo "Error: Failed to get Java version"; exit 1; }

# Configure environment
if [ "$SYSTEM" = "Linux" ];then
[ -f ~/.bashrc ] && source ~/.bashrc
else
# Try to load zsh config first, if not found then try bash_profile
if [ -f ~/.zshrc ]; then
source ~/.zshrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
fi

#change android maven to china repos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip
14 changes: 8 additions & 6 deletions Android/APIExample-Audio/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
pluginManagement {
repositories {
maven { url "https://maven.aliyun.com/repository/public" }
google()
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url "https://maven.aliyun.com/repository/public" }
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://maven.aliyun.com/repository/public" }
}
}
rootProject.name='APIExample-Audio'
rootProject.name = 'APIExample-Audio'
include ':app'
33 changes: 27 additions & 6 deletions Android/APIExample-Compose/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,37 @@ ls ~/.gradle || (mkdir -p /tmp/.gradle && ln -s /tmp/.gradle ~/.gradle && touch
## use open jdk 17
SYSTEM=$(uname -s)
if [ "$SYSTEM" = "Linux" ];then
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
fi
export JAVA_HOME=/tmp/jdk-17.0.2
export ANDROID_HOME=/usr/lib/android_sdk
elif [ "$SYSTEM" = "Darwin" ];then
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export ANDROID_HOME=${ANDROID_HOME:-$HOME/Library/Android/sdk}
fi
export JAVA_HOME=/tmp/jdk-17.0.2

export PATH=$JAVA_HOME/bin:$PATH
java --version
java --version || { echo "Error: Failed to get Java version"; exit 1; }

# Configure environment
if [ "$SYSTEM" = "Linux" ];then
[ -f ~/.bashrc ] && source ~/.bashrc
else
# Try to load zsh config first, if not found then try bash_profile
if [ -f ~/.zshrc ]; then
source ~/.zshrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
fi

#change android maven to china repos
sed -ie "s#google()#maven { url \"https\://maven.aliyun.com/repository/public\" }\n google()#g" settings.gradle
sed -ie "s#https://services.gradle.org/distributions#https://mirrors.cloud.tencent.com/gradle#g" gradle/wrapper/gradle-wrapper.properties

## config appId
if [ ! -f "local.properties" ];then
touch local.properties
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 23:59:46 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.7-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 0 additions & 2 deletions Android/APIExample-Compose/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
maven { url = uri("https://maven.aliyun.com/repository/public") }
google {
content {
includeGroupByRegex("com\\.android.*")
Expand All @@ -15,7 +14,6 @@ pluginManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url = uri("https://maven.aliyun.com/repository/public") }
google()
mavenCentral()
}
Expand Down
29 changes: 23 additions & 6 deletions Android/APIExample/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,31 @@ ls ~/.gradle || (mkdir -p /tmp/.gradle && ln -s /tmp/.gradle ~/.gradle && touch
## use open jdk 17
SYSTEM=$(uname -s)
if [ "$SYSTEM" = "Linux" ];then
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
if [ ! -d "/tmp/jdk-17.0.2" ];then
curl -O https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar zxf openjdk-17.0.2_linux-x64_bin.tar.gz
mv jdk-17.0.2 /tmp/
fi
export JAVA_HOME=/tmp/jdk-17.0.2
export ANDROID_HOME=/usr/lib/android_sdk
elif [ "$SYSTEM" = "Darwin" ];then
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
export ANDROID_HOME=${ANDROID_HOME:-$HOME/Library/Android/sdk}
fi
export JAVA_HOME=/tmp/jdk-17.0.2

export PATH=$JAVA_HOME/bin:$PATH
java --version
java --version || { echo "Error: Failed to get Java version"; exit 1; }

# Configure environment
if [ "$SYSTEM" = "Linux" ];then
[ -f ~/.bashrc ] && source ~/.bashrc
else
# Try to load zsh config first, if not found then try bash_profile
if [ -f ~/.zshrc ]; then
source ~/.zshrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
fi

#change android maven to china repos
Expand Down
11 changes: 8 additions & 3 deletions Android/APIExample/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
pluginManagement {
repositories {
google()
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
Expand All @@ -10,14 +16,13 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven {
url 'http://maven.faceunity.com/repository/maven-public/'
allowInsecureProtocol = true
}
}
}
rootProject.name='APIExample'
rootProject.name = 'APIExample'
include ':app'
if (simpleFilter.toBoolean()) {
include ':agora-simple-filter'
Expand Down
Loading