fastlane-plugin-testappio 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 45a858285aceb1aa48afb0a85e362a35309aad321f02bd150651009c3c2985c3
4
+ data.tar.gz: 3d56ec9f6e88bb9596d2ba61870163fb134c17e34045d76b15182be1a084013f
5
+ SHA512:
6
+ metadata.gz: a9a542f8eb7b7c23eed9d2846650d8a24ee1c55c567499e985f2e92681cdaeaf9f82c4ce91a19310e929531682711d30360a467321a545ba4c5685e317f93191
7
+ data.tar.gz: 77ae25bcbef573d9d898db7739f66be4ac6d06adacfbd284fab2c7ddaa3d7fa40fb381556eff1bed362d12483f6584074df93d13fd9857740226ad3fa3a39974
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 TestApp.io FZ-LLC
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,86 @@
1
+ # [<img src="https://assets.testapp.io/logo/blue.svg" alt="TestApp.io"/>](https://testapp.io/) Fastlane Plugin
2
+
3
+ > This is in BETA mode. Your feedback is highly appreciated.
4
+
5
+ A fastlane plugin to upload both Android & iOS apps to TestApp.io to notify everyone for testing and feedback.
6
+
7
+ #### Version 1.0
8
+
9
+ <!-- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-testappio) -->
10
+
11
+ - [TestApp.io plugin](#testappio-plugin)
12
+ - [Getting started](#getting-started)
13
+ - [TestApp.io actions](#testappio-actions)
14
+ - [Action **upload_to_testappio**](#action-upload_to_testappio)
15
+ - [Issues and feedback](#issues-and-feedback)
16
+ - [Troubleshooting](#troubleshooting)
17
+ - [Using _fastlane_ plugins](#using-fastlane-plugins)
18
+ - [About _fastlane_](#about-fastlane)
19
+
20
+ ## Getting started
21
+
22
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-testappio`, add it to your project by running:
23
+
24
+ ```bash
25
+ fastlane add_plugin testappio
26
+ ```
27
+
28
+ ## TestApp.io actions
29
+
30
+ Actions provided by the CLI: [ta-cli](https://github.com/testappio/cli)
31
+
32
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
33
+
34
+ To upload after the fastlane `gym` action:
35
+
36
+ ```ruby
37
+ lane :development do
38
+ match(type: "development")
39
+ gym(export_method: "development")
40
+ upload_to_testappio(
41
+ api_token: "Your API Token",
42
+ app_id: "Your App ID",
43
+ release: "both",
44
+ apk_file: "/full/path/to/app.apk",
45
+ ipa_file: "/full/path/to/app.ipa",
46
+ release_notes: "release notes go here",
47
+ git_release_notes: true,
48
+ git_commit_id: false,
49
+ notify: false
50
+ )
51
+ end
52
+ ```
53
+
54
+ ### Action **upload_to_testappio**
55
+
56
+ Upload Android (APK) & iOS (IPA) files to TestApp.io and notify your team members
57
+
58
+ | Key | Description | Env Var(s) | Default |
59
+ | ----------------- | ------------------------------------------------------------------------------------------------------- | --------------------------- | ------- |
60
+ | api_token | You can get it from https://portal.testapp.io/settings/api-credentials | TESTAPPIO_API_TOKEN | |
61
+ | app_id | You can get it from your app page in https://portal.testapp.io/apps | TESTAPPIO_APP_ID | |
62
+ | release | It can be either both or android or ios | TESTAPPIO_RELEASE | |
63
+ | apk_file | Path to the android apk file | TESTAPPIO_ANDROID_PATH | |
64
+ | ipa_file | Path to the ios ipa file | TESTAPPIO_IOS_PATH | |
65
+ | release_notes | Manually add the release notes to be displayed for the testers | TESTAPPIO_RELEASE_NOTES | |
66
+ | git_release_notes | Collect release notes from the latest git commit message to be displayed for the testers: true or false | TESTAPPIO_GIT_RELEASE_NOTES | true |
67
+ | git_commit_id | Include the last commit ID in the release notes (works with both release notes option): true or false | TESTAPPIO_GIT_COMMIT_ID | false |
68
+ | notify | Send notificaitons to your team members about this release: true or false | TESTAPPIO_NOTIFY | false |
69
+
70
+ ## Issues and feedback
71
+
72
+ For any other issues and feedback about this plugin, please submit it to this repository.
73
+
74
+ Join our [Slack](https://join.slack.com/t/testappio/shared_invite/zt-pvpoj3l2-epGYwGTaV3~3~0f7udNWoA) channel for feedback and support or you can contact us at support@testapp.io and we'll gladly help you out!
75
+
76
+ ## Troubleshooting
77
+
78
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
79
+
80
+ ## Using _fastlane_ plugins
81
+
82
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
83
+
84
+ ## About _fastlane_
85
+
86
+ _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,146 @@
1
+ module Fastlane
2
+ module Actions
3
+ class UploadToTestappioAction < Action
4
+ SUPPORTED_FILE_EXTENSIONS = ["apk", "ipa"]
5
+ def self.run(params)
6
+ # Check if ta-cli is installed
7
+ Helper::TestappioHelper.check_ta_cli
8
+
9
+ # read the parameters
10
+ api_token = params[:api_token]
11
+ app_id = params[:app_id]
12
+ apk_file = params[:apk_file]
13
+ ipa_file = params[:ipa_file]
14
+ release = params[:release]
15
+ release_notes = params[:release_notes]
16
+ git_release_notes = params[:git_release_notes]
17
+ git_commit_id = params[:git_commit_id]
18
+ notify = params[:notify]
19
+
20
+ validate_file_path(apk_file) unless release == "ios"
21
+ validate_file_path(ipa_file) unless release == "android"
22
+
23
+ command = ["ta-cli"]
24
+ command.push("publish")
25
+ command.push("--api_token=#{api_token}")
26
+ command.push("--app_id=#{app_id}")
27
+ command.push("--release=#{release}")
28
+ command.push("--apk=#{apk_file}") unless release == "ios"
29
+ command.push("--ipa=#{ipa_file}") unless release == "android"
30
+ command.push("--release_notes=#{release_notes}")
31
+ command.push("--git_release_notes=#{git_release_notes}")
32
+ command.push("--git_commit_id=#{git_commit_id}")
33
+ command.push("--notify=#{notify}")
34
+ command.push("--source=Fastlane")
35
+
36
+ UI.message("Uploading to TestApp.io")
37
+ Helper::TestappioHelper.call_ta_cli(command)
38
+ UI.success("Successfully uploaded to TestApp.io!")
39
+ end
40
+
41
+ # Validate file_path.
42
+ def self.validate_file_path(file_path)
43
+ UI.user_error!("No file found at '#{file_path}'.") unless File.exist?(file_path)
44
+
45
+ # Validate file extension.
46
+ file_path_parts = file_path.split(".")
47
+ unless file_path_parts.length > 1 && SUPPORTED_FILE_EXTENSIONS.include?(file_path_parts.last)
48
+ UI.user_error!("file_path is invalid, only files with extensions " + SUPPORTED_FILE_EXTENSIONS.to_s + " are allowed to be uploaded.")
49
+ end
50
+ end
51
+
52
+ def self.description
53
+ "Uploading ipa/apk packages to TestApp.io for testing."
54
+ end
55
+
56
+ def self.default_file_path
57
+ platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
58
+ if platform == :ios
59
+ # Shared value for ipa path if it was generated by gym https://docs.fastlane.tools/actions/gym/.
60
+ return Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH]
61
+ else
62
+ # Shared value for apk if it was generated by gradle.
63
+ return Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH]
64
+ end
65
+ end
66
+
67
+ def self.details
68
+ "This Fastlane plugin uploads your Android (APK) and iOS (IPA) package to TestApp.io and notify your team members about the new releases if you enable it."
69
+ end
70
+
71
+ def self.available_options
72
+ # Define all options your action supports.
73
+
74
+ # Below a few examples
75
+ [
76
+ FastlaneCore::ConfigItem.new(key: :api_token,
77
+ env_name: "TESTAPPIO_API_TOKEN",
78
+ description: "You can get it from https://portal.testapp.io/settings/api-credentials",
79
+ verify_block: proc do |value|
80
+ UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/settings/api-credentials") unless value && !value.empty?
81
+ end),
82
+ FastlaneCore::ConfigItem.new(key: :app_id,
83
+ env_name: "TESTAPPIO_APP_ID",
84
+ description: "You can get it from your app page in https://portal.testapp.io/apps",
85
+ is_string: false),
86
+ FastlaneCore::ConfigItem.new(key: :release,
87
+ env_name: "TESTAPPIO_RELEASE",
88
+ description: "It can be either both or android or ios",
89
+ is_string: true,
90
+ default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]),
91
+ FastlaneCore::ConfigItem.new(key: :apk_file,
92
+ env_name: "TESTAPPIO_ANDROID_PATH",
93
+ description: "Full path to the Android .apk file",
94
+ optional: true,
95
+ is_string: true,
96
+ default_value: default_file_path),
97
+ FastlaneCore::ConfigItem.new(key: :ipa_file,
98
+ env_name: "TESTAPPIO_IOS_PATH",
99
+ description: "Full path to the iOS .ipa file",
100
+ optional: true,
101
+ is_string: true,
102
+ default_value: default_file_path),
103
+ FastlaneCore::ConfigItem.new(key: :release_notes,
104
+ env_name: "TESTAPPIO_RELEASE_NOTES",
105
+ description: "Manually add the release notes to be displayed for the testers",
106
+ optional: true,
107
+ is_string: true),
108
+ FastlaneCore::ConfigItem.new(key: :git_release_notes,
109
+ env_name: "TESTAPPIO_GIT_RELEASE_NOTES",
110
+ description: "Collect release notes from the latest git commit message to be displayed for the testers: true or false",
111
+ optional: true,
112
+ is_string: false,
113
+ default_value: true),
114
+ FastlaneCore::ConfigItem.new(key: :git_commit_id,
115
+ env_name: "TESTAPPIO_GIT_COMMIT_ID",
116
+ description: "Include the last commit ID in the release notes (works with both release notes option): true or false",
117
+ optional: true,
118
+ is_string: false,
119
+ default_value: false),
120
+ FastlaneCore::ConfigItem.new(key: :notify,
121
+ env_name: "TESTAPPIO_NOTIFY",
122
+ description: "Send notificaitons to your team members about this release: true or false",
123
+ optional: true,
124
+ is_string: false,
125
+ default_value: false)
126
+ ]
127
+ end
128
+
129
+ def self.output
130
+ nil
131
+ end
132
+
133
+ def self.return_value
134
+ nill
135
+ end
136
+
137
+ def self.authors
138
+ ["TestApp.io"]
139
+ end
140
+
141
+ def self.is_supported?(platform)
142
+ [:ios, :android].include?(platform)
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,62 @@
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 TestappioHelper
8
+ # Check if `ta_cli` exists, install it if not
9
+ def self.check_ta_cli
10
+ unless `which ta-cli`.include?('ta-cli')
11
+ UI.error("ta-cli not found, installing")
12
+ UI.command(`curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash`)
13
+ end
14
+ end
15
+
16
+ # Handle errors from `ta_cli`, if contains 'Error', the process stops,
17
+ # otherwise, just print to user console
18
+ def self.handle_error(errors)
19
+ fatal = false
20
+ errors.each do |error|
21
+ if error
22
+ if error =~ /Error/
23
+ UI.error(error.to_s)
24
+ fatal = true
25
+ else
26
+ UI.verbose(error.to_s)
27
+ end
28
+ end
29
+ end
30
+ UI.user_error!('Error while calling ta-cli') if fatal
31
+ end
32
+
33
+ # Run the given command
34
+ def self.call_ta_cli(command)
35
+ UI.message("Starting ta-cli...")
36
+ require 'open3'
37
+ if FastlaneCore::Globals.verbose?
38
+ UI.verbose("ta-cli command:\n\n")
39
+ UI.command(command.to_s)
40
+ UI.verbose("\n\n")
41
+ end
42
+ final_command = command.map { |arg| Shellwords.escape(arg) }.join(" ")
43
+ out = []
44
+ error = []
45
+ Open3.popen3(final_command) do |stdin, stdout, stderr, wait_thr|
46
+ while (line = stdout.gets)
47
+ out << line
48
+ UI.message(line.strip!)
49
+ end
50
+ while (line = stderr.gets)
51
+ error << line.strip!
52
+ end
53
+ exit_status = wait_thr.value
54
+ unless exit_status.success? && error.empty?
55
+ handle_error(error)
56
+ end
57
+ end
58
+ out.join
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Testappio
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require 'fastlane/plugin/testappio/version'
2
+
3
+ module Fastlane
4
+ module Testappio
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
+ Fastlane::Testappio.all_classes.each do |current|
13
+ require current
14
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-testappio
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TestApp.io
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-03-16 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'
20
+ type: :development
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: fastlane
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.204.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.204.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
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: rake
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: rspec
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: rspec_junit_formatter
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: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.12.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.12.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-require_tools
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email: support@testapp.io
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/testappio.rb
162
+ - lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb
163
+ - lib/fastlane/plugin/testappio/helper/testappio_helper.rb
164
+ - lib/fastlane/plugin/testappio/version.rb
165
+ homepage: https://github.com/testappio/fastlane-plugin-testappio
166
+ licenses:
167
+ - MIT
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '2.5'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubygems_version: 3.3.7
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Deploy your Android & iOS to TestApp.io
188
+ test_files: []