appsignal 3.9.1-java → 3.9.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3135 -0
  3. data/.rubocop.yml +28 -20
  4. data/.rubocop_todo.yml +7 -33
  5. data/CHANGELOG.md +58 -0
  6. data/Rakefile +79 -64
  7. data/appsignal.gemspec +1 -1
  8. data/build_matrix.yml +109 -179
  9. data/ext/base.rb +1 -1
  10. data/gemfiles/hanami-2.1.gemfile +7 -0
  11. data/lib/appsignal/cli/diagnose.rb +1 -1
  12. data/lib/appsignal/config.rb +1 -1
  13. data/lib/appsignal/demo.rb +0 -1
  14. data/lib/appsignal/environment.rb +5 -1
  15. data/lib/appsignal/extension/jruby.rb +1 -1
  16. data/lib/appsignal/helpers/instrumentation.rb +3 -3
  17. data/lib/appsignal/hooks/active_job.rb +2 -1
  18. data/lib/appsignal/integrations/action_cable.rb +1 -1
  19. data/lib/appsignal/integrations/grape.rb +19 -47
  20. data/lib/appsignal/integrations/hanami.rb +27 -41
  21. data/lib/appsignal/integrations/padrino.rb +46 -43
  22. data/lib/appsignal/integrations/railtie.rb +1 -4
  23. data/lib/appsignal/integrations/resque.rb +1 -1
  24. data/lib/appsignal/integrations/sidekiq.rb +2 -4
  25. data/lib/appsignal/integrations/sinatra.rb +7 -2
  26. data/lib/appsignal/probes/gvl.rb +24 -2
  27. data/lib/appsignal/probes/sidekiq.rb +1 -1
  28. data/lib/appsignal/probes.rb +1 -1
  29. data/lib/appsignal/rack/abstract_middleware.rb +62 -28
  30. data/lib/appsignal/rack/event_handler.rb +37 -26
  31. data/lib/appsignal/rack/grape_middleware.rb +40 -0
  32. data/lib/appsignal/rack/hanami_middleware.rb +20 -0
  33. data/lib/appsignal/rack/rails_instrumentation.rb +14 -56
  34. data/lib/appsignal/utils/integration_memory_logger.rb +78 -0
  35. data/lib/appsignal/utils.rb +1 -0
  36. data/lib/appsignal/version.rb +1 -1
  37. data/lib/appsignal.rb +34 -33
  38. data/spec/.rubocop.yml +1 -1
  39. data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
  40. data/spec/lib/appsignal/cli/install_spec.rb +3 -3
  41. data/spec/lib/appsignal/config_spec.rb +7 -5
  42. data/spec/lib/appsignal/demo_spec.rb +38 -41
  43. data/spec/lib/appsignal/hooks/action_cable_spec.rb +86 -167
  44. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +8 -20
  45. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +38 -84
  46. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +16 -37
  47. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +4 -4
  48. data/spec/lib/appsignal/hooks/activejob_spec.rb +111 -200
  49. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +54 -91
  50. data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +14 -32
  51. data/spec/lib/appsignal/hooks/excon_spec.rb +8 -12
  52. data/spec/lib/appsignal/hooks/net_http_spec.rb +7 -42
  53. data/spec/lib/appsignal/hooks/rake_spec.rb +9 -19
  54. data/spec/lib/appsignal/hooks/redis_client_spec.rb +18 -30
  55. data/spec/lib/appsignal/hooks/redis_spec.rb +10 -16
  56. data/spec/lib/appsignal/hooks/resque_spec.rb +42 -62
  57. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +33 -74
  58. data/spec/lib/appsignal/integrations/hanami_spec.rb +126 -64
  59. data/spec/lib/appsignal/integrations/http_spec.rb +12 -20
  60. data/spec/lib/appsignal/integrations/net_http_spec.rb +33 -0
  61. data/spec/lib/appsignal/integrations/object_spec.rb +29 -36
  62. data/spec/lib/appsignal/integrations/padrino_spec.rb +47 -70
  63. data/spec/lib/appsignal/integrations/que_spec.rb +43 -70
  64. data/spec/lib/appsignal/integrations/railtie_spec.rb +26 -67
  65. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +86 -160
  66. data/spec/lib/appsignal/integrations/sinatra_spec.rb +8 -3
  67. data/spec/lib/appsignal/integrations/webmachine_spec.rb +28 -39
  68. data/spec/lib/appsignal/probes/gvl_spec.rb +80 -3
  69. data/spec/lib/appsignal/probes_spec.rb +7 -4
  70. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +215 -106
  71. data/spec/lib/appsignal/rack/event_handler_spec.rb +151 -69
  72. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -12
  73. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +234 -0
  74. data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +36 -0
  75. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +67 -131
  76. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +36 -44
  77. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +68 -86
  78. data/spec/lib/appsignal/transaction_spec.rb +79 -93
  79. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +163 -0
  80. data/spec/lib/appsignal_spec.rb +363 -342
  81. data/spec/support/hanami/hanami_app.rb +1 -3
  82. data/spec/support/helpers/dependency_helper.rb +6 -1
  83. data/spec/support/helpers/std_streams_helper.rb +1 -1
  84. data/spec/support/helpers/transaction_helpers.rb +8 -0
  85. data/spec/support/matchers/transaction.rb +185 -0
  86. data/spec/support/mocks/dummy_app.rb +20 -0
  87. data/spec/support/shared_examples/instrument.rb +17 -12
  88. data/spec/support/testing.rb +18 -9
  89. metadata +17 -10
  90. data/.semaphore/semaphore.yml +0 -2347
  91. data/script/lint_git +0 -22
  92. data/spec/lib/appsignal/integrations/grape_spec.rb +0 -239
  93. data/spec/support/matchers/be_completed.rb +0 -5
  94. /data/gemfiles/{hanami.gemfile → hanami-2.0.gemfile} +0 -0
data/.rubocop.yml CHANGED
@@ -51,6 +51,20 @@ Style/Lambda:
51
51
  Style/WordArray:
52
52
  Enabled: false
53
53
 
54
+ Style/FrozenStringLiteralComment:
55
+ Enabled: true
56
+ Exclude:
57
+ - "spec/**/*.rb"
58
+
59
+ Style/NumericPredicate:
60
+ Enabled: false
61
+
62
+ Style/SymbolArray:
63
+ EnforcedStyle: brackets
64
+
65
+ Style/RedundantConstantBase:
66
+ Enabled: false
67
+
54
68
  Lint/ConstantDefinitionInBlock:
55
69
  Exclude:
56
70
  - "spec/**/*.rb"
@@ -59,6 +73,10 @@ Lint/EmptyClass:
59
73
  Exclude:
60
74
  - "spec/**/*.rb"
61
75
 
76
+ Lint/EmptyFile:
77
+ Exclude:
78
+ - "spec/**/*.rb"
79
+
62
80
  Layout/HashAlignment:
63
81
  EnforcedLastArgumentHashStyle: ignore_implicit
64
82
 
@@ -83,20 +101,27 @@ Layout/MultilineMethodCallIndentation:
83
101
  Layout/MultilineOperationIndentation:
84
102
  EnforcedStyle: indented
85
103
 
86
- Lint/EmptyFile:
87
- Exclude:
88
- - "spec/**/*.rb"
104
+ Layout/LineLength:
105
+ Max: 100
89
106
 
90
107
  Naming/FileName:
91
108
  Exclude:
92
109
  - "ext/Rakefile"
93
110
 
111
+ Naming/AccessorMethodName:
112
+ Exclude:
113
+ - "lib/appsignal/helpers/instrumentation.rb"
114
+ - "lib/appsignal/transaction.rb"
115
+
94
116
  Naming/RescuedExceptionsVariableName:
95
117
  Enabled: false
96
118
 
97
119
  Naming/VariableNumber:
98
120
  Enabled: false
99
121
 
122
+ Metrics/ModuleLength:
123
+ Enabled: false
124
+
100
125
  Metrics/ClassLength:
101
126
  Enabled: false
102
127
 
@@ -104,22 +129,5 @@ Metrics/BlockLength:
104
129
  Exclude:
105
130
  - "Rakefile"
106
131
 
107
- Style/FrozenStringLiteralComment:
108
- Enabled: true
109
- Exclude:
110
- - "spec/**/*.rb"
111
-
112
- Style/NumericPredicate:
113
- Enabled: false
114
-
115
- Style/SymbolArray:
116
- EnforcedStyle: brackets
117
-
118
- Style/RedundantConstantBase:
119
- Enabled: false
120
-
121
132
  Gemspec/DevelopmentDependencies:
122
133
  Enabled: false
