Skip to content

Instantly share code, notes, and snippets.

@psygo
Last active April 18, 2020 17:30
Show Gist options
  • Save psygo/f19a1775794458e5cf6db2670572b34c to your computer and use it in GitHub Desktop.
Save psygo/f19a1775794458e5cf6db2670572b34c to your computer and use it in GitHub Desktop.
Travis Flutter Integration Tests (Android Integration Tests not working | Code Coverage is not separated for this Mono Repo Setup)
# This is part of a custom mono repo setup I have.
# The folder structure is basically divided into an `app` and a `packages` folders.
# Codecov logging to codecov.io should be improved. Right now, it overwrites the previous one.
# Everything works except for the last stage, the Android Integration Tests.
# Working to make the Android tests work seems like a nightmare because of different
# versions incompatibility, something Apple does much better.
language: dart
env:
global:
- DARTSDK=./flutter/bin/cache/dart-sdk/bin
- DARTFMT=$DARTSDK/dartfmt
- FLUTTER=./flutter/bin/flutter
- FLUTTER_UP=../flutter/bin/flutter
- FLUTTER_GITHUB=https://github.com/flutter/flutter.git
- CODECOV=https://codecov.io/bash
- PACKAGES=packages
- APP=app
- ANDROID_API=28
install:
- git clone $FLUTTER_GITHUB -b stable --depth 1
- $FLUTTER doctor
- $FLUTTER pub get
jobs:
include:
- stage: Formatting
script:
- $DARTFMT -n $PACKAGES --set-exit-if-changed
- stage: Packages' Flutter Test
script:
- $FLUTTER test --coverage $PACKAGES
after_success:
- bash <(curl -s $CODECOV)
- stage: App's Flutter Test
script:
- cd $APP
- $FLUTTER_UP test --coverage
after_success:
- bash <(curl -s $CODECOV)
- stage: iOS Integration Tests
os: osx
osx_image: xcode11
before_script:
- open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
- export HOMEBREW_NO_AUTO_UPDATE=1
- brew install libimobiledevice
- brew install ideviceinstaller
- brew install ios-deploy
- brew install cocoapods || echo 'ignore exit(1)'
- brew link --overwrite cocoapods
script:
- cd $APP
- $FLUTTER_UP driver --target=test_driver/app.dart77
- stage: Android Integration Tests
language: android
dist: trusty
android:
components:
- tools
- platform-tools
- build-tools-25.0.3
- android-24
- android-22
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- sys-img-armeabi-v7a-android-22
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_install:
- yes | sdkmanager "platforms;android-28"
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 32M
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb devices
- adb shell input keyevent 82 &
script:
- $FLUTTER --version
- $FLUTTER doctor
- cd $APP
- $FLUTTER_UP devices
- $FLUTTER_UP driver --target=test_driver/app.dart
@psygo
Copy link
Author

psygo commented Apr 18, 2020

Stick to everything but the iOS and Android Integration Tests if you want to be more practical. Unless integration tests are crucial to your app of course...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment