fastlane-plugin-emerge 0.10.3 → 0.10.5
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 +4 -4
- data/README.md +10 -6
- data/lib/fastlane/plugin/emerge/actions/emerge_action.rb +19 -4
- data/lib/fastlane/plugin/emerge/actions/emerge_snapshot_action.rb +6 -0
- data/lib/fastlane/plugin/emerge/helper/emerge_helper.rb +5 -2
- data/lib/fastlane/plugin/emerge/helper/git.rb +42 -2
- data/lib/fastlane/plugin/emerge/helper/github.rb +11 -0
- data/lib/fastlane/plugin/emerge/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de3ddd9edc7ad6cc0251439995927fd37c46d1e9905a570f611e54e9d682853e
|
4
|
+
data.tar.gz: e834409e7a58ce89ea2baa3438e2f504255d76cc882b0bf445fecca5e766483a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b701d70f959737afc5b20801ac85a2ab6d3fd089d062c953c11bd55afa745cedb062f7f21dc96fba0c82c27711c783d1014e2d60f6155c5f0c3fcbbb6ecc5bf0
|
7
|
+
data.tar.gz: 48afc9f1263e92a106b2b9607fc0abc7cffb7912ae94820c55354ff6f7319c886935b272e93a2ec8b453edc6cd5eaa68917dc2eb129c52d0fad8b41387086040
|
data/README.md
CHANGED
@@ -22,14 +22,17 @@ To get started, first obtain an [API token](https://docs.emergetools.com/docs/up
|
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
platform :ios do
|
25
|
-
lane :
|
26
|
-
#
|
27
|
-
|
28
|
-
emerge()
|
25
|
+
lane :emerge_upload do
|
26
|
+
# Tip: group builds in our dashboard via the `tag` parameter
|
27
|
+
emerge(tag: 'pr_build')
|
29
28
|
end
|
30
29
|
end
|
31
30
|
```
|
32
31
|
|
32
|
+
1. Produce a build using `gym()`, `run_tests()`, or other Fastlane actions
|
33
|
+
2. When you are ready to upload to Emerge, simply call the `emerge()` action
|
34
|
+
- a. We will automatically detect the most recently built app to upload, or you can manually pass in a `file_path` parameter
|
35
|
+
|
33
36
|
For a full list of available parameters run `fastlane action emerge`.
|
34
37
|
|
35
38
|
### Snapshot Testing
|
@@ -49,12 +52,13 @@ For a full list of available parameters run `fastlane action emerge_snapshot`.
|
|
49
52
|
|
50
53
|
## Git Configuration
|
51
54
|
|
52
|
-
For build comparisons to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, and `
|
55
|
+
For build comparisons to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, `repo_name`, and `previous_sha` for the best experience.
|
53
56
|
|
54
57
|
For example:
|
55
58
|
|
56
|
-
- `sha`: `pr-branch-commit-
|
59
|
+
- `sha`: `pr-branch-commit-2`
|
57
60
|
- `base_sha`: `main-branch-commit-1`
|
61
|
+
- `previous_sha`: `pr-branch-commit-1`
|
58
62
|
- `pr_number`: `42`
|
59
63
|
- `branch`: `my-awesome-feature`
|
60
64
|
- `repo_name`: `EmergeTools/hackernews`
|
@@ -13,16 +13,24 @@ module Fastlane
|
|
13
13
|
class EmergeAction < Action
|
14
14
|
def self.run(params)
|
15
15
|
api_token = params[:api_token]
|
16
|
-
file_path = params[:file_path] || lane_context[SharedValues::XCODEBUILD_ARCHIVE]
|
17
16
|
|
18
|
-
if file_path
|
19
|
-
|
20
|
-
|
17
|
+
file_path = if params[:file_path]
|
18
|
+
UI.message("Using input file_path: #{file_path}")
|
19
|
+
params[:file_path]
|
20
|
+
elsif lane_context[SharedValues::XCODEBUILD_ARCHIVE]
|
21
|
+
UI.message("Using XCODEBUILD_ARCHIVE path")
|
22
|
+
lane_context[SharedValues::XCODEBUILD_ARCHIVE]
|
23
|
+
else
|
24
|
+
UI.message("Falling back to searching SCAN_DERIVED_DATA_PATH")
|
25
|
+
Dir.glob("#{lane_context[SharedValues::SCAN_DERIVED_DATA_PATH]}/Build/Products/Debug-iphonesimulator/*.app").first
|
26
|
+
end
|
27
|
+
|
21
28
|
git_params = Helper::EmergeHelper.make_git_params
|
22
29
|
pr_number = params[:pr_number] || git_params.pr_number
|
23
30
|
branch = params[:branch] || git_params.branch
|
24
31
|
sha = params[:sha] || params[:build_id] || git_params.sha
|
25
32
|
base_sha = params[:base_sha] || params[:base_build_id] || git_params.base_sha
|
33
|
+
previous_sha = params[:previous_sha] || git_params.previous_sha
|
26
34
|
repo_name = params[:repo_name] || git_params.repo_name
|
27
35
|
gitlab_project_id = params[:gitlab_project_id]
|
28
36
|
tag = params[:tag]
|
@@ -32,6 +40,8 @@ module Fastlane
|
|
32
40
|
if file_path.nil? || !File.exist?(file_path)
|
33
41
|
UI.error("Invalid input file")
|
34
42
|
return false
|
43
|
+
else
|
44
|
+
UI.message("Using file_path: #{file_path}")
|
35
45
|
end
|
36
46
|
extension = File.extname(file_path)
|
37
47
|
|
@@ -96,6 +106,7 @@ module Fastlane
|
|
96
106
|
branch: branch,
|
97
107
|
sha: sha,
|
98
108
|
baseSha: base_sha,
|
109
|
+
previousSha: previous_sha,
|
99
110
|
repoName: repo_name,
|
100
111
|
gitlabProjectId: gitlab_project_id,
|
101
112
|
orderFileVersion: order_file_version,
|
@@ -163,6 +174,10 @@ module Fastlane
|
|
163
174
|
description: "The git SHA of the base build",
|
164
175
|
optional: true,
|
165
176
|
type: String),
|
177
|
+
FastlaneCore::ConfigItem.new(key: :previous_sha,
|
178
|
+
description: "The git SHA of the commit right before this build's commit",
|
179
|
+
optional: true,
|
180
|
+
type: String),
|
166
181
|
FastlaneCore::ConfigItem.new(key: :build_id,
|
167
182
|
description: "A string to identify this build",
|
168
183
|
deprecated: "Replaced by `sha`",
|
@@ -19,6 +19,7 @@ module Fastlane
|
|
19
19
|
branch = params[:branch] || git_params.branch
|
20
20
|
sha = params[:sha] || git_params.sha
|
21
21
|
base_sha = params[:base_sha] || git_params.base_sha
|
22
|
+
previous_sha = params[:previous_sha] || git_params.previous_sha
|
22
23
|
repo_name = params[:repo_name] || git_params.repo_name
|
23
24
|
gitlab_project_id = params[:gitlab_project_id]
|
24
25
|
tag = params[:tag]
|
@@ -54,6 +55,7 @@ module Fastlane
|
|
54
55
|
branch: branch,
|
55
56
|
sha: sha,
|
56
57
|
baseSha: base_sha,
|
58
|
+
previousSha: previous_sha,
|
57
59
|
repoName: repo_name,
|
58
60
|
gitlabProjectId: gitlab_project_id,
|
59
61
|
tag: tag || "default"
|
@@ -133,6 +135,10 @@ module Fastlane
|
|
133
135
|
description: "The git SHA of the base build",
|
134
136
|
optional: true,
|
135
137
|
type: String),
|
138
|
+
FastlaneCore::ConfigItem.new(key: :previous_sha,
|
139
|
+
description: "The git SHA of the commit right before this build's commit",
|
140
|
+
optional: true,
|
141
|
+
type: String),
|
136
142
|
FastlaneCore::ConfigItem.new(key: :repo_name,
|
137
143
|
description: "Full name of the respository this upload was triggered from. For example: EmergeTools/Emerge",
|
138
144
|
optional: true,
|
@@ -5,12 +5,13 @@ module Fastlane
|
|
5
5
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
6
6
|
|
7
7
|
class GitResult
|
8
|
-
attr_accessor :sha, :base_sha, :branch, :pr_number, :repo_name
|
8
|
+
attr_accessor :sha, :base_sha, :previous_sha, :branch, :pr_number, :repo_name
|
9
9
|
|
10
|
-
def initialize(sha:, base_sha:, branch:, pr_number: nil, repo_name: nil)
|
10
|
+
def initialize(sha:, base_sha:, previous_sha:, branch:, pr_number: nil, repo_name: nil)
|
11
11
|
@pr_number = pr_number
|
12
12
|
@sha = sha
|
13
13
|
@base_sha = base_sha
|
14
|
+
@previous_sha = previous_sha
|
14
15
|
@branch = branch
|
15
16
|
@repo_name = repo_name
|
16
17
|
end
|
@@ -36,6 +37,7 @@ module Fastlane
|
|
36
37
|
GitResult.new(
|
37
38
|
sha: Helper::Github.sha,
|
38
39
|
base_sha: Helper::Github.base_sha,
|
40
|
+
previous_sha: Helper::Github.previous_sha,
|
39
41
|
branch: Helper::Github.branch,
|
40
42
|
pr_number: Helper::Github.pr_number,
|
41
43
|
repo_name: Helper::Github.repo_name
|
@@ -45,6 +47,7 @@ module Fastlane
|
|
45
47
|
GitResult.new(
|
46
48
|
sha: Helper::Git.sha,
|
47
49
|
base_sha: Helper::Git.base_sha,
|
50
|
+
previous_sha: Helper::Git.previous_sha,
|
48
51
|
branch: Helper::Git.branch
|
49
52
|
)
|
50
53
|
end
|
@@ -8,7 +8,36 @@ module Fastlane
|
|
8
8
|
shell_command = "git rev-parse --abbrev-ref HEAD"
|
9
9
|
UI.command(shell_command)
|
10
10
|
stdout, _, status = Open3.capture3(shell_command)
|
11
|
-
|
11
|
+
unless status.success?
|
12
|
+
UI.error("Failed to get the current branch name")
|
13
|
+
return nil
|
14
|
+
end
|
15
|
+
|
16
|
+
branch_name = stdout.strip
|
17
|
+
if branch_name == "HEAD"
|
18
|
+
# We're in a detached HEAD state
|
19
|
+
# Find all branches that contains the current HEAD commit
|
20
|
+
#
|
21
|
+
# Example output:
|
22
|
+
# * (HEAD detached at dec13a5)
|
23
|
+
# telkins/detached-test
|
24
|
+
# remotes/origin/telkins/detached-test
|
25
|
+
#
|
26
|
+
# So far I've seen this output be fairly stable
|
27
|
+
# If the input is invalid for whatever reason, sed/awk will return an empty string
|
28
|
+
shell_command = "git branch -a --contains HEAD | sed -n 2p | awk '{ printf $1 }'"
|
29
|
+
UI.command(shell_command)
|
30
|
+
head_stdout, _, head_status = Open3.capture3(shell_command)
|
31
|
+
|
32
|
+
unless head_status.success?
|
33
|
+
UI.error("Failed to get the current branch name for detached HEAD")
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
37
|
+
branch_name = head_stdout.strip
|
38
|
+
end
|
39
|
+
|
40
|
+
branch_name == "HEAD" ? nil : branch_name
|
12
41
|
end
|
13
42
|
|
14
43
|
def self.sha
|
@@ -19,7 +48,11 @@ module Fastlane
|
|
19
48
|
end
|
20
49
|
|
21
50
|
def self.base_sha
|
22
|
-
|
51
|
+
current_branch = branch
|
52
|
+
remote_head = remote_head_branch
|
53
|
+
return nil if current_branch.nil? || remote_head.nil?
|
54
|
+
|
55
|
+
shell_command = "git merge-base #{remote_head} #{current_branch}"
|
23
56
|
UI.command(shell_command)
|
24
57
|
stdout, _, status = Open3.capture3(shell_command)
|
25
58
|
return nil if stdout.strip.empty? || !status.success?
|
@@ -27,6 +60,13 @@ module Fastlane
|
|
27
60
|
stdout.strip == current_sha ? nil : stdout.strip
|
28
61
|
end
|
29
62
|
|
63
|
+
def self.previous_sha
|
64
|
+
shell_command = "git rev-parse HEAD^"
|
65
|
+
UI.command(shell_command)
|
66
|
+
stdout, _, status = Open3.capture3(shell_command)
|
67
|
+
stdout.strip if status.success?
|
68
|
+
end
|
69
|
+
|
30
70
|
def self.primary_remote
|
31
71
|
remote = remote()
|
32
72
|
return nil if remote.nil?
|
@@ -39,6 +39,17 @@ module Fastlane
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.previous_sha
|
43
|
+
if is_push?
|
44
|
+
github_event_data.dig(:before)
|
45
|
+
else
|
46
|
+
shell_command = "git rev-parse HEAD^"
|
47
|
+
UI.command(shell_command)
|
48
|
+
stdout, _, status = Open3.capture3(shell_command)
|
49
|
+
stdout.strip if status.success?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
42
53
|
def self.pr_number
|
43
54
|
is_pull_request? ? github_event_data.dig(:number) : nil
|
44
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-emerge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emerge Tools, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|