Commit 49f8bfe7 authored by Ivan Del Pino's avatar Ivan Del Pino Committed by Alexander Salas Bastidas
Browse files

ci(test): add test instrumentation to Firebase


Signed-off-by: default avatarIvan Del Pino <idelpino@teclib.com>
parent 19c9dcc6
......@@ -21,41 +21,9 @@ jobs:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "glpi/build.gradle" }}
test_api_v25:
working_directory: ~/flyve_mdm
docker:
- image: circleci/android:api-26-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- run:
name: Setup gradle properties
command: source ci/scripts/ci_gradle_properties.sh
- run:
name: Setup emulator
command: sdkmanager "system-images;android-25;google_apis;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-25;google_apis;armeabi-v7a"
- run:
name: Launch emulator
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
background: true
- run:
name: Wait emulator
command: |
# wait for it to have booted
circle-android wait-for-boot
# unlock the emulator screen
sleep 30
adb shell input keyevent 82
- run:
name: Run Tests
command: ./gradlew connectedAndroidTest
- store_artifacts:
path: glpi/build/reports
destination: reports
- store_test_results:
path: glpi/build/test-results
test_api_v16:
# Test Instrumentation with Android 4.1 JELLY_BEAN API 16
test_instrumentation:
working_directory: ~/flyve_mdm
docker:
- image: circleci/android:api-26-alpha
......@@ -64,31 +32,24 @@ jobs:
steps:
- checkout
- run:
name: Setup gradle properties
command: source ci/scripts/ci_gradle_properties.sh
- run:
name: Setup emulator
command: sdkmanager "system-images;android-16;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-16;default;armeabi-v7a"
name: Validate
command: source ci/scripts/ci_validate_workflow.sh
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "glpi/build.gradle" }}
- run:
name: Launch emulator
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
background: true
name: Download Android Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "glpi/build.gradle" }}
- run:
name: Wait emulator
command: |
# wait for it to have booted
circle-android wait-for-boot
# unlock the emulator screen
sleep 30
adb shell input keyevent 82
name: Create debug apk
command: ./gradlew assembleAndroidTest assemble
- run:
name: Run Tests
command: ./gradlew connectedAndroidTest
- store_artifacts:
path: glpi/build/reports
destination: reports
- store_test_results:
path: glpi/build/test-results
name: Run Tests on Firebase test lab
command: source ci/scripts/google_cloud.sh
deploy_production:
working_directory: ~/flyve_mdm
docker:
......@@ -179,24 +140,16 @@ workflows:
build_test_and_deploy:
jobs:
- build
- test_api_v16:
requires:
- build
filters:
branches:
only:
- develop
- test_api_v25:
requires:
- build
filters:
branches:
only:
- develop
# - test_instrumentation:
# requires:
# - build
# filters:
# branches:
# ignore:
# - master
- documentation:
requires:
- test_api_v16
- test_api_v25
# requires:
# - test_instrumentation
filters:
branches:
only:
......
#!/usr/bin/env bash
#
# LICENSE
#
# This file is part of Flyve MDM Agent for Android.
#
# Flyve MDM Agent for Android is a subproject of Flyve MDM. Flyve MDM is a mobile
# device management software.
#
# Flyve MDM is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# Flyve MDM Agent for Android is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# --------------------------------------------------------------------------------
# @author Ivan del Pino - <idelpino@teclib.com>
# @copyright Copyright (c) Teclib'
# @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
# @link https://github.com/flyve-mdm/android-mdm-agent/
# @link http://flyve.org/android-mdm-agent/
# @link https://flyve-mdm.com/
# --------------------------------------------------------------------------------
#
# Since we will download a video, we require integrity checking with CRC32c
# But the crcmod installation in the docker image isn't using the module's C extension
# So, uninstall it and install again with the C extension
echo "y" | sudo pip uninstall crcmod
sudo pip install -U crcmod
# create json key file
#echo $GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > ${HOME}/gcloud-service-key.json
echo ${GCLOUD_SERVICE_KEY} > ${HOME}/gcp-key.json
gcloud auth activate-service-account --key-file ${HOME}/gcp-key.json
gcloud --quiet config set project ${GCLOUD_PROJECT}
# Run Instrumented test
gcloud firebase test android run \
--type instrumentation \
--app ~/glpi/example_java/build/outputs/apk/androidTest/debug/example_java-debug-androidTest.apk \
--test ~/glpi/example_java/build/outputs/apk/debug/example_java-debug.apk \
--device model=Nexus6,version=25,locale=en,orientation=portrait \
--timeout 90s
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment