-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'task/CID-338_specific_branches_jobs' into 'develop'
CHT-1167 Specific branches jobs Closes CHT-1167 See merge request megachat/MEGAchat!1837
- Loading branch information
Showing
2 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
jenkinsfile/specific_branches/MEGAChat_crossAndroid_develop.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
pipeline { | ||
agent { label 'linux && amd64 && android' } | ||
options { | ||
buildDiscarder(logRotator(numToKeepStr: '135', daysToKeepStr: '21')) | ||
gitLabConnection('GitLabConnectionJenkins') | ||
} | ||
environment { | ||
APIURL_TO_TEST = "https://g.api.mega.co.nz/" | ||
ANDROID_BRANCH = "develop" | ||
SDK_BRANCH = "develop" | ||
MEGACHAT_BRANCH = "develop" | ||
|
||
} | ||
stages { | ||
stage('Checkout SDK MEGAchat and Android'){ | ||
steps { | ||
deleteDir() | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: "origin/${env.ANDROID_BRANCH}"]], | ||
userRemoteConfigs: [[ url: "git@code.developers.mega.co.nz:mobile/android/android.git", credentialsId: "12492eb8-0278-4402-98f0-4412abfb65c1" ]], | ||
extensions: [ | ||
[$class: "UserIdentity",name: "jenkins", email: "jenkins@jenkins"] | ||
] | ||
]) | ||
dir("sdk/src/main/jni/megachat/sdk"){ | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: "origin/${env.MEGACHAT_BRANCH}"]], | ||
userRemoteConfigs: [[ url: "git@code.developers.mega.co.nz:megachat/MEGAchat.git", credentialsId: "12492eb8-0278-4402-98f0-4412abfb65c1" ]], | ||
extensions: [ | ||
[$class: "UserIdentity",name: "jenkins", email: "jenkins@jenkins"], | ||
] | ||
]) | ||
script{ | ||
megachat_sources_workspace = WORKSPACE | ||
} | ||
} | ||
dir('sdk/src/main/jni/mega/sdk'){ | ||
sh "echo Cloning SDK branch ${env.SDK_BRANCH}" | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: "origin/${env.SDK_BRANCH}"]], | ||
userRemoteConfigs: [[ url: "git@code.developers.mega.co.nz:sdk/sdk.git", credentialsId: "12492eb8-0278-4402-98f0-4412abfb65c1" ]], | ||
extensions: [ | ||
[$class: "UserIdentity",name: "jenkins", email: "jenkins@jenkins"] | ||
] | ||
]) | ||
script{ | ||
sdk_sources_workspace = WORKSPACE | ||
} | ||
} | ||
script{ | ||
android_sources_workspace = WORKSPACE | ||
sdk_sources_workspace = "${megachat_sources_workspace}/third-party/mega" | ||
} | ||
} | ||
} | ||
stage('Download prebuilt third-party-sources'){ | ||
steps { | ||
dir("sdk/src/main/jni"){ | ||
sh "jf rt download third-party-sources-sdk/3rdparty-sdk.tar.gz ." | ||
sh "tar -xf 3rdparty-sdk.tar.gz --skip-old-files" | ||
} | ||
} | ||
} | ||
stage('Build MEGACHAT SDK and Android App'){ | ||
environment{ | ||
BUILD_ARCHS = "arm64-v8a" | ||
ANDROID_HOME = "/home/jenkins/android-cmdlinetools/" | ||
ANDROID_NDK_HOME ="/home/jenkins/android-ndk/" | ||
DEFAULT_GOOGLE_MAPS_API_PATH = "/home/jenkins/android-default_google_maps_api" | ||
ANDROID_WEBRTC="/home/jenkins/android-webrtc" | ||
USE_PREBUILT_SDK = false | ||
ARTIFACTORY_BASE_URL = "${env.REPOSITORY_URL}" | ||
} | ||
steps{ | ||
dir("sdk/src/main/jni"){ | ||
script{ | ||
env.PATH="${env.PATH}:${env.ANDROID_HOME}/cmdline-tools/tools/bin/" | ||
} | ||
sh """ | ||
ln -sfrT ${ANDROID_WEBRTC} megachat/webrtc | ||
sed -i 's#JOBS=.*#JOBS=1#' build.sh | ||
sed -i 's#LOG_FILE=/dev/null#LOG_FILE=/dev/stdout#g' build.sh | ||
./build.sh all | ||
""" | ||
} | ||
sh "cp -r ${DEFAULT_GOOGLE_MAPS_API_PATH}/* app/src/" | ||
script { | ||
withCredentials([ | ||
string(credentialsId: 'ARTIFACTORY_USER', variable: 'ARTIFACTORY_USER'), | ||
string(credentialsId: 'ARTIFACTORY_ACCESS_TOKEN', variable: 'ARTIFACTORY_ACCESS_TOKEN'), | ||
]){ | ||
sh "./gradlew --no-daemon --max-workers=1 assembleGms" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
// vim: syntax=groovy tabstop=4 shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
pipeline { | ||
agent { label 'linux && amd64 && webrtc' } | ||
options { | ||
timeout(time: 300, unit: 'MINUTES') | ||
buildDiscarder(logRotator(numToKeepStr: '135', daysToKeepStr: '21')) | ||
gitLabConnection('GitLabConnectionJenkins') | ||
} | ||
environment { | ||
APIURL_TO_TEST = "https://g.api.mega.co.nz/" | ||
SDK_BRANCH = "develop" | ||
TESTS_PARALLEL = "--INSTANCES:10" | ||
} | ||
stages { | ||
stage('Checkout SDK and MEGAchat'){ | ||
steps { | ||
deleteDir() | ||
checkout scm | ||
dir('third-party/mega'){ | ||
sh "echo Cloning SDK branch ${SDK_BRANCH}" | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: "origin/${SDK_BRANCH}"]], | ||
userRemoteConfigs: [[ url: "git@code.developers.mega.co.nz:sdk/sdk.git", credentialsId: "12492eb8-0278-4402-98f0-4412abfb65c1" ]], | ||
extensions: [ | ||
[$class: "UserIdentity",name: "jenkins", email: "jenkins@jenkins"] | ||
] | ||
]) | ||
} | ||
script{ | ||
megachat_sources_workspace = WORKSPACE | ||
sdk_sources_workspace = "${megachat_sources_workspace}/third-party/mega" | ||
} | ||
} | ||
} | ||
stage('Build MEGAchat'){ | ||
environment{ | ||
WEBRTC_SRC="/home/jenkins/webrtc/src" | ||
PATH = "/home/jenkins/tools/depot_tools:${env.PATH}" | ||
} | ||
steps{ | ||
dir(megachat_sources_workspace){ | ||
sh """ | ||
sed -i "s#MEGAChatTest#${env.USER_AGENT_TESTS}#g" tests/sdk_test/sdk_test.h | ||
mkdir -p build | ||
""" | ||
} | ||
dir(sdk_sources_workspace){ | ||
sh """ | ||
./autogen.sh | ||
./configure --disable-tests --enable-chat --enable-shared --without-pdfium --without-ffmpeg | ||
sed -i "s#nproc#echo 1#" bindings/qt/build_with_webrtc.sh | ||
cd bindings/qt && bash build_with_webrtc.sh all withExamples | ||
""" | ||
} | ||
|
||
} | ||
} | ||
stage('Run MEGAchat and SDK tests'){ | ||
environment { | ||
MEGA_PWD0 = credentials('MEGA_PWD_DEFAULT') | ||
MEGA_PWD1 = credentials('MEGA_PWD_DEFAULT') | ||
MEGA_PWD2 = credentials('MEGA_PWD_DEFAULT') | ||
} | ||
steps{ | ||
lock(label: 'SDK_Concurrent_Test_Accounts', variable: 'ACCOUNTS_COMBINATION', quantity: 1, resource: null){ | ||
dir("${megachat_sources_workspace}/build/subfolder"){ | ||
script{ | ||
env.MEGA_EMAIL0 = "${env.ACCOUNTS_COMBINATION}" | ||
echo "${env.ACCOUNTS_COMBINATION}" | ||
} | ||
sh """#!/bin/bash | ||
ulimit -c unlimited | ||
${megachat_sources_workspace}/build/MEGAchatTests/megachat_tests --USERAGENT:${env.USER_AGENT_TESTS} --APIURL:${APIURL_TO_TEST} ${TESTS_PARALLEL} 2>&1 | tee tests.stdout | ||
[ \"\${PIPESTATUS[0]}\" != \"0\" ] && FAILED=1 | ||
if [ -n "\$FAILED" ]; then | ||
echo "Test failed with status \$FAILED" | ||
maxTime=10 | ||
startTime=`date +%s` | ||
# Only a single core file can be handled, for either sequential or parallel run | ||
while [ \$( expr `date +%s` - \$startTime ) -lt \$maxTime ]; do | ||
if [ -e \"core\" ]; then | ||
echo "Processing core dump..." | ||
echo thread apply all bt > backtrace | ||
echo quit >> backtrace | ||
gdb -q ${megachat_sources_workspace}/build/MEGAchatTests/megachat_tests core -x ${megachat_sources_workspace}/build/subfolder/backtrace | ||
tar chvzf core.tar.gz core megachat_tests | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
fi | ||
gzip -c test.log > test_${BUILD_ID}.log.gz || : | ||
rm test.log || : | ||
if [ ! -z "\$FAILED" ]; then | ||
false | ||
fi | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
archiveArtifacts artifacts: "build/subfolder/test*.log*" | ||
} | ||
} | ||
} | ||
// vim: syntax=groovy tabstop=4 shiftwidth=4 |