Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

172 ios deploy #179

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ ios_integration_task:
pub_cache:
folder: ~/.pub-cache
simulators_script:
- sh -c "ios-deploy -c" || echo "no attached devices"
- xcrun simctl list devicetypes
- xcrun simctl list runtimes
simulators_json_script:
- xcrun simctl list devices --json
imagemagick_install_script:
- brew install imagemagick
# skip homebrew update
- export HOMEBREW_NO_AUTO_UPDATE=1
- brew install imagemagick || echo -n # ignore error in auto-update
- convert -version || echo -n
doctor_script: flutter doctor -v
activate_script: pub global activate --source path .
Expand Down
27 changes: 17 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: generic
env:
global:
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.9.1+hotfix.6-${FLUTTER_CHANNEL}
- DART_VERSION=2.5.0 # for unit tests
- FLUTTER_VERSION=1.12.13+hotfix.5-${FLUTTER_CHANNEL}
- DART_VERSION=2.7.0 # for unit tests

matrix:
fast_finish: true
Expand Down Expand Up @@ -82,9 +82,14 @@ jobs:

install:
- flutter doctor -v
- flutter precache
- sh -c "ios-deploy -c" || echo "no attached devices"


# install ImageMagick
- export HOMEBREW_NO_AUTO_UPDATE=1
- brew install imagemagick

# install most current (released or unreleased) Screenshots
- pub global activate --source path .

Expand Down Expand Up @@ -125,8 +130,8 @@ jobs:
cache:
directories:
- ${HOME}/.pub-cache
# - ${HOME}/.gradle/caches/
# - ${HOME}/.gradle/wrapper/
- ${HOME}/.gradle/caches/
- ${HOME}/.gradle/wrapper/

before_install:
# envs
Expand All @@ -140,11 +145,12 @@ jobs:
- TOOLS=${ANDROID_HOME}/tools
# PATH order is incredibly important. e.g. the 'emulator' script exists in more than one place!
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- FLUTTER_CHANNEL=stable
- FLUTTER_VERSION=1.9.1+hotfix.6-${FLUTTER_CHANNEL}
# - FLUTTER_CHANNEL=stable
# - FLUTTER_VERSION=1.9.1+hotfix.6-${FLUTTER_CHANNEL}
- FLUTTER_HOME=${HOME}/flutter
- PATH=${HOME}/.pub-cache/bin:${PATH}
- PATH=${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}
- EMULATOR_NAME=NEXUS_6P_API_28

- java -version

Expand Down Expand Up @@ -187,7 +193,7 @@ jobs:

# Create an Android emulator
# - echo no | avdmanager --verbose create avd --force -n test -k "system-images;android-$API;$GOO;$ABI" -c 10M
- echo no | avdmanager --verbose create avd --force -n test -k "system-images;android-$API;$GOO;$ABI"
- echo no | avdmanager --verbose create avd --force -n $EMULATOR_NAME -k "system-images;android-$API;$GOO;$ABI"
# - EMU_PARAMS="
# -verbose
# -no-snapshot
Expand All @@ -199,12 +205,13 @@ jobs:
# -selinux permissive
# -qemu -m 2048"
- EMU_PARAMS="
-avd test
-avd $EMULATOR_NAME
-no-window
-no-audio
-verbose
"
# - EMU_COMMAND="emulator"
- EMU_COMMAND="emulator-headless"
# - EMU_COMMAND="emulator-headless"
- EMU_COMMAND="emulator"
# This double "sudo" monstrosity is used to have Travis execute the
# emulator with its new group permissions and help preserve the rule
# of least privilege.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/daemon_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ List getIosDevices() {
.trim()
.split('\n')
.sublist(1);
if (iosDeployDevices.isEmpty || iosDeployDevices[0] == noAttachedDevices) {
if (iosDeployDevices[0] == noAttachedDevices) {
return [];
}
return iosDeployDevices.map((line) {
Expand Down
50 changes: 50 additions & 0 deletions test/daemon_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,56 @@ main() {
expect(emulator1, isNot(equals(device1)));
});
});

group('getIosDevices', (){
FakeProcessManager fakeProcessManager;
FakePlatform fakePlatform;

setUp(() {
fakeProcessManager = FakeProcessManager();
fakePlatform = FakePlatform.fromPlatform(const LocalPlatform())
..operatingSystem = 'macos';
});

testUsingContext('no real device',(){
fakeProcessManager.calls = [
Call(
'sh -c ios-deploy -c || echo "no attached devices"',
ProcessResult(
0,
0,
'[....] Waiting up to 5 seconds for iOS device to be connected\nno attached devices',
'')),
];
final iosDevices = getIosDevices();
expect(iosDevices, isEmpty);
fakeProcessManager.verifyCalls();
}, overrides: <Type, Generator>{
ProcessManager: () => fakeProcessManager,
Platform: () => fakePlatform,
});

testUsingContext('real device',(){
final uuid='uuid';
final model = 'model';
final expected = [{'id': uuid, 'model': model}];
fakeProcessManager.calls = [
Call(
'sh -c ios-deploy -c || echo "no attached devices"',
ProcessResult(
0,
0,
"[....] Waiting up to 5 seconds for iOS device to be connected\n[....] Found $uuid (N69uAP, $model, iphoneos, arm64) a.k.a. 'My iPhone' connected through USB.",
'')),
];
final iosDevices = getIosDevices();
expect(iosDevices, expected);
fakeProcessManager.verifyCalls();
}, overrides: <Type, Generator>{
ProcessManager: () => fakeProcessManager,
Platform: () => fakePlatform,
});
});
}

class MockProcess extends Mock implements Process {}
Expand Down