mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-21 13:48:11 +00:00
update gitlab-ci
This commit is contained in:
parent
e2af1d543e
commit
63ac9d543f
2 changed files with 56 additions and 37 deletions
|
|
@ -28,19 +28,18 @@ job-android-uitests:
|
|||
- mkdir logs && mkdir reports && mkdir apks
|
||||
|
||||
#define adb tcp port
|
||||
- RUNNING_DEVICES=$(${ANDROID_HOME}/platform-tools/adb devices)
|
||||
- while [[ $RUNNING_DEVICES == *$emulator_adb_port* ]]; do emulator_adb_port=$(($emulator_adb_port + 2)); done
|
||||
- while ${ANDROID_HOME}/platform-tools/adb devices | grep -q $emulator_adb_port; do emulator_adb_port=$(($emulator_adb_port + 2)); done
|
||||
- if [ $emulator_adb_port -gt 5586 ]; then echo "|warning| the 15 recommended ports are already used by other emulators. ADB may not function properly for this emulator"; fi
|
||||
- emulator_name=$emulator_name-$emulator_adb_port
|
||||
|
||||
#install emulator system-image and create it
|
||||
- ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "$android_system_image" > logs/emulatorSystemImageInstallation.log
|
||||
- echo no | ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager --verbose create avd --force --name $emulator_name --package $android_system_image --tag google_$emulator_type --abi $system_architecture --device $emulator_device > logs/emulatorCreation.log
|
||||
- ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "$android_system_image" > logs/emulator.log
|
||||
- echo no | ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager --verbose create avd --force --name $emulator_name --package $android_system_image --tag google_$emulator_type --abi $system_architecture --device $emulator_device >> logs/emulator.log
|
||||
|
||||
#launch emulator
|
||||
- ${ANDROID_HOME}/platform-tools/adb start-server
|
||||
- ${ANDROID_HOME}/emulator/emulator -avd $emulator_name -port $emulator_adb_port &
|
||||
- .gitlab-ci-files/wait-for-android-emulator -d emulator-$emulator_adb_port
|
||||
- ${ANDROID_HOME}/emulator/emulator -avd $emulator_name -port $emulator_adb_port >> logs/emulator.log 2>&1 &
|
||||
- .gitlab-ci-files/wait-for-android-emulator -d emulator-$emulator_adb_port -m start
|
||||
|
||||
- ${ANDROID_HOME}/platform-tools/adb -s emulator-$emulator_adb_port logcat -d > logs/logcats.log
|
||||
|
||||
|
|
@ -49,26 +48,27 @@ job-android-uitests:
|
|||
|
||||
#launch uitest suites
|
||||
- export JAVA_HOME=`/usr/libexec/java_home -v 11`
|
||||
- ANDROID_SERIAL=emulator-$emulator_adb_port
|
||||
- ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.linphone.testsuites.CallTestSuite -PscreportWindowed=false connectedAndroidTest --continue
|
||||
- export BUILD_RESULT=$?
|
||||
- export ANDROID_SERIAL=emulator-$emulator_adb_port
|
||||
- ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.linphone.testsuites.CallTestSuite -PscreportWindowed=false connectedAndroidTest --continue 2>&1 | tee logs/build.log
|
||||
- BUILD_RESULT=$?
|
||||
|
||||
#kill emultator (twice in case a confirm dialog popup appears)
|
||||
- ${ANDROID_HOME}/platform-tools/adb -s emulator-$emulator_adb_port emu kill
|
||||
- ${ANDROID_HOME}/platform-tools/adb -s emulator-$emulator_adb_port emu kill
|
||||
- ${ANDROID_HOME}/platform-tools/adb kill-server
|
||||
- ${ANDROID_HOME}/platform-tools/adb -s emulator-$emulator_adb_port emu kill
|
||||
- .gitlab-ci-files/wait-for-android-emulator -d emulator-$emulator_adb_port -m stop
|
||||
|
||||
- if [ $BUILD_RESULT -eq 0 ] && [ ! -d app/build/reports/androidTests/connected/failures ]; then exit 0; else exit 1; fi
|
||||
#delete emulator
|
||||
- ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager --verbose delete avd --name $emulator_name >> logs/emulator.log
|
||||
- if ${ANDROID_HOME}/platform-tools/adb devices | grep -q "emulator-"; then ${ANDROID_HOME}/platform-tools/adb kill-server; fi
|
||||
|
||||
- if [ $BUILD_RESULT -eq 0 ] && ! grep -q "BUILD FAILED" logs/build.log && [ ! -d app/build/reports/androidTests/connected/failures ]; then exit 0; else exit 1; fi
|
||||
|
||||
after_script:
|
||||
#artifacts preparation
|
||||
- mv app/build/reports/androidTests/connected/* reports
|
||||
- mv app/build/outputs/apk/debug/linphone-android-debug-*.apk ./apks/debug
|
||||
- mv app/build/outputs/apk/release/linphone-android-release-*.apk ./apks/release
|
||||
- mv app/build/reports/androidTests/connected/* reports
|
||||
- .gitlab-ci-files/html2xml-report -p reports
|
||||
|
||||
#delete emulator
|
||||
- ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager --verbose delete avd --name $emulator_name > logs/emulatorDeletion.log
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
|
|
|
|||
|
|
@ -7,31 +7,50 @@ failcounter=0
|
|||
|
||||
adb="${ANDROID_HOME}/platform-tools/adb"
|
||||
device="emulator-5554"
|
||||
mode="start"
|
||||
timeout_in_sec=360
|
||||
|
||||
while getopts a:d:t flag; do
|
||||
while getopts a:d:m:t flag; do
|
||||
case "${flag}" in
|
||||
a) adb=${OPTARG};;
|
||||
d) device=${OPTARG};;
|
||||
t) timeout_in_sec=${OPTARG};;
|
||||
a) adb=${OPTARG};;
|
||||
d) device=${OPTARG};;
|
||||
m) mode=${OPTARG};;
|
||||
t) timeout_in_sec=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
until [[ "$bootanim" =~ "stopped" ]]; do
|
||||
bootanim=`$adb -s $device -e shell getprop init.svc.bootanim 2>&1 &`
|
||||
if [[ "$bootanim" =~ "device '$device' not found" || "$bootanim" =~ "device '$device' offline"
|
||||
|| "$bootanim" =~ "running" ]]; then
|
||||
let "failcounter += 1"
|
||||
if [[ $failcounter = 1 ]]; then
|
||||
echo -n "Waiting for $device to start"; else
|
||||
echo -n "."
|
||||
fi
|
||||
if [[ $failcounter -gt timeout_in_sec ]]; then
|
||||
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
case "${mode}" in
|
||||
|
||||
echo "$device is ready"
|
||||
start)
|
||||
until [[ "$bootanim" =~ "stopped" ]]; do
|
||||
bootanim=$($adb -s $device -e shell getprop init.svc.bootanim 2>&1 &)
|
||||
if [[ "$bootanim" =~ "device '$device' not found" || "$bootanim" =~ "device offline" || "$bootanim" =~ "running" ]]; then
|
||||
let "failcounter += 1"
|
||||
if [[ $failcounter = 1 ]]; then
|
||||
echo -n "Waiting for $device to start"; else
|
||||
echo -n "."
|
||||
fi
|
||||
if [[ $failcounter -gt timeout_in_sec ]]; then
|
||||
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "$device is ready"
|
||||
;;
|
||||
|
||||
stop)
|
||||
while $adb devices | grep -q "$device"; do
|
||||
let "failcounter += 1"
|
||||
if [[ $failcounter = 1 ]]; then
|
||||
echo -n "Waiting for $device to stop"; else
|
||||
echo -n "."
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "$device is off"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue