fastlane-plugin-testappio 1.0.5 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3f8258a28c0ecf61cb6a5c6fb9cb4034bff5661a255107aebe48875538d96c
4
- data.tar.gz: b410611a5b15eae119663098c1eba864e67295e85cba0d81588f037cf4bd5a94
3
+ metadata.gz: 6a7fe42f065213d5302bc2f96bc4ec98819aba336138636779c6318572928e62
4
+ data.tar.gz: 5781ea6babf9903fb7b04e0b36c4b29b279a8b5be45e389267c350f48115048a
5
5
  SHA512:
6
- metadata.gz: 28ad0d6bb57af599d7d2caff4d48f4a833ae7d222f7fe639f715d01e5cdce7951d37d420c7017c152a74105611d3b26e9af69a0e2197129ea72e7cf36f3897cc
7
- data.tar.gz: 7f8dbefec28b28af770b92bed123ecef137cef756e9be97ddc430955e8fd93afa0c67a392d7ee4aadc1b580ee1db40006596e83779fe91401fb2644542e4d6ea
6
+ metadata.gz: 6e5c989a03a85931a2af4736618bd25e9dbf00538a7e10a90a339aad70615abf4826cf4f4e05d3d44de0bd97c4744256c58f2c929007107200165da35237de67
7
+ data.tar.gz: 572142f620cf0593da8d1250a57cecd4088284853884ac19c64b065b6a1bd59314293b9d6b2c848ff5197126276b7c0fb4072ee33f704b830bb517cbafe79478
data/CHANGELOG.md ADDED
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.1] - 2026-11-21
11
+
12
+ ### Fixed
13
+ - The lane no longer crashes after a successful upload when the CI shell has no UTF-8 locale; ta-cli output is read as UTF-8.
14
+ - The ta-cli installer download is bounded (connect and total timeouts), so a stalled download cannot hang the lane.
15
+ - The plugin no longer sends its own error reports from customer CI.
16
+ - Fail the lane when ta-cli installation, version checking, updating, or upload fails, including signal termination and failures without stderr.
17
+ - With `self_update: true`, a mandatory-update notice triggers installation and a second version check even when the first check exits nonzero.
18
+ - Set both `TESTAPPIO_API_TOKEN` and `API_TOKEN` in the publish subprocess for compatibility with older CLIs and redact it from command logging and diagnostics.
19
+
20
+ ## [2.0.0] - 2026-05-28
21
+
22
+ ### Breaking
23
+ - **Ruby ≥ 3.0 required.** Customers on Ruby 2.6 or 2.7 should pin to `~> 1.0` in their `Pluginfile`.
24
+
25
+ ### Fixed
26
+ - `fastlane action upload_to_testappio` (the help/docs introspection command) no longer crashes with `NameError`. A `nill` typo in `return_value` was breaking this introspection path — actual uploads were unaffected, but Fastlane's plugin docs couldn't render.
27
+ - `validate_file_path` no longer raises `TypeError` when `apk_file` or `ipa_file` is `nil` — affected iOS-only and Android-only lanes that didn't set the other file param.
28
+ - `handle_error` no longer fails the upload when `ta-cli` writes warning or info lines to stderr — only real `Error:` lines fail the lane now.
29
+ - `--api_token` is now masked (`********`) in verbose-mode command logging — previously the token was echoed in plain text via `UI.command` in `fastlane --verbose` runs.
30
+
31
+ ### Added
32
+ - `spec.description` and `spec.metadata` (rubygems_mfa_required, source_code_uri, changelog_uri, bug_tracker_uri) in gemspec.
33
+ - Test coverage raised from 36.79% → **100% line / 86.76% branch** (49 unit + 2 opt-in `:integration` specs exercise the real `ta-cli` binary).
34
+ - Concurrent stdout/stderr reading in `call_ta_cli` via threads — prevents potential deadlock when ta-cli emits a large stderr buffer before stdout completes. Threads are cleanly killed in an `ensure` block if the surrounding popen3 block raises.
35
+ - `Open3.popen3` now uses the array form (no shell interpretation), so shell metacharacters in `api_token` / `release_notes` / file paths are passed literally to ta-cli without depending on manual escaping.
36
+ - `handle_error` now includes the actual `/Error/`-matching stderr lines in the raised `FastlaneError` message so users see the real failure reason in their CI logs.
37
+ - Shared spec helpers in `spec/spec_helper.rb` for stubbing `Open3.popen3` and `FastlaneCore::Globals.verbose?`.
38
+ - SimpleCov `minimum_coverage line: 95, branch: 90` gate (CI-only — local single-file runs no longer trip the gate).
39
+ - Opt-in `:integration` spec suite in `spec/integration/` — runs the real `ta-cli` binary against `fastlane/sample/*` with fake credentials to verify the deploy flow end-to-end. Run with `bundle exec rspec --tag integration` or `INTEGRATION=1 bundle exec rspec`.
40
+ - GitHub Actions CI: matrix over Ruby 3.0–3.3 × ubuntu/macos, with separate lint, test, and build jobs.
41
+ - Codecov coverage upload (via simplecov-cobertura) from one matrix cell.
42
+ - Tag-triggered `release.yml` workflow that builds and pushes the gem to RubyGems.
43
+ - Dependabot config for bundler and github-actions ecosystems.
44
+ - README badges: CI status, Codecov coverage, downloads, license, Ruby version, plus a Compatibility section.
45
+ - `self_update: true` example in `fastlane/Fastfile`.
46
+
47
+ ### Changed
48
+ - `rubocop` bumped from `1.12.1` to `~> 1.50` (dependent gems aligned).
49
+ - `simplecov`, `pry`, `fastlane`, `rspec_junit_formatter` bumped to current majors.
50
+ - `.rubocop.yml` `TargetRubyVersion` raised to `3.0`; deprecated cop names updated.
51
+
52
+ ### Removed
53
+ - `.travis.yml` and `.circleci/config.yml` (both obsolete; replaced by GitHub Actions).
54
+ - `spec.test_files` from gemspec (deprecated by RubyGems).
55
+ - `rubocop-require_tools` dev dependency (covered by rubocop 1.50+).
56
+
57
+ ## [1.0.5] - 2023-04-27
58
+
59
+ ### Changed
60
+ - Update Fastlane plugin link in README.
61
+
62
+ ## [1.0.4] - 2023
63
+
64
+ ### Changed
65
+ - Internal param refinement and result printing.
66
+
67
+ ## [1.0.3] - 2022
68
+
69
+ ### Changed
70
+ - Rolled back to v2 tag of ta-cli.
71
+
72
+ [Unreleased]: https://github.com/testappio/fastlane-plugin-testappio/compare/v2.0.0...HEAD
73
+ [2.0.0]: https://github.com/testappio/fastlane-plugin-testappio/compare/v1.0.5...v2.0.0
74
+ [1.0.5]: https://github.com/testappio/fastlane-plugin-testappio/compare/v1.0.4...v1.0.5
75
+ [1.0.4]: https://github.com/testappio/fastlane-plugin-testappio/compare/v1.0.3...v1.0.4
76
+ [1.0.3]: https://github.com/testappio/fastlane-plugin-testappio/releases/tag/v1.0.3
data/README.md CHANGED
@@ -1,107 +1,151 @@
1
1
  # [<img src="https://assets.testapp.io/logo/blue.svg" alt="TestApp.io"/>](https://testapp.io/) Fastlane Plugin
