Skip to content

Commit 12347db

Browse files
committed
update tests to work on GHA runners
1 parent 36e3808 commit 12347db

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636

3737
- name: run specs
3838
run: |
39-
curl -o- https://raw.githubusercontent.com/bugsnag/bugsnag-cli/main/install.sh | bash
4039
bundle config path vendor/fastlane-bundle
4140
bundle install --gemfile=tools/fastlane-plugin/Gemfile
4241
cd tools/fastlane-plugin

tools/fastlane-plugin/spec/bugsnag_upload_dsym_action_spec.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,14 @@ def run_with args
148148
end
149149

150150
it 'accepts a custom bugsnag_cli_path as an option' do
151-
custom_cli_path = File.join(ENV['HOME'], ".local/bugsnag/bin/bugsnag-cli")
152-
expect(Kernel).to receive(:system).with("#{custom_cli_path} upload dsym --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
153-
run_with({dsym_path: FIXTURE_PATH, bugsnag_cli_path: custom_cli_path})
151+
expect(Kernel).to receive(:system).with("#{CUSTOM_BUGSNAG_CLI_PATH} upload dsym --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
152+
run_with({dsym_path: FIXTURE_PATH, bugsnag_cli_path: CUSTOM_BUGSNAG_CLI_PATH})
154153
end
155154

156155
it 'accepts a custom bugsnag_cli_path with an API key' do
157-
custom_cli_path = File.join(ENV['HOME'], ".local/bugsnag/bin/bugsnag-cli")
158156
api_key = "123456789012345678901234567890FF"
159-
expect(Kernel).to receive(:system).with("#{custom_cli_path} upload dsym --api-key #{api_key} --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
160-
run_with({dsym_path: FIXTURE_PATH, api_key: api_key, bugsnag_cli_path: custom_cli_path})
157+
expect(Kernel).to receive(:system).with("#{CUSTOM_BUGSNAG_CLI_PATH} upload dsym --api-key #{api_key} --project-root #{Dir::pwd} \"#{FIXTURE_PATH}\"").and_return(true)
158+
run_with({dsym_path: FIXTURE_PATH, api_key: api_key, bugsnag_cli_path: CUSTOM_BUGSNAG_CLI_PATH})
161159
end
162160
end
163161
end

tools/fastlane-plugin/spec/spec_helper.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,24 @@ module SpecHelper
77
require 'fastlane' # to import the Action super class
88
require 'fastlane/plugin/bugsnag' # import the actual plugin
99

10+
def current_os_and_arch
11+
os = case RbConfig::CONFIG['host_os']
12+
when /darwin/ then 'macos'
13+
when /linux/ then 'linux'
14+
when /mswin|mingw/ then 'windows'
15+
else raise "Unsupported OS: #{RbConfig::CONFIG['host_os']}"
16+
end
17+
18+
arch = case RbConfig::CONFIG['host_cpu']
19+
when /x86_64/ then 'x86_64'
20+
when /i386/ then 'i386'
21+
when /arm64/ then 'arm64'
22+
else raise "Unsupported architecture: #{RbConfig::CONFIG['host_cpu']}"
23+
end
24+
25+
"#{arch}-#{os}"
26+
end
27+
1028
FIXTURE_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
29+
BUGSNAG_CLI_BIN_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..','..' ,'..','..','bugsnag-cli', 'bin'))
30+
CUSTOM_BUGSNAG_CLI_PATH = File.join(BUGSNAG_CLI_BIN_PATH, "#{current_os_and_arch}-bugsnag-cli")

0 commit comments

Comments
 (0)