From ea2d2cd6311f4519946f626401dffa92b23bbe57 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Wed, 10 Feb 2021 12:49:34 +0100 Subject: [PATCH] updated .cirrus.yml --- .cirrus.yml | 38 +++++++++++++++++----------- scripts/android-wait-for-emulator.sh | 23 +++++++++++++++++ test.sh => scripts/test.sh | 9 ++++--- 3 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 scripts/android-wait-for-emulator.sh rename test.sh => scripts/test.sh (65%) diff --git a/.cirrus.yml b/.cirrus.yml index f323c729..a5aa8a97 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,4 +1,9 @@ task: + only_if: $CIRRUS_PR == '' + skip: '!changesInclude(".cirrus.yml")' + env: + ANDROID_EMULATOR_API_LEVEL: 30 + ANDROID_ABI: "google_apis;x86" # Xcode 12 task osx_instance: image: big-sur-xcode-12.4 @@ -29,7 +34,7 @@ task: # - xcrun simctl list # - xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-12 com.apple.CoreSimulator.SimRuntime.iOS-14-4 | xargs xcrun simctl boot # - flutter channel $CHANNEL -# - ./test.sh $(ipconfig getifaddr en0) +# - ./scripts/test.sh $(ipconfig getifaddr en0) - name: test_plugin_android env: matrix: @@ -37,19 +42,22 @@ task: #CHANNEL: "dev" #CHANNEL: "beta" #CHANNEL: "stable" - create_avd_script: - - mkdir -p .android && touch ~/.android/repositories.cfg - - sdkmanager --list - - sdkmanager "system-images;android-30;google_apis;x86" - - (yes || true) | sdkmanager --licenses - - OUTPUT_AVD=$(avdmanager create avd --force -n Flutter-Android -k "system-images;android-30;google_apis;x86" --device "Nexus 6P") - - echo $OUTPUT_AVD - - emulator -list-avds + install_images_script: + #- mkdir -p .android && touch ~/.android/repositories.cfg + #- sdkmanager --list + - sdkmanager "system-images;android-$ANDROID_EMULATOR_API_LEVEL;$ANDROID_ABI" + #- (yes || true) | sdkmanager --licenses + create_device_script: + echo no | avdmanager create avd --force -n test -k "system-images;android-$EMULATOR_API_LEVEL;$ANDROID_ABI" start_emulator_background_script: - - emulator -avd Flutter-Android -no-audio -no-window + $ANDROID_SDK_HOME/emulator/emulator-headless -VERBOSE -avd TEST -no-audio -no-window + pub_cache: + folder: ~/.pub-cache wait_for_emulator_script: - - adb wait-for-device - - adb shell input keyevent 82 - script: - - flutter channel $CHANNEL - - ./test.sh $(ipconfig getifaddr en0) + #- adb wait-for-device + - ./scripts/android-wait-for-emulator.sh + #- adb shell input keyevent 82 + flutter_change_channel_script: flutter channel $CHANNEL + doctor_script: flutter doctor -v + devices_script: flutter devices + script: ./scripts/test.sh $(ipconfig getifaddr en0) diff --git a/scripts/android-wait-for-emulator.sh b/scripts/android-wait-for-emulator.sh new file mode 100644 index 00000000..3bf64e64 --- /dev/null +++ b/scripts/android-wait-for-emulator.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set +e + +bootanim="" +failcounter=0 +timeout_in_sec=360 + +until [[ "$bootanim" =~ "stopped" ]]; do + bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &` + if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline" + || "$bootanim" =~ "running" ]]; then + let "failcounter += 1" + echo "Waiting for emulator to start: $failcounter of $timeout_in_sec : status: $bootanim" + 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 "Emulator is ready" \ No newline at end of file diff --git a/test.sh b/scripts/test.sh similarity index 65% rename from test.sh rename to scripts/test.sh index ad97e1c5..16d9476e 100755 --- a/test.sh +++ b/scripts/test.sh @@ -1,5 +1,8 @@ #!/bin/bash +readonly SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +readonly PROJECT_DIR="$(dirname $SCRIPT_PATH)" + function error() { echo "$@" 1>&2 } @@ -8,13 +11,13 @@ function error() { export NODE_SERVER_IP=$1 FAILED=0 -dart tool/env.dart +dart $PROJECT_DIR/tool/env.dart -cd nodejs_server_test_auth_basic_and_ssl +cd $PROJECT_DIR/nodejs_server_test_auth_basic_and_ssl node index.js & flutter clean -cd ../example +cd $PROJECT_DIR/example flutter clean flutter driver --driver=test_driver/integration_test.dart --target=integration_test/webview_flutter_test.dart