fastlane-plugin-aws_device_farm_upload 0.1.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 +43 -0
- data/lib/fastlane/plugin/aws_device_farm_upload.rb +16 -0
- data/lib/fastlane/plugin/aws_device_farm_upload/actions/aws_device_farm_upload_action.rb +120 -0
- data/lib/fastlane/plugin/aws_device_farm_upload/helper/aws_device_farm_upload_helper.rb +16 -0
- data/lib/fastlane/plugin/aws_device_farm_upload/version.rb +5 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5b56ace190d846b8147bd75c85902ebcfa5d75a8a75d3819882ae9065baac7e2
|
4
|
+
data.tar.gz: e99ab29f6feb336d455e96d52ca4b24f6e8413c5e459eb0a9a4ab985c885255e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd3a0ca239f4984447f32bb3d3f6bb9ecaa1bed2ec78b73461f68cd4e1573a7975837194e15d9dee0f93a0e05c9223eac3bec6f83b5e8ff085d446b626b8d42a
|
7
|
+
data.tar.gz: 68e450ab9d969854b43f97943da47c5bb801d666ed61f2638b109473481b5da1e24647da9782529ebea5fcfebb743c0fe7b07b3d3bc13508da256c1eb8d42011
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Takuma Homma <nagomimatcha@gmail.com>
|
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,43 @@
|
|
1
|
+
# aws_device_farm_upload plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-aws_device_farm_upload)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-aws_device_farm_upload`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin aws_device_farm_upload
|
11
|
+
```
|
12
|
+
|
13
|
+
## About aws_device_farm_upload
|
14
|
+
|
15
|
+
Uploads specified file to AWS Device Farm project.
|
16
|
+
|
17
|
+
## Example
|
18
|
+
|
19
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
|
20
|
+
|
21
|
+
## Run tests for this plugin
|
22
|
+
|
23
|
+
To run both the tests, and code style validation, run
|
24
|
+
|
25
|
+
```
|
26
|
+
rake
|
27
|
+
```
|
28
|
+
|
29
|
+
## Issues and Feedback
|
30
|
+
|
31
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
32
|
+
|
33
|
+
## Troubleshooting
|
34
|
+
|
35
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
36
|
+
|
37
|
+
## Using _fastlane_ Plugins
|
38
|
+
|
39
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
40
|
+
|
41
|
+
## About _fastlane_
|
42
|
+
|
43
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/aws_device_farm_upload/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module AwsDeviceFarmUpload
|
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::AwsDeviceFarmUpload.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class AwsDeviceFarmUploadAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
file_path = params[:file_path]
|
8
|
+
file_name = params[:file_name]
|
9
|
+
file_type = params[:file_type]
|
10
|
+
|
11
|
+
if (file_path.to_s.empty? || file_name.to_s.empty? || file_type.to_s.empty?)
|
12
|
+
UI.user_error!("No file_path, file_name, file_type given. Specify them.")
|
13
|
+
end
|
14
|
+
|
15
|
+
access_key_id = params[:aws_access_key_id]
|
16
|
+
secret_access_key = params[:aws_secret_access_key]
|
17
|
+
|
18
|
+
project_arn = params[:device_farm_project_arn]
|
19
|
+
|
20
|
+
require 'aws-sdk-devicefarm'
|
21
|
+
device_farm_client = Aws::DeviceFarm::Client.new(
|
22
|
+
region: 'us-west-2',
|
23
|
+
credentials: Aws::Credentials.new(access_key_id, secret_access_key)
|
24
|
+
)
|
25
|
+
|
26
|
+
begin
|
27
|
+
# Some files (e.g. ANDROID_APP) cannot be updated, so delete them first when uploading a file with the same name.
|
28
|
+
delete_file(device_farm_client, project_arn, file_name, file_type)
|
29
|
+
upload_file(device_farm_client, project_arn, file_name, file_path, file_type)
|
30
|
+
UI.success('Successfully uploaded file to AWS Device Farm project')
|
31
|
+
rescue => e
|
32
|
+
UI.user_error!("#{e}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.delete_file(device_farm_client, project_arn, file_name, file_type)
|
37
|
+
uploaded_list = device_farm_client.list_uploads({
|
38
|
+
arn: project_arn,
|
39
|
+
type: file_type
|
40
|
+
})
|
41
|
+
uploaded_file = uploaded_list.uploads.find do |upload|
|
42
|
+
upload.name == file_name && upload.status == 'SUCCEEDED'
|
43
|
+
end
|
44
|
+
|
45
|
+
unless uploaded_file.nil?
|
46
|
+
devicefarm_client.delete_upload({
|
47
|
+
arn: uploaded_file.arn
|
48
|
+
})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.upload_file(device_farm_client, project_arn, file_name, file_path, file_type)
|
53
|
+
params = {
|
54
|
+
project_arn: project_arn,
|
55
|
+
name: file_name,
|
56
|
+
type: file_type,
|
57
|
+
content_type: 'application/octet-stream'
|
58
|
+
}
|
59
|
+
|
60
|
+
create_request_response = device_farm_client.create_upload(params)
|
61
|
+
url = URI.parse(create_request_response.upload.url)
|
62
|
+
target = File.open(file_path, 'rb').read
|
63
|
+
|
64
|
+
response = Net::HTTP.start(url.host) do |http|
|
65
|
+
http.send_request('PUT', url.request_uri, target, {'content-type' => 'application/octet-stream'})
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.description
|
70
|
+
"Uploads specified file to AWS Device Farm project"
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.authors
|
74
|
+
["Takuma Homma"]
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.return_value
|
78
|
+
# If your method provides a return value, you can describe here what it does
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.details
|
82
|
+
# Optional:
|
83
|
+
"Uploads specified file to AWS Device Farm project"
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.available_options
|
87
|
+
[
|
88
|
+
FastlaneCore::ConfigItem.new(key: :aws_access_key_id,
|
89
|
+
env_name: '',
|
90
|
+
description: 'AWS Access Key ID',
|
91
|
+
optional: false),
|
92
|
+
FastlaneCore::ConfigItem.new(key: :aws_secret_access_key,
|
93
|
+
env_name: '',
|
94
|
+
description: 'AWS Secret Access Key',
|
95
|
+
optional: false),
|
96
|
+
FastlaneCore::ConfigItem.new(key: :device_farm_project_arn,
|
97
|
+
env_name: '',
|
98
|
+
description: 'The ARN of the project for the upload',
|
99
|
+
optional: false),
|
100
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
101
|
+
env_name: '',
|
102
|
+
description: 'The upload\'s file name',
|
103
|
+
optional: false),
|
104
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
105
|
+
env_name: '',
|
106
|
+
description: 'Full path to the file. e.g. /home/user/app/build/outputs/universal_apk/debug/app-debug-universal.apk',
|
107
|
+
optional: false),
|
108
|
+
FastlaneCore::ConfigItem.new(key: :file_type,
|
109
|
+
env_name: '',
|
110
|
+
description: 'Device Farm upload\'s upload type. e.g. ANDROID_APP, IOS_APP. See: https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax',
|
111
|
+
optional: false)
|
112
|
+
]
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.is_supported?(platform)
|
116
|
+
true
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class AwsDeviceFarmUploadHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::AwsDeviceFarmUploadHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.show_message
|
12
|
+
UI.message("Hello from the aws_device_farm_upload plugin helper!")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-aws_device_farm_upload
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takuma Homma
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-devicefarm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: fastlane
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email: nagomimatcha@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- LICENSE
|
118
|
+
- README.md
|
119
|
+
- lib/fastlane/plugin/aws_device_farm_upload.rb
|
120
|
+
- lib/fastlane/plugin/aws_device_farm_upload/actions/aws_device_farm_upload_action.rb
|
121
|
+
- lib/fastlane/plugin/aws_device_farm_upload/helper/aws_device_farm_upload_helper.rb
|
122
|
+
- lib/fastlane/plugin/aws_device_farm_upload/version.rb
|
123
|
+
homepage: https://github.com/mataku/fastlane-plugin-aws_device_farm_upload
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.1.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Uploads specified file to AWS Device Farm project
|
146
|
+
test_files: []
|