fastlane-plugin-waldo 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +90 -0
- data/lib/fastlane/plugin/waldo/actions/waldo_action.rb +111 -0
- data/lib/fastlane/plugin/waldo/helper/waldo_helper.rb +112 -0
- data/lib/fastlane/plugin/waldo/version.rb +5 -0
- data/lib/fastlane/plugin/waldo.rb +16 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 38abd1a8b884b3bdd003f0a47c67ee37c095cc45
|
4
|
+
data.tar.gz: 5e9efe73fa5af9e54c7a79ff5a0d9d23b8da4878
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3967b095cfdc94934e33a5e50d99fe04627713fcf5525ece4cbe2f87bc9178151de361b2fde7af01cf0b8c2975eef44d0618524999999818c872f5d0c8ca5f40
|
7
|
+
data.tar.gz: af042c5e7bf2d08f643543311b035a438660eed2d464c0a74af1a0e927e93352ef22c2c85c33c8003ac78c04ce658218fc839dbe66a4bae98d4ebf3787ef04bd
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Amolo Atelier, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Waldo `fastlane` plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-waldo)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
8
|
+
get started with `fastlane-plugin-waldo`, add it to your project by running:
|
9
|
+
|
10
|
+
```bash
|
11
|
+
fastlane add_plugin waldo
|
12
|
+
```
|
13
|
+
|
14
|
+
## About Waldo
|
15
|
+
|
16
|
+
[Waldo](https://www.waldo.io) provides fast, reliable, and maintainable tests
|
17
|
+
for the most critical flows in your app. This plugin provides a `waldo` action
|
18
|
+
which allows you to upload an iOS or Android build to Waldo for processing.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
To get started, first obtain an API key and an application ID from Waldo for
|
23
|
+
your app. These are used to authenticate with the Waldo backend on each call.
|
24
|
+
|
25
|
+
### Uploading an iOS Build
|
26
|
+
|
27
|
+
Build a new IPA for your app. If you use `gym` (aka `build_ios_app`) to build
|
28
|
+
your IPA, `waldo` will automatically find and upload the generated IPA.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
gym
|
32
|
+
waldo(api_key: '0123456789abcdef0123456789abcdef',
|
33
|
+
application_id: 'app-0123456789abcdef')
|
34
|
+
```
|
35
|
+
|
36
|
+
> **Note:** You _must_ specify the Waldo API key and application ID key.
|
37
|
+
|
38
|
+
If for some reason you do _not_ use `gym` to build your IPA, you will need to
|
39
|
+
explicitly specify the IPA path to `waldo`:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
waldo(ipa_path: '/path/to/YourApp.ipa',
|
43
|
+
api_key: '0123456789abcdef0123456789abcdef',
|
44
|
+
application_id: 'app-0123456789abcdef')
|
45
|
+
```
|
46
|
+
|
47
|
+
### Uploading an Android Build
|
48
|
+
|
49
|
+
Build a new APK for your app. If you use `gradle` to build your APK, `waldo`
|
50
|
+
will automatically find and upload the generated APK.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
gradle(task: 'assemble',
|
54
|
+
build_type: 'Release')
|
55
|
+
waldo(api_key: '0123456789abcdef0123456789abcdef',
|
56
|
+
application_id: 'app-0123456789abcdef')
|
57
|
+
```
|
58
|
+
|
59
|
+
> **Note:** You _must_ specify the Waldo API key and application ID key.
|
60
|
+
|
61
|
+
If for some reason you do _not_ use `gradle` to build your APK, you will need
|
62
|
+
to explicitly specify the APK path to `waldo`:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
waldo(apk_path: '/path/to/YourApp.apk',
|
66
|
+
api_key: '0123456789abcdef0123456789abcdef',
|
67
|
+
application_id: 'app-0123456789abcdef')
|
68
|
+
```
|
69
|
+
|
70
|
+
## Issues and Feedback
|
71
|
+
|
72
|
+
For any other issues and feedback about this plugin, please submit it to this
|
73
|
+
repository.
|
74
|
+
|
75
|
+
## Troubleshooting
|
76
|
+
|
77
|
+
If you have trouble using plugins, check out the [Plugins
|
78
|
+
Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/)
|
79
|
+
guide.
|
80
|
+
|
81
|
+
## Using _fastlane_ Plugins
|
82
|
+
|
83
|
+
For more information about how the `fastlane` plugin system works, check out
|
84
|
+
the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
85
|
+
|
86
|
+
## About _fastlane_
|
87
|
+
|
88
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for
|
89
|
+
your iOS and Android apps. To learn more, check out
|
90
|
+
[fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class WaldoAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
params.values # validate all inputs
|
6
|
+
|
7
|
+
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
8
|
+
|
9
|
+
if platform == :android
|
10
|
+
UI.user_error!("You must pass an APK path to the Waldo action") unless params[:apk_path]
|
11
|
+
elsif platform == :ios || platform.nil?
|
12
|
+
UI.user_error!("You must pass an IPA path to the Waldo action") unless params[:ipa_path]
|
13
|
+
end
|
14
|
+
|
15
|
+
UI.user_error!("You must pass an API key to the Waldo action") unless params[:api_key]
|
16
|
+
UI.user_error!("You must pass an application ID to the Waldo action") unless params[:application_id]
|
17
|
+
|
18
|
+
FastlaneCore::PrintTable.print_values(config: params,
|
19
|
+
title: "Summary for waldo #{Fastlane::Waldo::VERSION.to_s}")
|
20
|
+
|
21
|
+
Helper::WaldoHelper.upload_build(params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.authors
|
25
|
+
["eBardX"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_options
|
29
|
+
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
30
|
+
|
31
|
+
if platform == :android
|
32
|
+
apk_path_default = Dir["*.apk"].last || Dir[File.join("app", "build", "outputs", "apk", "app-release.apk")].last
|
33
|
+
elsif platform == :ios || platform.nil?
|
34
|
+
ipa_path_default = Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last
|
35
|
+
end
|
36
|
+
|
37
|
+
[
|
38
|
+
# iOS-specific
|
39
|
+
FastlaneCore::ConfigItem.new(key: :ipa_path,
|
40
|
+
env_name: "WALDO_IPA_PATH",
|
41
|
+
description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action",
|
42
|
+
default_value: Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH] || ipa_path_default,
|
43
|
+
default_value_dynamic: true,
|
44
|
+
optional: true,
|
45
|
+
verify_block: proc do |value|
|
46
|
+
UI.user_error!("Unable to find IPA file at path '#{value.to_s}'") unless File.exist?(value)
|
47
|
+
end),
|
48
|
+
# Android-specific
|
49
|
+
FastlaneCore::ConfigItem.new(key: :apk_path,
|
50
|
+
env_name: "WALDO_APK_PATH",
|
51
|
+
description: "Path to your APK file. Optional if you use the _gradle_ action",
|
52
|
+
default_value: Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH] || apk_path_default,
|
53
|
+
default_value_dynamic: true,
|
54
|
+
optional: true,
|
55
|
+
verify_block: proc do |value|
|
56
|
+
UI.user_error!("Unable to find APK file at path '#{value.to_s}'") unless File.exist?(value)
|
57
|
+
end),
|
58
|
+
# General
|
59
|
+
FastlaneCore::ConfigItem.new(key: :api_key,
|
60
|
+
env_name: "WALDO_API_KEY",
|
61
|
+
description: "Waldo API key",
|
62
|
+
optional: true,
|
63
|
+
sensitive: true,
|
64
|
+
verify_block: proc do |value|
|
65
|
+
UI.user_error!("No API key for Waldo given, pass using `api_key: 'key'`") unless value && !value.empty?
|
66
|
+
end),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :application_id,
|
68
|
+
env_name: "WALDO_APPLICATION_ID",
|
69
|
+
description: "Waldo application ID",
|
70
|
+
optional: true,
|
71
|
+
sensitive: true,
|
72
|
+
verify_block: proc do |value|
|
73
|
+
UI.user_error!("No application ID for Waldo given, pass using `application_id: 'id'`") unless value && !value.empty?
|
74
|
+
end)
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.category
|
79
|
+
:testing
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.description
|
83
|
+
"Upload a new build to [Waldo](https://www.waldo.io)"
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.example_code
|
87
|
+
[
|
88
|
+
'waldo',
|
89
|
+
'waldo(
|
90
|
+
api_key: "...",
|
91
|
+
application_id: "..."
|
92
|
+
)',
|
93
|
+
'waldo(
|
94
|
+
apk_path: "./MyApp.apk",
|
95
|
+
api_key: "...",
|
96
|
+
application_id: "..."
|
97
|
+
)',
|
98
|
+
'waldo(
|
99
|
+
ipa_path: "./MyApp.ipa",
|
100
|
+
api_key: "...",
|
101
|
+
application_id: "..."
|
102
|
+
)'
|
103
|
+
]
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.is_supported?(platform)
|
107
|
+
[:android, :ios].include?(platform)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Helper
|
5
|
+
class WaldoHelper
|
6
|
+
def self.upload_build(params)
|
7
|
+
UI.success('Uploading the build to Waldo. This could take a while…')
|
8
|
+
|
9
|
+
begin
|
10
|
+
variant_name = Actions.lane_context[Actions::SharedValues::GRADLE_BUILD_TYPE]
|
11
|
+
uri_string = 'https://api.waldo.io/versions'
|
12
|
+
|
13
|
+
uri_string += "?variantName=#{variant_name}" if variant_name
|
14
|
+
|
15
|
+
uri = URI(uri_string)
|
16
|
+
|
17
|
+
request = build_request(uri, params)
|
18
|
+
|
19
|
+
dump_request(request) if FastlaneCore::Globals.verbose?
|
20
|
+
|
21
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
|
22
|
+
http.read_timeout = 120 # 2 minutes
|
23
|
+
|
24
|
+
parse_response(http.request(request))
|
25
|
+
end
|
26
|
+
rescue Net::ReadTimeout
|
27
|
+
UI.user_error!("Upload to Waldo timed out!")
|
28
|
+
rescue => exc
|
29
|
+
UI.user_error!("Something went wrong uploading to Waldo: #{exc.inspect.to_s}")
|
30
|
+
ensure
|
31
|
+
request.body_stream.close if request && request.body_stream
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.build_request(uri, params)
|
36
|
+
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
37
|
+
|
38
|
+
if platform == :android
|
39
|
+
body_path = params[:apk_path]
|
40
|
+
flavor = "Android"
|
41
|
+
elsif platform == :ios || platform.nil?
|
42
|
+
body_path = params[:ipa_path]
|
43
|
+
flavor = "iOS"
|
44
|
+
end
|
45
|
+
|
46
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
47
|
+
|
48
|
+
request['Authorization'] = "Upload-Token #{params[:api_key]}"
|
49
|
+
request['Transfer-Encoding'] = 'chunked'
|
50
|
+
request['User-Agent'] = "Waldo fastlane/#{flavor} v#{Fastlane::Waldo::VERSION}"
|
51
|
+
|
52
|
+
request.body_stream = WaldoReadIO.new(body_path)
|
53
|
+
request.content_type = 'application/octet-stream'
|
54
|
+
|
55
|
+
request
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.dump_request(request)
|
59
|
+
len = request.body ? request.body.length : 0
|
60
|
+
|
61
|
+
puts "Request: #{request.method} #{request.path} (#{len} bytes)"
|
62
|
+
|
63
|
+
request.each_capitalized do |key, value|
|
64
|
+
puts " #{key}: #{value}"
|
65
|
+
end
|
66
|
+
|
67
|
+
puts "-------"
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.dump_response(response)
|
71
|
+
puts "Response: #{response.code} #{response.message} (#{response.body.length} bytes)"
|
72
|
+
|
73
|
+
response.each_capitalized do |key, value|
|
74
|
+
puts " #{key}: #{value}"
|
75
|
+
end
|
76
|
+
|
77
|
+
puts "#{response.body}"
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.parse_response(response)
|
81
|
+
dump_response(response) if FastlaneCore::Globals.verbose?
|
82
|
+
|
83
|
+
case response.code.to_i
|
84
|
+
when 200..299
|
85
|
+
UI.success('Build successfully uploaded to Waldo!')
|
86
|
+
when 401
|
87
|
+
UI.user_error!("API key is invalid or missing!")
|
88
|
+
else
|
89
|
+
UI.user_error!("Build failed to upload to Waldo: #{response.code} #{response.message}")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class WaldoReadIO
|
95
|
+
def initialize(path)
|
96
|
+
@fp = File.open(path)
|
97
|
+
end
|
98
|
+
|
99
|
+
def close
|
100
|
+
@fp.close
|
101
|
+
end
|
102
|
+
|
103
|
+
def read(length = nil, outbuf = nil)
|
104
|
+
if result = @fp.read(length, outbuf)
|
105
|
+
result.force_encoding('BINARY') if result.respond_to?(:force_encoding)
|
106
|
+
end
|
107
|
+
|
108
|
+
result
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/waldo/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Waldo
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::Waldo.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-waldo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- J. G. Pusey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.1.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: fastlane
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.95'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.95.0
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.95'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.95.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: pry
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.1'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.1.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.1.0
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: rspec
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.0'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.0
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.0.0
|
93
|
+
description:
|
94
|
+
email: john@waldo.io
|
95
|
+
executables: []
|
96
|
+
extensions: []
|
97
|
+
extra_rdoc_files: []
|
98
|
+
files:
|
99
|
+
- LICENSE
|
100
|
+
- README.md
|
101
|
+
- lib/fastlane/plugin/waldo.rb
|
102
|
+
- lib/fastlane/plugin/waldo/actions/waldo_action.rb
|
103
|
+
- lib/fastlane/plugin/waldo/helper/waldo_helper.rb
|
104
|
+
- lib/fastlane/plugin/waldo/version.rb
|
105
|
+
homepage: https://github.com/waldoapp/fastlane-plugin-waldo
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.5.2.3
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Upload build to Waldo
|
129
|
+
test_files: []
|