2
2
 
3
- > BETA mode. Your feedback is highly appreciated.
3
+ Upload your Android (`.apk`) and iOS (`.ipa`) builds to [TestApp.io](https://testapp.io) straight from your Fastlane lane. One action, both platforms, release notes from git, optional team notifications.
4
4
 
5
- A Fastlane plugin to upload both Android & iOS apps to TestApp.io to notify everyone for testing and feedback.
5
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-testappio)
6
+ [![Gem Version](https://img.shields.io/gem/v/fastlane-plugin-testappio)](https://rubygems.org/gems/fastlane-plugin-testappio)
7
+ [![CI](https://github.com/testappio/fastlane-plugin-testappio/actions/workflows/ci.yml/badge.svg)](https://github.com/testappio/fastlane-plugin-testappio/actions/workflows/ci.yml)
8
+ [![codecov](https://codecov.io/gh/testappio/fastlane-plugin-testappio/branch/main/graph/badge.svg)](https://codecov.io/gh/testappio/fastlane-plugin-testappio)
9
+ [![Downloads](https://img.shields.io/gem/dt/fastlane-plugin-testappio)](https://rubygems.org/gems/fastlane-plugin-testappio)
10
+ [![License](https://img.shields.io/github/license/testappio/fastlane-plugin-testappio)](LICENSE)
11
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.0-CC342D.svg)](https://www.ruby-lang.org/)
6
12
 
7
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-testappio) [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-testappio.svg)](https://badge.fury.io/rb/fastlane-plugin-testappio)
8
-
9
- ## Getting started
13
+ ---
10
14
 
11
- 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:
15
+ ## Install
12
16
 
13
17
  ```bash
14
18
  fastlane add_plugin testappio
15
19
  ```
16
20
 
17
- ## Configuration
21
+ That's it. The plugin will install the underlying [`ta-cli`](https://help.testapp.io/ta-cli/) binary the first time you upload.
18
22
 
19
- _More info here: [https://help.testapp.io/ta-cli](https://help.testapp.io/ta-cli/)_
23
+ ## Quick start
20
24
 
21
- | Key | Description | Env Var(s) | Default |
22
- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | ------- |
23
- | api_token | You can get it from https://portal.testapp.io/settings/api-credentials | TESTAPPIO_API_TOKEN | |
24
- | app_id | You can get it from your app page at [https://portal.testapp.io/apps](https://portal.testapp.io/apps?action=select-for-integrations) | TESTAPPIO_APP_ID | |
25
- | release | It can be either both or Android or iOS | TESTAPPIO_RELEASE | |
26
- | apk_file | Path to the Android APK file | TESTAPPIO_ANDROID_PATH | |
27
- | ipa_file | Path to the iOS IPA file | TESTAPPIO_IOS_PATH | |
28
- | release_notes | Manually add the release notes to be displayed for the testers | TESTAPPIO_RELEASE_NOTES | |
29
- | 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 |
30
- | git_commit_id | Include the last commit ID in the release notes (works with both release notes options): true or false | TESTAPPIO_GIT_COMMIT_ID | false |
31
- | notify | Send notifications to your team members about this release: true or false | TESTAPPIO_NOTIFY | false |
25
+ ```ruby
26
+ lane :beta do
27
+ gym(export_method: "ad-hoc") # or gradle(task: "assembleRelease")
28
+
29
+ upload_to_testappio(
30
+ api_token: ENV["TESTAPPIO_API_TOKEN"],
31
+ app_id: ENV["TESTAPPIO_APP_ID"],
32
+ notify: true
33
+ )
34
+ end
35
+ ```
32
36
 
33
- ## TestApp.io actions
37
+ Get your `api_token` at <https://portal.testapp.io/profile/tokens>.
38
+ Get your `app_id` at <https://portal.testapp.io/apps>.
34
39
 
35
- Actions provided by the CLI: [ta-cli](https://help.testapp.io/ta-cli/)
40
+ ## Configuration
36
41
 
37
- Check out the [example Fastfile](https://github.com/testappio/fastlane-plugin-testappio/blob/main/fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
42
+ | Key | Description | Env var | Default |
43
+ |---|---|---|---|
44
+ | `api_token` | API token from <https://portal.testapp.io/profile/tokens> | `TESTAPPIO_API_TOKEN` | — |
45
+ | `app_id` | App ID from your <https://portal.testapp.io/apps> page | `TESTAPPIO_APP_ID` | — |
46
+ | `release` | `ios`, `android`, or `both` | `TESTAPPIO_RELEASE` | current platform |
47
+ | `apk_file` | Path to the Android `.apk` | `TESTAPPIO_ANDROID_PATH` | gradle's output |
48
+ | `ipa_file` | Path to the iOS `.ipa` | `TESTAPPIO_IOS_PATH` | gym's output |
49
+ | `release_notes` | Manual release notes | `TESTAPPIO_RELEASE_NOTES` | — |
50
+ | `git_release_notes` | Use the latest git commit message as release notes | `TESTAPPIO_GIT_RELEASE_NOTES` | `true` |
51
+ | `git_commit_id` | Append the latest commit SHA to the release notes | `TESTAPPIO_GIT_COMMIT_ID` | `false` |
52
+ | `notify` | Notify team members about the new release | `TESTAPPIO_NOTIFY` | `false` |
53
+ | `self_update` | Auto-update `ta-cli` when a new version is available | `TESTAPPIO_SELF_UPDATE` | `true` |
38
54
 
39
- To upload after the Fastlane `gym` action:
55
+ ## Examples
40
56
 
41
- ##### iOS
57
+ ### iOS only
42
58
 
43
59
  ```ruby
44
- lane :beta do
45
-
46
- increment_build_number
47
- match(type: "adhoc")
48
- gym(export_method: "ad-hoc")
49
-
50
- upload_to_testappio(
51
- api_token: "Your API Token",
52
- app_id: "Your App ID",
53
- release_notes: "My release notes here...",
54
- git_release_notes: true,
55
- git_commit_id: false,
56
- notify: true
57
- )
60
+ lane :beta_ios do
61
+ match(type: "adhoc")
62
+ gym(export_method: "ad-hoc")
63
+
64
+ upload_to_testappio(
65
+ api_token: ENV["TESTAPPIO_API_TOKEN"],
66
+ app_id: ENV["TESTAPPIO_APP_ID"],
67
+ release: "ios",
68
+ release_notes: "Bug fixes and improvements",
69
+ notify: true
70
+ )
71
+ end
72
+ ```
58
73
 
59
- clean_build_artifacts #optional
74
+ ### Android only
60
75
 
61
- end
76
+ ```ruby
77
+ lane :beta_android do
78
+ gradle(task: "clean assembleRelease")
79
+
80
+ upload_to_testappio(
81
+ api_token: ENV["TESTAPPIO_API_TOKEN"],
82
+ app_id: ENV["TESTAPPIO_APP_ID"],
83
+ release: "android",
84
+ git_release_notes: true,
85
+ git_commit_id: true,
86
+ notify: true
87
+ )
88
+ end
62
89
  ```
63
90
 
64
- ##### Android
91
+ ### Both platforms in one lane
65
92
 
66
93
  ```ruby
67
- lane :beta do
94
+ lane :beta_both do
95
+ gradle(task: "clean assembleRelease")
96
+ gym(export_method: "ad-hoc")
97
+
98
+ upload_to_testappio(
99
+ api_token: ENV["TESTAPPIO_API_TOKEN"],
100
+ app_id: ENV["TESTAPPIO_APP_ID"],
101
+ release: "both",
102
+ notify: true
103
+ )
104
+ end
105
+ ```
68
106
 
69
- increment_version_code #[Optional] fastlane add_plugin increment_version_code
107
+ A runnable example lives in [`fastlane/Fastfile`](fastlane/Fastfile). Try it with `bundle exec fastlane test`.
70
108
 
71
- gradle(task: "clean assembleDebug") #or clean assembleRelease
109
+ ## Compatibility
72
110
 
73
- upload_to_testappio(
74
- api_token: "Your API Token", #You can get it from https://portal.testapp.io/settings/api-credentials
75
- app_id: "Your App ID", #You can get it from your app page in https://portal.testapp.io/apps
76
- release_notes: "My release notes here...",
77
- git_release_notes: true,
78
- git_commit_id: false,
79
- notify: true
80
- )
111
+ | Plugin version | Ruby | Status |
112
+ |---|---|---|
113
+ | **2.x** | `>= 3.0` | Active — feature work + security fixes |
114
+ | **1.x** | `>= 2.6` | Maintenance only — security fixes through May 2027 |
81
115
 
82
- end
83
- ```
116
+ If your CI image uses Ruby 2.6 or 2.7, pin to `~> 1.0` in your `Pluginfile`:
84
117
 
85
- ## Troubleshooting
86
-
87
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
118
+ ```ruby
119
+ gem "fastlane-plugin-testappio", "~> 1.0"
120
+ ```
88
121
 
89
- ## Using _Fastlane_ plugins
122
+ When you upgrade your CI to Ruby 3.0+, drop the pin and you'll get 2.x automatically.
90
123
 
91
- Check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/) for more information about how the plugin system works.
124
+ ## Troubleshooting
92
125
 
93
- ## About _Fastlane_
126
+ - **`fastlane add_plugin testappio` fails on Bundler 2.0 issues** — make sure your Ruby is 3.0 or higher (`ruby -v`).
127
+ - **Upload fails with a `ta-cli` error** — the error message now includes the underlying `ta-cli` output so you can see exactly what went wrong (auth, network, provisioning, etc.). Run with `fastlane --verbose` for full context.
128
+ - **Token visible in CI logs** — should never happen in 2.x; tokens are masked as `********`. If you see this in 1.x, upgrade.
129
+ - **Other plugin issues** — see the official [Fastlane plugin troubleshooting guide](https://docs.fastlane.tools/plugins/plugins-troubleshooting/).
94
130
 
95
- _Fastlane_ is the easiest way to automate beta deployments and releases for iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
131
+ ## Contributing
96
132
 
97
- ---
133
+ PRs welcome. Local development:
98
134
 
99
- ## Feedback & Support
135
+ ```bash
136
+ bundle install # install dev dependencies
137
+ bundle exec rspec # run the unit test suite (49 specs)
138
+ bundle exec rubocop # lint
139
+ bundle exec rake # spec + rubocop together
140
+ INTEGRATION=1 bundle exec rspec # also run the 2 :integration specs (needs ta-cli installed)
141
+ ```
100
142
 
101
- Developers built [TestApp.io](https://testapp.io) to solve the pain of app distribution & feedback for mobile app development teams.
143
+ Every PR adds an entry under `## [Unreleased]` in [`CHANGELOG.md`](CHANGELOG.md). See it for the full list of what changed between versions.
102
144
 
103
- Join our [community](https://help.testapp.io/faq/join-our-community/) for feedback and support.
145
+ ## Feedback & support
104
146
 
105
- Check out our [Help Center](https://help.testapp.io/) for more info and other integrations.
147
+ - **Help center:** <https://help.testapp.io/>
148
+ - **Community:** <https://help.testapp.io/faq/join-our-community/>
149
+ - **Bug reports / feature requests:** [GitHub issues](https://github.com/testappio/fastlane-plugin-testappio/issues)
106
150
 
107
- Happy releasing 🎉
151
+ Built by [TestApp.io](https://testapp.io) — happy releasing 🚀
@@ -4,14 +4,9 @@ module Fastlane
4
4
  SUPPORTED_FILE_EXTENSIONS = ["apk", "ipa"]
5
5
 
6
6
  def self.run(params)
7
-
8
- # Check if `ta_cli` exists, install it if not
9
- unless Helper::TestappioHelper.check_ta_cli
10
- UI.error("Error detecting ta-cli")
11
- return
12
- end
13
-
14
7
  api_token = params[:api_token]
8
+ Helper::TestappioHelper.check_ta_cli(api_token)
9
+
15
10
  app_id = params[:app_id]
16
11
  apk_file = params[:apk_file]
17
12
  ipa_file = params[:ipa_file]
@@ -22,17 +17,12 @@ module Fastlane
22
17
  notify = params[:notify]
23
18
  self_update = params[:self_update]
24
19
 
25
- # Check if ta-cli needs to be updated
26
- unless Helper::TestappioHelper.check_update(self_update)
27
- UI.error("Error updating ta-cli")
28
- return
29
- end
20
+ Helper::TestappioHelper.check_update(self_update, api_token)
30
21
 
31
22
  validate_file_path(apk_file) unless release == "ios"
32
23
  validate_file_path(ipa_file) unless release == "android"
33
24
 
34
25
  command = ["ta-cli", "publish",
35
- "--api_token=#{api_token}",
36
26
  "--app_id=#{app_id}",
37
27
  "--release=#{release}"]
38
28
 
@@ -48,14 +38,16 @@ module Fastlane
48
38
  "--source_version=#{Fastlane::Testappio::VERSION}"]
49
39
 
50
40
  UI.message("Uploading to TestApp.io")
51
- Helper::TestappioHelper.call_ta_cli(command)
41
+ Helper::TestappioHelper.call_ta_cli(command, api_token)
52
42
  UI.success("Successfully uploaded to TestApp.io!")
53
43
  end
54
44
 
55
45
  def self.validate_file_path(file_path)
46
+ return if file_path.nil?
47
+
56
48
  UI.user_error!("No file found at '#{file_path}'.") unless File.exist?(file_path)
57
49
 
58
- file_ext = File.extname(file_path).delete('.')
50
+ file_ext = File.extname(file_path).delete_prefix('.').downcase
59
51
  unless SUPPORTED_FILE_EXTENSIONS.include?(file_ext)
60
52
  UI.user_error!("file_path is invalid, only files with extensions #{SUPPORTED_FILE_EXTENSIONS} are allowed to be uploaded.")
61
53
  end
@@ -87,60 +79,61 @@ module Fastlane
87
79
  [
88
80
  FastlaneCore::ConfigItem.new(key: :api_token,
89
81
  env_name: "TESTAPPIO_API_TOKEN",
90
- description: "You can get it from https://portal.testapp.io/settings/api-credentials",
82
+ description: "You can get it from https://portal.testapp.io/profile/tokens",
83
+ sensitive: true,
91
84
  verify_block: proc do |value|
92
- UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/settings/api-credentials") unless value && !value.empty?
85
+ UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/profile/tokens") unless value && !value.empty?
93
86
  end),
94
87
  FastlaneCore::ConfigItem.new(key: :app_id,
95
88
  env_name: "TESTAPPIO_APP_ID",
96
- description: "You can get it from your app page in https://portal.testapp.io/apps?action=select-for-integrations",
89
+ description: "You can get it from your app page in https://portal.testapp.io/apps?to=app-integrations&tab=releases",
97
90
  is_string: false),
98
91
  FastlaneCore::ConfigItem.new(key: :release,
99
92
  env_name: "TESTAPPIO_RELEASE",
100
93
  description: "It can be either both or android or ios",
101
94
  is_string: true,
102
- default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]),
95
+ default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]),
103
96
  FastlaneCore::ConfigItem.new(key: :apk_file,
104
- env_name: "TESTAPPIO_ANDROID_PATH",
105
- description: "Full path to the Android .apk file",
106
- optional: true,
107
- is_string: true,
108
- default_value: default_file_path),
97
+ env_name: "TESTAPPIO_ANDROID_PATH",
98
+ description: "Full path to the Android .apk file",
99
+ optional: true,
100
+ is_string: true,
101
+ default_value: default_file_path),
109
102
  FastlaneCore::ConfigItem.new(key: :ipa_file,
110
- env_name: "TESTAPPIO_IOS_PATH",
111
- description: "Full path to the iOS .ipa file",
112
- optional: true,
113
- is_string: true,
114
- default_value: default_file_path),
103
+ env_name: "TESTAPPIO_IOS_PATH",
104
+ description: "Full path to the iOS .ipa file",
105
+ optional: true,
106
+ is_string: true,
107
+ default_value: default_file_path),
115
108
  FastlaneCore::ConfigItem.new(key: :release_notes,
116
- env_name: "TESTAPPIO_RELEASE_NOTES",
117
- description: "Manually add the release notes to be displayed for the testers",
118
- optional: true,
119
- is_string: true),
109
+ env_name: "TESTAPPIO_RELEASE_NOTES",
110
+ description: "Manually add the release notes to be displayed for the testers",
111
+ optional: true,
112
+ is_string: true),
120
113
  FastlaneCore::ConfigItem.new(key: :git_release_notes,
121
- env_name: "TESTAPPIO_GIT_RELEASE_NOTES",
122
- description: "Collect release notes from the latest git commit message to be displayed for the testers: true or false",
123
- optional: true,
124
- is_string: false,
125
- default_value: true),
114
+ env_name: "TESTAPPIO_GIT_RELEASE_NOTES",
115
+ description: "Collect release notes from the latest git commit message to be displayed for the testers: true or false",
116
+ optional: true,
117
+ is_string: false,
118
+ default_value: true),
126
119
  FastlaneCore::ConfigItem.new(key: :git_commit_id,
127
- env_name: "TESTAPPIO_GIT_COMMIT_ID",
128
- description: "Include the last commit ID in the release notes (works with both release notes option): true or false",
129
- optional: true,
130
- is_string: false,
131
- default_value: false),
120
+ env_name: "TESTAPPIO_GIT_COMMIT_ID",
121
+ description: "Include the last commit ID in the release notes (works with both release notes option): true or false",
122
+ optional: true,
123
+ is_string: false,
124
+ default_value: false),
132
125
  FastlaneCore::ConfigItem.new(key: :notify,
133
- env_name: "TESTAPPIO_NOTIFY",
134
- description: "Send notificaitons to your team members about this release: true or false",
135
- optional: true,
136
- is_string: false,
137
- default_value: false),
126
+ env_name: "TESTAPPIO_NOTIFY",
127
+ description: "Send notificaitons to your team members about this release: true or false",
128
+ optional: true,
129
+ is_string: false,
130
+ default_value: false),
138
131
  FastlaneCore::ConfigItem.new(key: :self_update,
139
- env_name: "TESTAPPIO_SELF_UPDATE",
140
- description: "Automatically update ta-cli if a new version is available or required: true or false",
141
- optional: true,
142
- is_string: false,
143
- default_value: true)
132
+ env_name: "TESTAPPIO_SELF_UPDATE",
133
+ description: "Automatically update ta-cli if a new version is available or required: true or false",
134
+ optional: true,
135
+ is_string: false,
136
+ default_value: true)
144
137
  ]
145
138
  end
146
139
 
@@ -149,7 +142,7 @@ module Fastlane
149
142
  end
150
143
 
151
144
  def self.return_value
152
- nill
145
+ nil
153
146
  end
154
147
 
155
148
  def self.authors
@@ -1,122 +1,153 @@
1
+ require 'fastlane_core/helper'
1
2
  require 'fastlane_core/ui/ui'
3
+ require 'open3'
2
4
 
3
5
  module Fastlane
4
6
  UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
5
7
 
6
8
  module Helper
7
9
  class TestappioHelper
10
+ INSTALL_COMMAND = ["bash", "-o", "pipefail", "-c", "curl -fLs --connect-timeout 10 --max-time 60 https://github.com/testappio/cli/releases/latest/download/install | bash"].freeze
11
+ VERSION_COMMAND = ["ta-cli", "version"].freeze
12
+ ENV_WITHOUT_TOKEN = { "TESTAPPIO_API_TOKEN" => nil, "API_TOKEN" => nil }.freeze
13
+ CURRENT_VERSION_NOTICE = /You are using the latest version|ta-cli is (?:already )?up-to-date/i
14
+ REQUIRED_UPDATE_NOTICE = "Update necessary".freeze
8
15
 
9
16
  # Check if `ta_cli` exists, install it if not
10
- def self.check_ta_cli
11
- unless system('which ta-cli > /dev/null 2>&1')
17
+ def self.check_ta_cli(api_token = nil)
18
+ unless FastlaneCore::Helper.which("ta-cli")
12
19
  UI.error("ta-cli not found, installing")
13
20
 
14
- unless system('curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash')
15
- UI.error("Error installing ta-cli")
16
- return false
17
- end
21
+ output, stderr, status = capture_cli(INSTALL_COMMAND, api_token)
22
+ fail_command("Error installing ta-cli", status, output, stderr) unless status.success?
23
+ UI.success("ta-cli installed")
18
24
  end
19
25
 
20
26
  return true
21
27
  end
22
28
 
23
29
  # Check if there is an update available for `ta_cli`, and install it if necessary
24
- def self.check_update(self_update)
25
- require 'open3'
26
-
27
- version_output = `ta-cli version`
28
- UI.verbose(version_output)
30
+ def self.check_update(self_update, api_token = nil)
31
+ version_output, version_error, version_status = capture_cli(VERSION_COMMAND, api_token)
32
+ forced = [version_output, version_error].any? { |text| text.include?(REQUIRED_UPDATE_NOTICE) }
33
+ unless version_status.success? || (forced && !version_status.signaled?)
34
+ fail_command("Error checking ta-cli version", version_status, version_output, version_error)
35
+ end
29
36
 
30
- if version_output.include?("breaking changes")
37
+ if forced
31
38
  if self_update
32
39
  UI.message("Updating ta-cli due to breaking changes...")
33
40
  else
41
+ # UI.user_error! raises FastlaneError; method never returns past this point.
34
42
  UI.user_error!("Update necessary due to breaking changes. Please update ta-cli manually or set self_update to true")
35
- return false
36
43
  end
37
44
  elsif version_output.include?("New version available")
38
45
  if self_update
39
46
  UI.message("Updating ta-cli...")
40
47
  else
41
- UI.error("New version available, but skipping update as self_update is set to false.")
48
+ UI.important("New version available, but skipping update as self_update is set to false.")
42
49
  return true
43
50
  end
44
51
  else
45
- UI.success("ta-cli is already up-to-date")
46
- return true
47
- end
48
-
49
- update_command = "curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash"
50
- update_output, update_errors, update_status = Open3.capture3(update_command)
51
- UI.verbose(update_output)
52
-
53
- if update_output.include?("ta-cli successfully installed") || update_output.include?("ta-cli has been updated")
54
- version_output = `ta-cli version`
55
- UI.verbose(version_output)
56
-
57
- if version_output.include?("Update necessary due to breaking changes") || version_output.include?("New version available")
58
- UI.user_error!("Error updating ta-cli: the version is still outdated")
59
- return false
52
+ if version_output.match?(CURRENT_VERSION_NOTICE)
53
+ UI.success("ta-cli is already up-to-date")
60
54
  else
61
- UI.success("ta-cli has been updated successfully")
62
- return true
55
+ UI.important("Version check unavailable. Continuing with the installed ta-cli.")
63
56
  end
64
- else
65
- UI.user_error!("Error updating ta-cli: #{update_output}")
66
- return false
57
+ return true
67
58
  end
68
- end
69
59
 
70
- # Handle errors from `ta_cli`, if contains 'Error', the process stops,
71
- # otherwise, just print to user console
72
- def self.handle_error(errors)
73
- errors.each do |error|
74
- if error
75
- if error =~ /Error/
76
- UI.error(error.to_s)
77
- else
78
- UI.verbose(error.to_s)
79
- end
80
- end
60
+ update_output, update_error, update_status = capture_cli(INSTALL_COMMAND, api_token)
61
+ fail_command("Error updating ta-cli", update_status, update_output, update_error) unless update_status.success?
62
+ version_output, version_error, version_status = capture_cli(VERSION_COMMAND, api_token)
63
+ fail_command("Error checking ta-cli version", version_status, version_output, version_error) if version_status.signaled?
64
+ # A still-forced update exits nonzero, so check the notice before the exit code.
65
+ if [version_output, version_error].any? { |text| text.include?(REQUIRED_UPDATE_NOTICE) } || version_output.include?("New version available")
66
+ UI.user_error!("Error updating ta-cli: the version is still outdated")
81
67
  end
68
+ fail_command("Error checking ta-cli version", version_status, version_output, version_error) unless version_status.success?
82
69
 
83
- if errors.any? { |e| e =~ /Error/ }
84
- UI.user_error!('Error while calling ta-cli')
85
- elsif errors.any?
86
- UI.user_error!("Error while calling ta-cli: #{errors.join(', ')}")
70
+ if version_output.match?(CURRENT_VERSION_NOTICE)
71
+ UI.success("ta-cli has been updated successfully")
72
+ else
73
+ UI.important("Update installed. Version check unavailable.")
87
74
  end
75
+ true
88
76
  end
89
77
 
90
- # Run the given command
91
- def self.call_ta_cli(command)
78
+ # Stream stdout, keep the token in the child environment, and preserve
79
+ # release notes and file paths as literal arguments.
80
+ def self.call_ta_cli(command, api_token = nil)
92
81
  UI.message("Starting ta-cli...")
93
- require 'open3'
94
82
  if FastlaneCore::Globals.verbose?
95
83
  UI.verbose("ta-cli command:\n\n")
96
- UI.command(command.to_s)
84
+ UI.command(command.map { |argument| redact_token(argument, api_token) }.to_s)
97
85
  UI.verbose("\n\n")
98
86
  end
99
- final_command = command.map { |arg| Shellwords.escape(arg) }.join(" ")
100
- out = []
101
- error = []
102
- Open3.popen3(final_command) do |stdin, stdout, stderr, wait_thr|
103
- while (line = stdout.gets)
104
- out << line
105
- line.strip!
106
-
107
- # Print output as it's generated
108
- UI.message(line) unless line.empty?
109
87
 
88
+ out = []
89
+ stderr_lines = []
90
+ out_thread = nil
91
+ err_thread = nil
92
+ Open3.popen3({ "TESTAPPIO_API_TOKEN" => api_token, "API_TOKEN" => api_token }, *command) do |stdin, stdout, stderr, wait_thr|
93
+ stdin.close
94
+
95
+ # Read stdout and stderr concurrently to avoid deadlock when ta-cli
96
+ # fills one buffer before we finish draining the other.
97
+ out_thread = Thread.new do
98
+ while (line = stdout.gets)
99
+ line = redact_token(line, api_token)
100
+ out << line
101
+ UI.message(line.strip) unless line.strip.empty?
102
+ end
110
103
  end
111
- while (line = stderr.gets)
112
- error << line.strip!
104
+
105
+ err_thread = Thread.new do
106
+ while (line = stderr.gets)
107
+ stderr_lines << redact_token(line, api_token)
108
+ end
113
109
  end
110
+
111
+ out_thread.join
112
+ err_thread.join
113
+
114
114
  exit_status = wait_thr.value
115
- handle_error(error) unless exit_status.success?
115
+ fail_command("Error while calling ta-cli", exit_status, stderr_lines.join) unless exit_status.success?
116
116
  end
117
117
  out.join
118
+ ensure
119
+ # If popen3's block raised before threads joined, make sure no readers
120
+ # are left holding pipe FDs.
121
+ out_thread.kill if out_thread&.alive?
122
+ err_thread.kill if err_thread&.alive?
123
+ end
124
+
125
+ def self.capture_cli(command, api_token)
126
+ output, stderr, status = Open3.capture3(ENV_WITHOUT_TOKEN, *command)
127
+ output = redact_token(output, api_token)
128
+ stderr = redact_token(stderr, api_token)
129
+ UI.verbose(output) unless output.empty?
130
+ UI.verbose(stderr) unless stderr.empty?
131
+ [output, stderr, status]
118
132
  end
119
133
 
134
+ def self.fail_command(message, status, *diagnostics)
135
+ reason = status.signaled? ? "signal #{status.termsig}" : "exit status #{status.exitstatus}"
136
+ message = "#{message} (#{reason})"
137
+ diagnostic = diagnostics.flat_map(&:lines).map(&:strip).reject(&:empty?).join(" | ")
138
+ message = "#{message}: #{diagnostic}" unless diagnostic.empty?
139
+ UI.user_error!(message)
140
+ end
141
+
142
+ # ta-cli prints UTF-8. A CI shell without a UTF-8 locale tags its output
143
+ # US-ASCII, so read it as UTF-8 and replace bytes that are not valid.
144
+ def self.redact_token(text, api_token)
145
+ text = text.dup.force_encoding(Encoding::UTF_8).scrub
146
+ return text if api_token.to_s.empty?
147
+
148
+ text.gsub(api_token, "********")
149
+ end
150
+ private_class_method :capture_cli, :fail_command, :redact_token
120
151
  end
121
152
  end
122
153
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Testappio
3
- VERSION = "1.0.5"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-testappio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TestApp.io
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2026-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,34 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.204'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 2.204.3
33
+ version: '2.217'
37
34
  type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '2.204'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.204.3
40
+ version: '2.217'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: pry
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0.13'
47
+ version: '0.14'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '0.13'
54
+ version: '0.14'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rake
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -92,76 +86,81 @@ dependencies:
92
86
  requirements:
93
87
  - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: '0.4'
89
+ version: '0.6'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: '0.4'
96
+ version: '0.6'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: rubocop
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
- - - '='
101
+ - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: 1.12.1
103
+ version: '1.50'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
- - - '='
108
+ - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: 1.12.1
110
+ version: '1.50'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: rubocop-performance
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: 1.17.1
117
+ version: '1.20'
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: 1.17.1
124
+ version: '1.20'
131
125
  - !ruby/object:Gem::Dependency
132
- name: rubocop-require_tools
126
+ name: simplecov
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - "~>"
136
130
  - !ruby/object:Gem::Version
137
- version: 0.1.2
131
+ version: '0.22'
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - "~>"
143
137
  - !ruby/object:Gem::Version
144
- version: 0.1.2
138
+ version: '0.22'
145
139
  - !ruby/object:Gem::Dependency
146
- name: simplecov
140
+ name: simplecov-cobertura
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
143
  - - "~>"
150
144
  - !ruby/object:Gem::Version
151
- version: '0.21'
145
+ version: '3.1'
152
146
  type: :development
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
150
  - - "~>"
157
151
  - !ruby/object:Gem::Version
158
- version: '0.21'
159
- description:
152
+ version: '3.1'
153
+ description: |
154
+ A Fastlane plugin that uploads Android (.apk) and iOS (.ipa) builds to TestApp.io,
155
+ notifying your team for testing and feedback. Wraps the ta-cli binary to provide a
156
+ single upload_to_testappio Fastlane action with platform detection, release notes
157
+ from git, and selective team notifications.
160
158
  email: support@testapp.io
161
159
  executables: []
162
160
  extensions: []
163
161
  extra_rdoc_files: []
164
162
  files:
163
+ - CHANGELOG.md
165
164
  - LICENSE
166
165
  - README.md
167
166
  - lib/fastlane/plugin/testappio.rb
@@ -171,8 +170,12 @@ files:
171
170
  homepage: https://github.com/testappio/fastlane-plugin-testappio
172
171
  licenses:
173
172
  - MIT
174
- metadata: {}
175
- post_install_message:
173
+ metadata:
174
+ rubygems_mfa_required: 'true'
175
+ source_code_uri: https://github.com/testappio/fastlane-plugin-testappio
176
+ changelog_uri: https://github.com/testappio/fastlane-plugin-testappio/blob/main/CHANGELOG.md
177
+ bug_tracker_uri: https://github.com/testappio/fastlane-plugin-testappio/issues
178
+ post_install_message:
176
179
  rdoc_options: []
177
180
  require_paths:
178
181
  - lib
@@ -180,15 +183,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
183
  requirements:
181
184
  - - ">="
182
185
  - !ruby/object:Gem::Version
183
- version: '2.6'
186
+ version: '3.0'
184
187
  required_rubygems_version: !ruby/object:Gem::Requirement
185
188
  requirements:
186
189
  - - ">="
187
190
  - !ruby/object:Gem::Version
188
191
  version: '0'
189
192
  requirements: []
190
- rubygems_version: 3.4.12
191
- signing_key:
193
+ rubygems_version: 3.4.19
194
+ signing_key:
192
195
  specification_version: 4
193
196
  summary: Deploy your Android & iOS to TestApp.io
194
197
  test_files: []