123
-
124
- Layout/LineLength:
125
- Max: 100
data/.rubocop_todo.yml CHANGED
@@ -1,66 +1,49 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-04-12 14:23:03 UTC using RuboCop version 1.50.0.
3
+ # on 2024-06-27 09:42:06 UTC using RuboCop version 1.64.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
12
- # URISchemes: http, https
13
- Layout/LineLength:
14
- Max: 112
15
-
16
9
  # Offense count: 2
10
+ # Configuration parameters: AllowedParentClasses.
17
11
  Lint/MissingSuper:
18
12
  Exclude:
19
13
  - 'lib/appsignal/extension.rb'
20
14
  - 'lib/appsignal/logger.rb'
21
15
 
22
- # Offense count: 1
23
- Lint/NoReturnInBeginEndBlocks:
24
- Exclude:
25
- - 'lib/appsignal/environment.rb'
26
-
27
16
  # Offense count: 1
28
17
  Lint/StructNewOverride:
29
18
  Exclude:
30
19
  - 'spec/lib/appsignal/probes/sidekiq_spec.rb'
31
20
 
32
- # Offense count: 53
21
+ # Offense count: 63
33
22
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
34
23
  Metrics/AbcSize:
35
24
  Max: 44
36
25
 
37
- # Offense count: 5
26
+ # Offense count: 6
38
27
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
39
28
  # AllowedMethods: refine
40
29
  Metrics/BlockLength:
41
30
  Max: 31
42
31
 
43
- # Offense count: 17
32
+ # Offense count: 21
44
33
  # Configuration parameters: AllowedMethods, AllowedPatterns.
45
34
  Metrics/CyclomaticComplexity:
46
35
  Max: 11
47
36
 
48
- # Offense count: 127
37
+ # Offense count: 139
49
38
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
50
39
  Metrics/MethodLength:
51
40
  Max: 56
52
41
 
53
- # Offense count: 12
42
+ # Offense count: 18
54
43
  # Configuration parameters: AllowedMethods, AllowedPatterns.
55
44
  Metrics/PerceivedComplexity:
56
45
  Max: 13
57
46
 
58
- # Offense count: 7
59
- Naming/AccessorMethodName:
60
- Exclude:
61
- - 'lib/appsignal/helpers/instrumentation.rb'
62
- - 'lib/appsignal/transaction.rb'
63
-
64
47
  # Offense count: 2
65
48
  Security/Open:
66
49
  Exclude:
@@ -82,15 +65,6 @@ Style/Alias:
82
65
  - 'lib/appsignal/helpers/instrumentation.rb'
83
66
  - 'lib/appsignal/transaction.rb'
84
67
 
85
- # Offense count: 2
86
- # This cop supports unsafe autocorrection (--autocorrect-all).
87
- # Configuration parameters: EnforcedStyle.
88
- # SupportedStyles: nested, compact
89
- Style/ClassAndModuleChildren:
90
- Exclude:
91
- - 'lib/appsignal/integrations/hanami.rb'
92
- - 'lib/appsignal/integrations/padrino.rb'
93
-
94
68
  # Offense count: 1
95
69
  Style/ClassVars:
