1. The Summary of the Problem
I would like a Travis CI setup that would let me run flutter driver
tests inside an Android and an iOS environments. For this to happen, I expect I somehow have to install Flutter, Android and iOS in different environments.
2. What I Have So Far
Most of the posts I've been able to find on this topic are terribly outdated or feature incredibly complicated setups. Some of those that keep on appearing in my searches are:
Test Flutter apps on Travis, by Yegor Jbanov. This one covers unit and widget testing (
flutter test
), but not integration tests.It's from early 2017 and Travis CI has maybe simplified its API, because I've managed to make it work with only this:
language: dart dart: - stable dart_task: - dartfmt install: - git clone https://github.com/flutter/flutter.git -b stable script: - ./flutter/bin/flutter doctor - ./flutter/bin/flutter test
- One resource that I've found very useful is the
.travis.yml
in the Flutter samples repo. The setup there seems very complicated to me though. - The closest I could get to what I wanted is similar to Maurice McCabe's Flutter unit, widget and integration testing with IOS and Android emulators on Travis-CI.
- Again, this seems overcomplicated and outdated.
3. The Sketch of What I Have in Mind
The script
and install
steps in the example I mentioned previously could be replaced by jobs
with stage
s. In this way, each stage would represent one sort of step. Unit and Widget stages in one, integration tests on Android and iOS in two others, which is similar to what Maurice McCabe and Flutter samples show. For example:
jobs:
include:
- stage: Flutter Test
language: dart
os: linux
install: git clone $FLUTTER_GITHUB -b stable
before_script:
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter test
- stage: Integration Test on Android
os: linux
dist: trusty
language: android
android: # the things here are what probably needs to be fixed
components:
- build-tools-28.0.3
- android-28
install: git clone $FLUTTER_GITHUB -b stable
before_script:
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter drive --target=test_driver/app.dart
If I could create a stage
for the dartfmt
task that would also be nice in terms of organization.