fastlane-plugin-mango 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5e9db6561834f87bc0a4c5607f7ca117532d38d35f846ed6a389e16c7da3223
4
- data.tar.gz: fbdff88d36c647a249c76c58a9345e5aee75a23bc231ffcd01f86986bad41357
3
+ metadata.gz: 5d0630bacbd9e12bef129c250ba6c97b6feae538c137484e0da99bfd383d1fd8
4
+ data.tar.gz: 3709bd848bfb4a787d9913f31f4e31a8e87c71f3d5d695c7ba7ae44de9f205e0
5
5
  SHA512:
6
- metadata.gz: 3e015e871f2eceac9afb44618dab0023819f96d3066d709b540f2e7fdd4a830c970897d192f6ac0ac36a73d06fffb7992805a1ccc8f813439d3144d3a7abf569
7
- data.tar.gz: 077d01545b646eea107ac015b1d7f847d8ffe41a66f1c33786ae0318d39b71e7ae6321564b9a420121f86c0676ae1150ce42774c57e00240694324fcb912f522
6
+ metadata.gz: 8841f8d082ec685bc41ff3bd2e2f277e1a91ce43040c903d2bc20959f573b7e86a6946d5e64f07c1f7e6d274d3ea704ee9a65689d55cdb890f6f2c68c7f69418
7
+ data.tar.gz: 61e8e0b4125beb580fbdd5f23e1bb89fa460b140df2b830ef11a4e5444ac0306af112c3c9091458f2bc8877dcb6d85568bd70cf36400e7f4c2369b605eca4c97
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-mango) [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/xing/mango/blob/master/LICENSE)
5
5
  [![Gem](https://img.shields.io/gem/v/fastlane-plugin-mango.svg?style=flat)](http://rubygems.org/gems/fastlane-plugin-mango)
6
6
 
7
- A fastlane plugin that runs Android tasks on a specified [Docker](https://www.docker.com/) image
7
+ A fastlane plugin that runs Android tasks on a specified [Docker](https://www.docker.com/) image. Can be used for orchestrating android tasks on a CI system.
8
8
 
9
9
  <img src="assets/mango_logo.png" alt="Mango Logo" width="256px" height="256px"/>
10
10
 
@@ -47,19 +47,26 @@ desc "Run espresso tests on docker images"
47
47
  end
48
48
  ```
49
49
 
50
- or to this for unit tests or other gradle tasks:
50
+ or to this for unit tests or other gradle tasks(some of the variables are optional):
51
51
  ```ruby
52
52
  desc "Run unit tests on docker images"
53
- lane :Unit_Tests do
54
- run_dockerized_task(
55
- container_name: "unit_tests_container",
56
- port_factor: options[:port_factor],
57
- docker_image: "joesss/mango-base:latest",
58
- is_running_on_emulator: false,
59
- android_task: "./gradlew testDebug",
60
- pull_latest_image: true
61
- )
62
- end
53
+ lane :example do
54
+ run_dockerized_task(
55
+ container_name: "emulator_#{options[:port_factor]}",
56
+ port_factor: options[:port_factor],
57
+ docker_image: 'joesss/mango-base:latest',
58
+ android_task: './gradlew testDebug',
59
+ post_actions: 'adb logcat -d > logcat.txt',
60
+ bundle_install: true,
61
+ core_amount: '8',
62
+ workspace_dir: '/root/tests/espresso-tests',
63
+ docker_registry_login: "docker login -u='USER' -p='PASS' some.docker.com",
64
+ pull_latest_image: true,
65
+ pre_action: 'echo $GIT_BRANCH > /root/.branch',
66
+ vnc_enabled: false,
67
+ environment_variables: options[:environment_variables] ? options[:environment_variables].split(' ') : ''
68
+ )
69
+ end
63
70
  ```
64
71
 
65
72
  Now you can call this new lane by calling `bundle exec fastlane Espresso_Tests`.
@@ -11,6 +11,7 @@ module Fastlane
11
11
  mango_helper.setup_container
12
12
 
13
13
  docker_commander = Helper::DockerCommander.new(mango_helper.container_name)
14
+ Helper::EmulatorLanguage.set(params[:emulator_language], docker_commander) if params[:emulator_language]
14
15
 
15
16
  failure_buffer_timeout = 5
16
17
  timeout_command = "timeout #{params[:maximal_run_time] - failure_buffer_timeout}m"
@@ -202,6 +203,12 @@ module Fastlane
202
203
  description: 'A bool. True for vnc_enabled False for vnc_disabled',
203
204
  type: Boolean,
204
205
  default_value: true,
206
+ optional: true),
207
+
208
+ FastlaneCore::ConfigItem.new(key: :emulator_language,
209
+ env_name: 'EMULATOR_LANGUAGE',
210
+ description: 'A string that identify a device locale (e.g. de_DE)',
211
+ type: String,
205
212
  optional: true)
206
213
  ]
207
214
  end
@@ -43,6 +43,10 @@ module Fastlane
43
43
 
44
44
  def delete_container
45
45
  Actions.sh("docker rm -f #{container_name}") if container_name
46
+ rescue StandardError
47
+ sleep 5
48
+ UI.important('Was not able to delete the container after the first attempt, trying again')
49
+ retry
46
50
  end
47
51
 
48
52
  def disconnect_network_bridge
@@ -64,6 +68,10 @@ module Fastlane
64
68
  end
65
69
  end
66
70
 
71
+ def cp(file:)
72
+ Actions.sh("docker cp #{file} #{container_name}:/root/tests/.")
73
+ end
74
+
67
75
  def prune
68
76
  Action.sh('docker system prune -f')
69
77
  end
@@ -0,0 +1,30 @@
1
+ require 'timeout'
2
+
3
+ module Fastlane
4
+ module Helper
5
+ module EmulatorLanguage
6
+ def self.set(lang, docker_commander)
7
+ UI.important("Changing device locale to #{lang}")
8
+
9
+ retries ||= 5
10
+ language = lang.split('_')[0]
11
+ country = lang.split('_')[1]
12
+ apk_path = File.join(File.dirname(__FILE__), 'settings.apk')
13
+ docker_commander.cp(file: apk_path)
14
+
15
+ Timeout.timeout(20) do
16
+ docker_commander.exec(command: 'adb install /root/tests/settings.apk')
17
+ docker_commander.exec(command: 'adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION')
18
+ docker_commander.exec(command: "adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang #{language} --es country #{country}")
19
+ end
20
+ rescue StandardError => e
21
+ raise e if retries.zero?
22
+
23
+ puts "Got an exception: #{e.message}. Will retry in 5 seconds"
24
+ retries -= 1
25
+ sleep 5
26
+ retry
27
+ end
28
+ end
29
+ end
30
+ end
@@ -210,7 +210,7 @@ module Fastlane
210
210
  all_containers = Docker::Container.all(all: true)
211
211
 
212
212
  all_containers.each do |container|
213
- if container.info['Names'].first[1..] == container_name
213
+ if container.info['Names'].first[1..-1] == container_name
214
214
  @container = container
215
215
  return true
216
216
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Mango
3
- VERSION = '1.3.23'.freeze
3
+ VERSION = '1.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-mango
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.23
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret, Daniel Hartwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-20 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docker-api
@@ -149,7 +149,9 @@ files:
149
149
  - lib/fastlane/plugin/mango/helper/cpu_load_handler.rb
150
150
  - lib/fastlane/plugin/mango/helper/docker_commander.rb
151
151
  - lib/fastlane/plugin/mango/helper/emulator_commander.rb
152
+ - lib/fastlane/plugin/mango/helper/emulator_language.rb
152
153
  - lib/fastlane/plugin/mango/helper/mango_helper.rb
154
+ - lib/fastlane/plugin/mango/helper/settings.apk
153
155
  - lib/fastlane/plugin/mango/version.rb
154
156
  homepage: https://github.com/xing/mango
155
157
  licenses:
@@ -170,8 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
172
  - !ruby/object:Gem::Version
171
173
  version: '0'
172
174
  requirements: []
173
- rubygems_version: 3.1.2
175
+ rubygems_version: 3.2.32
174
176
  signing_key:
175
177
  specification_version: 4
176
- summary: This plugin Android tasks on docker images
178
+ summary: This plugin orchtestrates Android tasks on docker images
177
179
  test_files: []