96
70
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.9.3
4
+
5
+ _Published on 2024-07-02._
6
+
7
+ ### Added
8
+
9
+ - [0230ab4d](https://github.com/appsignal/appsignal-ruby/commit/0230ab4da00d75e4fc72fd493fc98441b5d7254d) patch - Track error response status for web requests. When an unhandled exception reaches the AppSignal EventHandler instrumentation, report the response status as `500` for the `response_status` tag on the transaction and on the `response_status` metric.
10
+
11
+ ### Changed
12
+
13
+ - [b3a80038](https://github.com/appsignal/appsignal-ruby/commit/b3a800380c0d83422d7f3c0e9c93551d343c50c0) patch - Require the AppSignal gem in the Grape integration file. Previously `require "appsignal"` had to be called before `require "appsignal/integrations/grape"`. This `require "appsignal"` is no longer required.
14
+ - [e9aa0603](https://github.com/appsignal/appsignal-ruby/commit/e9aa06031b6c17f9f2704250bb1775a4cb72b276) patch - Report Global VM Lock metrics per process. In addition to the existing `hostname` tag, add `process_name` and `process_id` tags to the `gvl_global_timer` and `gvl_waiting_threads` metrics emitted by the [GVL probe](https://docs.appsignal.com/ruby/integrations/global-vm-lock.html), allowing these metrics to be tracked in a per-process basis.
15
+
16
+ ### Deprecated
17
+
18
+ - [844aa0af](https://github.com/appsignal/appsignal-ruby/commit/844aa0afa3311860dca84badc27c2be8996bfd3c) patch - Deprecate `Appsignal::Grape::Middleware` constant in favor of `Appsignal::Rack::GrapeMiddleware` constant.
19
+
20
+ To fix this deprecation warning, update the usage of `Appsignal::Grape::Middleware` like this:
21
+
22
+ ```ruby
23
+ # Grape only apps
24
+ insert_before Grape::Middleware::Error, Appsignal::Rack::GrapeMiddleware
25
+ # or
26
+ use Appsignal::Rack::GrapeMiddleware
27
+
28
+ # Grape on Rails app
29
+ use Appsignal::Rack::GrapeMiddleware
30
+ ```
31
+ - [1f648ab4](https://github.com/appsignal/appsignal-ruby/commit/1f648ab4d0372f37d15a980a9902779834811531) patch - Deprecate the `Appsignal.start_logger` method. Remove this method call from apps if it is present. Calling `Appsignal.start` will now initialize the logger.
32
+
33
+ ### Fixed
34
+
35
+ - [0bb29809](https://github.com/appsignal/appsignal-ruby/commit/0bb29809f1750bdac2b66a1132a3638c58e6d1f8) patch - Fix an issue with invalid request methods raising an error in the GenericInstrumentation middleware when using a request class that throws an error when calling the `request_method` method, like `ActionDispatch::Request`.
36
+ - [66bb7a60](https://github.com/appsignal/appsignal-ruby/commit/66bb7a60cafd3fb1a91d4ed0430d51ee8ac8de46) patch - Support Grape apps that are nested in other apps like Sinatra and Rails, that also include AppSignal middleware for instrumentation.
37
+ - [a7b056bd](https://github.com/appsignal/appsignal-ruby/commit/a7b056bd333912b3b6388d68d6dd3af0b2cb9a75) patch - Support Hanami version 2.1. On older versions of our Ruby gem it would error on an unknown keyword argument "sessions_enabled".
38
+ - [00b7ac6a](https://github.com/appsignal/appsignal-ruby/commit/00b7ac6a9128d47fa9d3a1556f73a14304de8944) patch - Fix issue with AppSignal getting stuck in a boot loop when loading the Hanami integration with: `require "appsignal/integrations/hanami"`
39
+ This could happen in nested applications, like a Hanami app in a Rails app. It will now use the first config AppSignal starts with.
40
+
41
+ ## 3.9.2
42
+
43
+ _Published on 2024-06-26._
44
+
45
+ ### Added
46
+
47
+ - Improve instrumentation of Hanami requests by making sure the transaction is always closed.
48
+ It will also report a `response_status` tag and metric for Hanami requests.
49
+
50
+ (patch [e79d4277](https://github.com/appsignal/appsignal-ruby/commit/e79d4277046bf4ec0d32263d06d4975ca8c426ee))
51
+
52
+ ### Changed
53
+
54
+ - Instrument the entire Sinatra request. Instrumenting Sinatra apps using `require "appsignal/integrations/sinatra"` will now report more of the request, if previously other middleware were not instrumented. It will also report the response status with the `response_status` tag and metric. (patch [15b3390b](https://github.com/appsignal/appsignal-ruby/commit/15b3390b5b54cdc7378d69c92d91ec51dab1b0e4))
55
+
56
+ ### Fixed
57
+
58
+ - Fix deprecation warnings about `Transacation.params=` usage by updating how we record parameters in our instrumentations. (patch [b65d6674](https://github.com/appsignal/appsignal-ruby/commit/b65d6674c93afbc95e9cecee8c032e6949229aab))
59
+ - Fix error reporting for requests with an error that use the AppSignal EventHandler. (patch [0e48f19b](https://github.com/appsignal/appsignal-ruby/commit/0e48f19bb9f5c3ead96d21fbacdd5d7f221e2063))
60
+
3
61
  ## 3.9.1
4
62
 
5
63
  _Published on 2024-06-24._
data/Rakefile CHANGED
@@ -20,98 +20,113 @@ VERSION_MANAGERS = {
20
20
  }
21
21
  }.freeze
22
22
 
23
- def env_map(key, value)
23
+ def build_job(ruby_version, ruby_gem = nil)
24
24
  {
25
- "name" => key,
26
- "value" => value
25
+ "name" => "Ruby #{ruby_version}#{" - #{ruby_gem}" if ruby_gem}",
26
+ "needs" => "validation",
27
+ "runs-on" => "ubuntu-latest",
28
+ "steps" => [
29
+ {
30
+ "name" => "Check out repository",
31
+ "uses" => "actions/checkout@v4"
32
+ },
33
+ {
34
+ "name" => "Install Ruby",
35
+ "uses" => "ruby/setup-ruby@v1",
36
+ "with" => {
37
+ "ruby-version" => ruby_version,
38
+ "bundler-cache" => true
39
+ }
40
+ },
41
+ {
42
+ "name" => "Install gem extension",
43
+ "run" => "./support/bundler_wrapper exec rake extension:install"
44
+ },
45
+ {
46
+ "name" => "Print extension install report",
47
+ "run" => "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'" # rubocop:disable Layout/LineLength
48
+ },
49
+ {
50
+ "name" => "Print Makefile log file",
51
+ "run" => "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
52
+ }
53
+ ]
27
54
  }
28
55
  end
29
56
 
30
- def build_task(matrix, ruby_version, type = nil)
31
- {
32
- "name" => "Ruby #{ruby_version}#{type ? " - #{type}" : nil}",
33
- "dependencies" => ["Validation"],
34
- "task" => {
35
- "prologue" => matrix["prologue"].merge(
36
- "commands" => matrix["prologue"]["commands"] + [
37
- "./support/bundler_wrapper exec rake extension:install",
38
- "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report file found'", # rubocop:disable Metrics/LineLength
39
- "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file found'"
40
- ]
41
- ),
42
- "epilogue" => matrix["epilogue"],
43
- "jobs" => []
44
- }
45
- }
57
+ def build_matrix_key(ruby_version, ruby_gem = nil)
58
+ base = "ruby_#{ruby_version}"
59
+ base = "#{base}__#{ruby_gem}" if ruby_gem
60
+ base.downcase.gsub(/\W/, "-")
46
61
  end
47
62
 
48
63
  def gems_with_gemfiles
49
64
  YAML.load_file("build_matrix.yml")["matrix"]["gems"].map { |g| g["gem"] }.freeze
50
65
  end
51
66
 
67
+ GITHUB_ACTION_WORKFLOW_FILE = ".github/workflows/ci.yml"
68
+
52
69
  namespace :build_matrix do
53
- namespace :semaphore do
70
+ namespace :github do
54
71
  task :generate do
55
72
  yaml = YAML.load_file("build_matrix.yml")
56
73
  matrix = yaml["matrix"]
57
- defaults = matrix["defaults"]
58
- semaphore = yaml["semaphore"]
74
+ github = yaml["github"]
59
75
 
60
- builds = []
76
+ builds = {}
61
77
  matrix["ruby"].each do |ruby|
62
78
  ruby_version = ruby["ruby"]
63
- ruby_primary_block = build_task(matrix, ruby_version)
64
- ruby_secondary_block = build_task(matrix, ruby_version, "Gems").tap do |t|
65
- t["dependencies"] = ["Ruby #{ruby_version}"]
66
- end
67
- gemset_for_ruby(ruby, matrix).each do |gem|
68
- next unless included_for_ruby?(matrix, gem, ruby)
69
-
70
- env = matrix["env_vars"] + [
71
- env_map("RUBY_VERSION", ruby_version),
72
- env_map("GEMSET", gem["gem"]),
73
- env_map("BUNDLE_GEMFILE", "gemfiles/#{gem["gem"]}.gemfile")
74
- ]
75
- rubygems = gem["rubygems"] || ruby["rubygems"] || defaults["rubygems"]
76
- env << env_map("_RUBYGEMS_VERSION", rubygems) if rubygems
77
- bundler = gem["bundler"] || ruby["bundler"] || defaults["bundler"]
78
- env << env_map("_BUNDLER_VERSION", bundler) if bundler
79
-
80
- job = {
81
- "name" => "Ruby #{ruby_version} for #{gem["gem"]}",
82
- "env_vars" => env + ruby.fetch("env_vars", []),
83
- "commands" => [
84
- "./support/bundler_wrapper exec rake test"
85
- ]
79
+ gemset_for_ruby(ruby, matrix).each do |ruby_gem|
80
+ next unless included_for_ruby?(matrix, ruby_gem, ruby)
81
+
82
+ is_primary_job = ruby_gem["gem"] == "no_dependencies"
83
+ job =
84
+ if is_primary_job
85
+ build_job(ruby_version)
86
+ else
87
+ build_job(ruby_version, ruby_gem["gem"])
88
+ end
89
+ job["env"] = matrix["env"]
90
+ .merge("BUNDLE_GEMFILE" => "gemfiles/#{ruby_gem["gem"]}.gemfile")
91
+
92
+ test_step = {
93
+ "name" => "Run tests",
94
+ "run" => "./support/bundler_wrapper exec rake test"
86
95
  }
87
- if gem["gem"] == "no_dependencies"
96
+
97
+ if is_primary_job
98
+ job["steps"] << test_step
88
99
  # Only test the failure scenarios once per Ruby version
89
- job["commands"] << "./support/bundler_wrapper exec rake test:failure"
90
- ruby_primary_block["task"]["jobs"] << job
100
+ job["steps"] << {
101
+ "name" => "Run tests without extension",
102
+ "run" => "./support/bundler_wrapper exec rake test:failure"
103
+ }
104
+ builds[build_matrix_key(ruby["ruby"])] = job
91
105
  else
92
- ruby_secondary_block["task"]["jobs"] << job
106
+ job["needs"] = build_matrix_key(ruby["ruby"])
107
+ job["steps"] << test_step
108
+ builds[build_matrix_key(ruby["ruby"], ruby_gem["gem"])] = job
93
109
  end
94
110
  end
95
- builds << ruby_primary_block
96
- builds << ruby_secondary_block if ruby_secondary_block["task"]["jobs"].count.nonzero?
97
111
  end
98
- semaphore["blocks"] += builds
112
+ github["jobs"] = github["jobs"].merge(builds)
99
113
 
114
+ job_count = github["jobs"].count
100
115
  header = "# DO NOT EDIT\n" \
101
- "# This is a generated file by the `rake build_matrix:semaphore:generate` task.\n" \
116
+ "# This is a generated file by the `rake build_matrix:github:generate` task.\n" \
102
117
  "# See `build_matrix.yml` for the build matrix.\n" \
103
- "# Generate this file with `rake build_matrix:semaphore:generate`.\n"
104
- generated_yaml = header + YAML.dump(semaphore)
105
- File.write(".semaphore/semaphore.yml", generated_yaml)
106
- puts "Generated `.semaphore/semaphore.yml`"
107
- puts "Task count: #{builds.length}"
108
- puts "Job count: #{builds.sum { |block| block["task"]["jobs"].count }}"
118
+ "# Generate this file with `rake build_matrix:github:generate`.\n" \
119
+ "# Generated job count: #{job_count}\n"
120
+ generated_yaml = header + YAML.dump(github)
121
+ File.write(GITHUB_ACTION_WORKFLOW_FILE, generated_yaml)
122
+ puts "Generated `#{GITHUB_ACTION_WORKFLOW_FILE}`"
123
+ puts "Job count: #{job_count}"
109
124
  end
110
125
 
111
126
  task :validate => :generate do
112
127
  output = `git status`
113
- if output.include? ".semaphore/semaphore.yml"
114
- puts "The `.semaphore/semaphore.yml` is modified. The changes were not committed."
128
+ if output.include? GITHUB_ACTION_WORKFLOW_FILE
129
+ puts "The `#{GITHUB_ACTION_WORKFLOW_FILE}` is modified. The changes were not committed."
115
130
  puts "Please run `rake build_matrix:semaphore:generate` and commit the changes."
116
131
  exit 1
117
132
  end
@@ -191,11 +206,11 @@ namespace :build_matrix do
191
206
  if included_rubies.any?
192
207
  # If this gem only runs on these specific Ruby version
193
208
  included_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
194
- return true if included_rubies.include?(ruby["ruby"])
209
+ true if included_rubies.include?(ruby["ruby"])
195
210
  else
196
211
  # If this gem is excluded from running on this Ruby version
197
212
  excluded_rubies.each { |version| check_if_ruby_version_exists!(matrix, version) }
198
- return true unless excluded_rubies.include?(ruby["ruby"])
213
+ true unless excluded_rubies.include?(ruby["ruby"])
199
214
  end
200
215
  end
201
216
 
data/appsignal.gemspec CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
40
40
  gem.add_development_dependency "pry"
41
41
  gem.add_development_dependency "rake", ">= 12"
42
42
  gem.add_development_dependency "rspec", "~> 3.8"
43
- gem.add_development_dependency "rubocop", "1.50.0"
43
+ gem.add_development_dependency "rubocop", "1.64.1"
44
44
  gem.add_development_dependency "timecop"
45
45
  gem.add_development_dependency "webmock"
46
46
  gem.add_development_dependency "yard", ">= 0.9.20"