derailed_benchmarks 2.1.2 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 812e6f5e721e4baf5dd1911b6d4a21d00e3502d5a9c2c882c825026f174f0df7
4
- data.tar.gz: ba3f9978aebf3652f767835edbbb0805d75c127e1a1df247057a04f7f0dde228
3
+ metadata.gz: 97d43dbc2501334c576ce7a1ba6852f8f56cac94939315bac0ebcb5d33dbc408
4
+ data.tar.gz: bb0cfe3dde14ec9b4f36964e6d3c7f21bfd937d88d151bf3cd02333a45949709
5
5
  SHA512:
6
- metadata.gz: f422494ba5fd286bf36531b1c8bf1a8dc28cd6366f1d3ff9f2e81215307969eb1c8f60a6e3f6e27588f95cd7e5ad3c10ba963dfd820769a6f76656ae35d11ae9
7
- data.tar.gz: ecbd77956660e6d0f5ca957fe718d564b2f7463f2197eaf84bad1b0c3ae1e3a42bf7bb58ed46bffc9153c819dd32f13335728556704da9bf9191f82bf95ce467
6
+ metadata.gz: 58e32bafc74b092dff240d25192d9a04956c81a5bae3a1785fffb487ba6d2a10b8157e864cf2190489c22633f5e323c0df5d36464225f69f5665314cea5bc087
7
+ data.tar.gz: d7c18bbbe973cb5bc7b372690ae27d9deaae93ff390c768b0d13bd7766523dfaafdea91a43c931b39b76477ad641c897430194bde3ecc58e1cad2601e0cc04d7
@@ -0,0 +1,22 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "Ruby",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye"
7
+
8
+ // Features to add to the dev container. More info: https://containers.dev/features.
9
+ // "features": {},
10
+
11
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
12
+ // "forwardPorts": [],
13
+
14
+ // Use 'postCreateCommand' to run commands after the container is created.
15
+ // "postCreateCommand": "ruby --version",
16
+
17
+ // Configure tool-specific properties.
18
+ // "customizations": {},
19
+
20
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
21
+ // "remoteUser": "root"
22
+ }
@@ -0,0 +1,95 @@
1
+ name: CI
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ include:
14
+ - ruby: "2.5"
15
+ gemfile: gemfiles/rails_5_1.gemfile
16
+ - ruby: "2.5"
17
+ gemfile: gemfiles/rails_5_2.gemfile
18
+ - ruby: "2.5"
19
+ gemfile: gemfiles/rails_6_0.gemfile
20
+ - ruby: "2.5"
21
+ gemfile: gemfiles/rails_6_1.gemfile
22
+ - ruby: "2.6"
23
+ gemfile: gemfiles/rails_5_2.gemfile
24
+ - ruby: "2.6"
25
+ gemfile: gemfiles/rails_6_0.gemfile
26
+ - ruby: "2.6"
27
+ gemfile: gemfiles/rails_6_1.gemfile
28
+ - ruby: "2.7"
29
+ gemfile: gemfiles/rails_5_1.gemfile
30
+ - ruby: "2.7"
31
+ gemfile: gemfiles/rails_5_2.gemfile
32
+ - ruby: "2.7"
33
+ gemfile: gemfiles/rails_6_0.gemfile
34
+ - ruby: "2.7"
35
+ gemfile: gemfiles/rails_6_1.gemfile
36
+ - ruby: "2.7"
37
+ gemfile: gemfiles/rails_7_0.gemfile
38
+ - ruby: "2.7"
39
+ gemfile: gemfiles/rails_7_1.gemfile
40
+ - ruby: "3.0"
41
+ gemfile: gemfiles/rails_6_0.gemfile
42
+ - ruby: "3.0"
43
+ gemfile: gemfiles/rails_6_1.gemfile
44
+ - ruby: "3.0"
45
+ gemfile: gemfiles/rails_7_0.gemfile
46
+ - ruby: "3.0"
47
+ gemfile: gemfiles/rails_7_1.gemfile
48
+ - ruby: "3.1"
49
+ gemfile: gemfiles/rails_6_0.gemfile
50
+ - ruby: "3.1"
51
+ gemfile: gemfiles/rails_6_1.gemfile
52
+ - ruby: "3.1"
53
+ gemfile: gemfiles/rails_7_0.gemfile
54
+ - ruby: "3.1"
55
+ gemfile: gemfiles/rails_7_1.gemfile
56
+ - ruby: "3.1"
57
+ gemfile: gemfiles/rails_7_2.gemfile
58
+ - ruby: "3.2"
59
+ gemfile: gemfiles/rails_6_0.gemfile
60
+ - ruby: "3.2"
61
+ gemfile: gemfiles/rails_6_1.gemfile
62
+ - ruby: "3.2"
63
+ gemfile: gemfiles/rails_7_0.gemfile
64
+ - ruby: "3.2"
65
+ gemfile: gemfiles/rails_7_1.gemfile
66
+ - ruby: "3.2"
67
+ gemfile: gemfiles/rails_7_2.gemfile
68
+ - ruby: "3.3"
69
+ gemfile: gemfiles/rails_6_0.gemfile
70
+ - ruby: "3.3"
71
+ gemfile: gemfiles/rails_6_1.gemfile
72
+ - ruby: "3.3"
73
+ gemfile: gemfiles/rails_7_0.gemfile
74
+ - ruby: "3.3"
75
+ gemfile: gemfiles/rails_7_1.gemfile
76
+ - ruby: "3.3"
77
+ gemfile: gemfiles/rails_7_2.gemfile
78
+ - ruby: "head"
79
+ gemfile: gemfiles/rails_head.gemfile
80
+ env:
81
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
82
+ steps:
83
+ - name: Checkout code
84
+ uses: actions/checkout@v4
85
+ - name: Set up Ruby
86
+ uses: ruby/setup-ruby@v1
87
+ with:
88
+ ruby-version: ${{ matrix.ruby }}
89
+ bundler-cache: true
90
+ - name: Set Git config
91
+ run: |
92
+ git config --global user.email "user@example.com"
93
+ git config --global user.name "Github Action Bot"
94
+ - name: Run test
95
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
 
7
7
  Gemfile.lock
8
8
  gemfiles/*.lock
9
+ .idea
data/Appraisals ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'rails_5_1' do
4
+ gem 'rails', '~> 5.1.0'
5
+ end
6
+
7
+ appraise 'rails_5_2' do
8
+ gem 'rails', '~> 5.2.0'
9
+ end
10
+
11
+ appraise 'rails_6_0' do
12
+ gem 'rails', '~> 6.0.0'
13
+ end
14
+
15
+ appraise 'rails_6_1' do
16
+ gem 'rails', '~> 6.1.0'
17
+
18
+ # https://stackoverflow.com/questions/70500220/rails-7-ruby-3-1-loaderror-cannot-load-such-file-net-smtp
19
+ gem 'net-smtp', require: false
20
+ gem 'net-imap', require: false
21
+ gem 'net-pop', require: false
22
+ end
23
+
24
+ appraise 'rails_7_0' do
25
+ gem 'rails', '~> 7.0'
26
+ end
data/CHANGELOG.md CHANGED
@@ -1,7 +1,23 @@
1
1
  ## HEAD
2
2
 
3
+ ## 2.2.1
4
+
5
+ - `get_process_mem` version requirements relaxed (https://github.com/zombocom/derailed_benchmarks/pull/252)
6
+
7
+ ## 2.2.0
8
+
9
+ - Support REQUEST_METHOD, REQUEST_BODY, CONTENT_TYPE, and CONTENT_LENGTH env vars (https://github.com/zombocom/derailed_benchmarks/pull/234, https://github.com/zombocom/derailed_benchmarks/pull/122)
10
+ - Support ruby-statistics 4.x (https://github.com/zombocom/derailed_benchmarks/pull/238,
11
+ https://github.com/zombocom/derailed_benchmarks/pull/239, https://github.com/zombocom/derailed_benchmarks/pull/247)
12
+ - Repair tests, support ruby-statistics in ruby < 3.0 (https://github.com/zombocom/derailed_benchmarks/pull/241)
13
+ - Test Rails 7.1 and 7.2 (https://github.com/zombocom/derailed_benchmarks/pull/242)
14
+ - Switch from dead_end to syntax_suggest (https://github.com/zombocom/derailed_benchmarks/pull/243)
15
+ - require `ruby2_keywords` so drb doesn't break in ruby < 2.7 (https://github.com/zombocom/derailed_benchmarks/pull/244)
16
+ - support relative BUNDLE_GEMFILE in tests (https://github.com/zombocom/derailed_benchmarks/pull/245)
17
+
3
18
  ## 2.1.2
4
19
 
20
+ - Support DERAILED_SKIP_RAILS_REQUIRES (https://github.com/zombocom/derailed_benchmarks/pull/199)
5
21
  - Support rails 7 for bundle exec derailed exec mem (https://github.com/zombocom/derailed_benchmarks/pull/212)
6
22
  - Update the gemspec's homepage to the current repo URL (https://github.com/zombocom/derailed_benchmarks/pull/212)
7
23
 
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development, :test do
6
- gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
6
+ gem "sqlite3", '~> 1.4', :platform => [:ruby, :mswin, :mingw]
7
7
  gem "activerecord-jdbcsqlite3-adapter", '~> 1.3.13', :platform => :jruby
8
8
  gem "test-unit", "~> 3.0"
9
9
  end
data/README.md CHANGED
@@ -4,7 +4,7 @@ A series of things you can use to benchmark a Rails or Ruby app.
4
4
 
5
5
  ![](http://media.giphy.com/media/lfbxexWy71b6U/giphy.gif)
6
6
 
7
- [![CircleCI](https://circleci.com/gh/zombocom/derailed_benchmarks/tree/main.svg?style=svg)](https://circleci.com/gh/zombocom/derailed_benchmarks/tree/main)
7
+ [![Build Status](https://github.com/zombocom/derailed_benchmarks/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zombocom/derailed_benchmarks)
8
8
  [![Help Contribute to Open Source](https://www.codetriage.com/schneems/derailed_benchmarks/badges/users.svg)](https://www.codetriage.com/schneems/derailed_benchmarks)
9
9
 
10
10
  ## Compatibility/Requirements
@@ -575,6 +575,22 @@ $ HTTP_AUTHORIZATION="Basic YWRtaW46c2VjcmV0\n" \
575
575
  PATH_TO_HIT=/foo_secret bundle exec derailed exec perf:ips
576
576
  ```
577
577
 
578
+ The `Content-Type` and `Content-Length` headers are a bit different. To set those, ignore the HTTP_ prefix, use the `CONTENT_TYPE` and `CONTENT_LENGTH` variables.
579
+
580
+ ### Performing non-GET requests
581
+
582
+ If the endpoint being tested is not a GET request, you can set the `REQUEST_METHOD` variable with the HTTP method you want (e.g. POST, PUT, PATCH, DELETE).
583
+
584
+ To set the request body, you can use the `REQUEST_BODY`.
585
+
586
+ ```
587
+ $ REQUEST_METHOD=POST \
588
+ REQUEST_BODY="{\"user\":{\"email\":\"foo@bar.com\",\"password\":\"123456\",\"password_confirmation\":\"123456\"}}" \
589
+ CONTENT_TYPE="application/json" \
590
+ PATH_TO_HIT=/users \
591
+ bundle exec derailed exec perf:test
592
+ ```
593
+
578
594
  ### Using a real web server with `USE_SERVER`
579
595
 
580
596
  All tests are run without a webserver (directly using `Rack::Mock` by default), if you want to use a webserver set `USE_SERVER` to a Rack::Server compliant server, such as `webrick`.
@@ -24,19 +24,33 @@ Gem::Specification.new do |gem|
24
24
 
25
25
  gem.add_dependency "heapy", "~> 0"
26
26
  gem.add_dependency "memory_profiler", ">= 0", "< 2"
27
- gem.add_dependency "get_process_mem", "~> 0"
27
+ gem.add_dependency "get_process_mem"
28
28
  gem.add_dependency "benchmark-ips", "~> 2"
29
29
  gem.add_dependency "rack", ">= 1"
30
30
  gem.add_dependency "rake", "> 10", "< 14"
31
31
  gem.add_dependency "thor", ">= 0.19", "< 2"
32
- gem.add_dependency "ruby-statistics", ">= 2.1"
32
+ if RUBY_VERSION >= '3.0'
33
+ gem.add_dependency "ruby-statistics", ">= 4.0.1"
34
+ else
35
+ gem.add_dependency "ruby-statistics", ">= 2.1"
36
+ end
37
+ if RUBY_VERSION < "3.2"
38
+ gem.add_dependency "syntax_suggest", "~> 1.1.0"
39
+ end
33
40
  gem.add_dependency "mini_histogram", ">= 0.3.0"
34
- gem.add_dependency "dead_end", ">= 0"
35
41
  gem.add_dependency "rack-test", ">= 0"
42
+ gem.add_dependency "base64", ">= 0"
43
+ gem.add_dependency "mutex_m", ">= 0"
44
+ gem.add_dependency "bigdecimal", ">= 0"
45
+ gem.add_dependency "drb", ">= 0"
46
+ gem.add_dependency "logger", ">= 0"
47
+ gem.add_dependency "ostruct", ">= 0"
48
+ gem.add_dependency "ruby2_keywords", ">= 0"
36
49
 
50
+ gem.add_development_dependency "appraisal"
37
51
  gem.add_development_dependency "webrick", ">= 0"
38
52
  gem.add_development_dependency "capybara", "~> 2"
39
53
  gem.add_development_dependency "m"
40
- gem.add_development_dependency "rails", "> 3", "<= 7"
54
+ gem.add_development_dependency "rails", "> 3", "< 7.1"
41
55
  gem.add_development_dependency "devise", "> 3", "< 6"
42
56
  end
@@ -1,12 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- # BUNDLE_GEMFILE="gemfiles/rails_5_1.gemfile" bundle exec m test/integration/tasks_test.rb:30
4
- #
5
1
  # This file was generated by Appraisal
6
2
 
7
3
  source "https://rubygems.org"
8
4
 
9
- gem "rails", "~> 5.1.7"
5
+ gem "rails", "~> 5.1.0"
10
6
 
11
7
  group :development, :test do
12
8
  gem "sqlite3", platform: [:ruby, :mswin, :mingw]
@@ -1,10 +1,8 @@
1
1
  # This file was generated by Appraisal
2
- #
3
- # BUNDLE_GEMFILE="gemfiles/rails_5_2.gemfile" bundle exec m test/integration/tasks_test.rb:30
4
2
 
5
3
  source "https://rubygems.org"
6
4
 
7
- gem "rails", "~> 5.2.4.4"
5
+ gem "rails", "~> 5.2.0"
8
6
 
9
7
  group :development, :test do
10
8
  gem "sqlite3", platform: [:ruby, :mswin, :mingw]
@@ -1,15 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file was generated by Appraisal
4
2
 
5
3
  source "https://rubygems.org"
6
4
 
7
- gem "rails", "6.0.0"
5
+ gem "rails", "~> 6.0.0"
8
6
 
9
7
  group :development, :test do
10
- gem "sqlite3", platform: [:ruby, :mswin, :mingw]
8
+ gem "sqlite3", '~> 1.4', platform: [:ruby, :mswin, :mingw]
11
9
  gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
12
10
  gem "test-unit", "~> 3.0"
11
+ gem "psych", "~> 3.0"
13
12
  end
14
13
 
15
14
  gemspec path: "../"
@@ -2,10 +2,13 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 6.1.1"
5
+ gem "rails", "~> 6.1.0"
6
+ gem "net-smtp", require: false
7
+ gem "net-imap", require: false
8
+ gem "net-pop", require: false
6
9
 
7
10
  group :development, :test do
8
- gem "sqlite3", platform: [:ruby, :mswin, :mingw]
11
+ gem "sqlite3", '~> 1.4', platform: [:ruby, :mswin, :mingw]
9
12
  gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
13
  gem "test-unit", "~> 3.0"
11
14
  end
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.0.0"
6
+
7
+ group :development, :test do
8
+ gem "sqlite3", '~> 1.4', platform: [:ruby, :mswin, :mingw]
9
+ gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
+ gem "test-unit", "~> 3.0"
11
+ end
12
+
13
+ gemspec path: "../"
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.1.0"
6
+
7
+ group :development, :test do
8
+ gem "sqlite3", '~> 1.4', platform: [:ruby, :mswin, :mingw]
9
+ gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
+ gem "test-unit", "~> 3.0"
11
+ end
12
+
13
+ gemspec path: "../"
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.2.0"
6
+
7
+ group :development, :test do
8
+ gem "sqlite3", '~> 1.4', platform: [:ruby, :mswin, :mingw]
9
+ gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
+ gem "test-unit", "~> 3.0"
11
+ end
12
+
13
+ gemspec path: "../"
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # $ BUNDLE_GEMFILE="$(pwd)/gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:50
3
+ # $ BUNDLE_GEMFILE="gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:50
4
4
 
5
5
  source "https://rubygems.org"
6
6
 
7
- gem "rails", github: "rails/rails", ref: "12bb9d32f56883914abcd98fd72e3c68c444808d"
7
+ gem "rails", github: "rails/rails", branch: "main"
8
8
 
9
- gem 'devise', github: "plataformatec/devise", ref: "6d32d2447cc0f3739d9732246b5a5bde98d9e032"
9
+ gem 'devise', github: "plataformatec/devise", branch: "main"
10
10
 
11
11
  group :development, :test do
12
12
  gem "sqlite3", platform: [:ruby, :mswin, :mingw]
13
13
  gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
14
14
  gem "test-unit", "~> 3.0"
15
+ gem "rackup"
15
16
  end
16
17
 
17
18
  gemspec path: "../"
@@ -24,6 +24,9 @@ namespace :perf do
24
24
 
25
25
  DERAILED_APP = Rails.application
26
26
 
27
+ # Disables CSRF protection because of non-GET requests
28
+ DERAILED_APP.config.action_controller.allow_forgery_protection = false
29
+
27
30
  if DERAILED_APP.respond_to?(:initialized?)
28
31
  DERAILED_APP.initialize! unless DERAILED_APP.initialized?
29
32
  else
@@ -40,7 +43,10 @@ namespace :perf do
40
43
  ActiveRecord::Migrator.migrations_paths = DERAILED_APP.paths['db/migrate'].to_a
41
44
  ActiveRecord::Migration.verbose = true
42
45
 
43
- if Rails.version >= "6.0"
46
+ # https://github.com/plataformatec/devise/blob/master/test/orm/active_record.rb
47
+ if Rails.version >= "7.1"
48
+ ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrate
49
+ elsif Rails.version >= "6.0"
44
50
  ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration).migrate
45
51
  elsif Rails.version.start_with?("5.2")
46
52
  ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrate
@@ -74,23 +80,44 @@ namespace :perf do
74
80
  WARM_COUNT = (ENV['WARM_COUNT'] || 0).to_i
75
81
  TEST_COUNT = (ENV['TEST_COUNT'] || ENV['CNT'] || 1_000).to_i
76
82
  PATH_TO_HIT = ENV["PATH_TO_HIT"] || ENV['ENDPOINT'] || "/"
83
+ REQUEST_METHOD = ENV["REQUEST_METHOD"] || "GET"
84
+ REQUEST_BODY = ENV["REQUEST_BODY"]
85
+ puts "Method: #{REQUEST_METHOD}"
77
86
  puts "Endpoint: #{ PATH_TO_HIT.inspect }"
78
87
 
88
+ # See https://www.rubydoc.info/github/rack/rack/file/SPEC#The_Environment
89
+ # All HTTP_ variables are accepted in the Rack environment hash, except HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH.
90
+ # For those, the HTTP_ prefix has to be removed.
79
91
  HTTP_HEADER_PREFIX = "HTTP_".freeze
80
- RACK_HTTP_HEADERS = ENV.select { |key| key.start_with?(HTTP_HEADER_PREFIX) }
92
+ HTTP_HEADER_REGEXP = /^#{HTTP_HEADER_PREFIX}.+|CONTENT_(TYPE|LENGTH)$/
93
+ RACK_ENV_HASH = ENV.select { |key| key =~ HTTP_HEADER_REGEXP }
81
94
 
82
- HTTP_HEADERS = RACK_HTTP_HEADERS.keys.inject({}) do |hash, rack_header_name|
95
+ HTTP_HEADERS = RACK_ENV_HASH.keys.inject({}) do |hash, rack_header_name|
83
96
  # e.g. "HTTP_ACCEPT_CHARSET" -> "Accept-Charset"
84
- header_name = rack_header_name[HTTP_HEADER_PREFIX.size..-1].split("_").map(&:downcase).map(&:capitalize).join("-")
85
- hash[header_name] = RACK_HTTP_HEADERS[rack_header_name]
97
+ upper_case_header_name =
98
+ if rack_header_name.start_with?(HTTP_HEADER_PREFIX)
99
+ rack_header_name[HTTP_HEADER_PREFIX.size..-1]
100
+ else
101
+ rack_header_name
102
+ end
103
+
104
+ header_name = upper_case_header_name.split("_").map(&:downcase).map(&:capitalize).join("-")
105
+
106
+ hash[header_name] = RACK_ENV_HASH[rack_header_name]
86
107
  hash
87
108
  end
88
109
  puts "HTTP headers: #{HTTP_HEADERS}" unless HTTP_HEADERS.empty?
89
110
 
90
111
  CURL_HTTP_HEADER_ARGS = HTTP_HEADERS.map { |http_header_name, value| "-H \"#{http_header_name}: #{value}\"" }.join(" ")
112
+ CURL_BODY_ARG = REQUEST_BODY ? "-d '#{REQUEST_BODY}'" : nil
113
+
114
+ if REQUEST_METHOD != "GET" && REQUEST_BODY
115
+ RACK_ENV_HASH["GATEWAY_INTERFACE"] = "CGI/1.1"
116
+ RACK_ENV_HASH[:input] = REQUEST_BODY.dup
117
+ puts "Body: #{REQUEST_BODY}"
118
+ end
91
119
 
92
120
  require 'rack/test'
93
- require 'rack/file'
94
121
 
95
122
  DERAILED_APP = DerailedBenchmarks.add_auth(Object.class_eval { remove_const(:DERAILED_APP) })
96
123
  if server = ENV["USE_SERVER"]
@@ -98,12 +125,15 @@ namespace :perf do
98
125
  puts "Port: #{ @port.inspect }"
99
126
  puts "Server: #{ server.inspect }"
100
127
  thread = Thread.new do
101
- Rack::Server.start(app: DERAILED_APP, :Port => @port, environment: "none", server: server)
128
+ # rack 3 doesn't have Rack::Server
129
+ require 'rackup' unless defined?(Rack::Server)
130
+ server_class = defined?(Rack::Server) ? Rack::Server : Rackup::Server
131
+ server_class.start(app: DERAILED_APP, :Port => @port, environment: "none", server: server)
102
132
  end
103
133
  sleep 1
104
134
 
105
135
  def call_app(path = File.join("/", PATH_TO_HIT))
106
- cmd = "curl #{CURL_HTTP_HEADER_ARGS} 'http://localhost:#{@port}#{path}' -s --fail 2>&1"
136
+ cmd = "curl -X #{REQUEST_METHOD} #{CURL_HTTP_HEADER_ARGS} #{CURL_BODY_ARG} -s --fail 'http://localhost:#{@port}#{path}' 2>&1"
107
137
  response = `#{cmd}`
108
138
  unless $?.success?
109
139
  STDERR.puts "Couldn't call app."
@@ -121,7 +151,7 @@ namespace :perf do
121
151
  @app = Rack::MockRequest.new(DERAILED_APP)
122
152
 
123
153
  def call_app
124
- response = @app.get(PATH_TO_HIT, RACK_HTTP_HEADERS)
154
+ response = @app.request(REQUEST_METHOD, PATH_TO_HIT, RACK_ENV_HASH)
125
155
  if response.status != 200
126
156
  STDERR.puts "Couldn't call app. Bad request to #{PATH_TO_HIT}! Resulted in #{response.status} status."
127
157
  STDERR.puts "\n\n***RESPONSE BODY***\n\n"
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bigdecimal'
4
- require 'statistics'
4
+ # keep this in sync with gemspec
5
+ if RUBY_VERSION >= '3.0'
6
+ require 'ruby-statistics'
7
+ else
8
+ require 'statistics'
9
+ end
5
10
  require 'stringio'
6
11
  require 'mini_histogram'
7
12
  require 'mini_histogram/plot'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DerailedBenchmarks
4
- VERSION = "2.1.2"
4
+ VERSION = "2.2.1"
5
5
  end
@@ -4,7 +4,7 @@ require 'time'
4
4
  require 'bundler'
5
5
  require 'get_process_mem'
6
6
 
7
- require 'dead_end'
7
+ require 'syntax_suggest'
8
8
 
9
9
  module DerailedBenchmarks
10
10
  def self.gem_is_bundled?(name)
@@ -14,7 +14,6 @@ class TasksTest < ActiveSupport::TestCase
14
14
  end
15
15
 
16
16
  def run!(cmd)
17
- puts "Running: #{cmd}"
18
17
  out = `#{cmd}`
19
18
  raise "Could not run #{cmd}, output: #{out}" unless $?.success?
20
19
  out
@@ -25,8 +24,11 @@ class TasksTest < ActiveSupport::TestCase
25
24
  env = options[:env] || {}
26
25
  env_string = env.map {|key, value| "#{key.shellescape}=#{value.to_s.shellescape}" }.join(" ")
27
26
  cmd = "env #{env_string} bundle exec rake -f perf.rake #{cmd} --trace"
28
- puts "Running: #{cmd}"
29
- result = Bundler.with_original_env { `cd '#{rails_app_path}' && #{cmd} 2>&1` }
27
+ result = Bundler.with_original_env do
28
+ # Ensure relative BUNDLE_GEMFILE is expanded so path is still correct after cd
29
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(ENV['BUNDLE_GEMFILE']) if ENV['BUNDLE_GEMFILE']
30
+ `cd '#{rails_app_path}' && #{cmd} 2>&1`
31
+ end
30
32
  if assert_success && !$?.success?
31
33
  puts result
32
34
  raise "Expected '#{cmd}' to return a success status.\nOutput: #{result}"
@@ -44,23 +46,23 @@ class TasksTest < ActiveSupport::TestCase
44
46
  end
45
47
 
46
48
  test 'rails perf:library from git' do
47
- # BUNDLE_GEMFILE="$(pwd)/gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:<linenumber>
49
+ # BUNDLE_GEMFILE="gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:<linenumber>
48
50
 
49
- skip unless ENV['USING_RAILS_GIT']
51
+ skip # unless ENV['USING_RAILS_GIT']
50
52
 
51
53
  env = { "TEST_COUNT" => 2, "DERAILED_SCRIPT_COUNT" => 2,
52
- "SHAS_TO_TEST" => "acb6631cd99cdfe7db356773ef74cad7cbb570ed,12bb9d32f56883914abcd98fd72e3c68c444808d"}
54
+ "SHAS_TO_TEST" => "fd9308a2925e862435859e1803e720e6eebe4bb6,aa85e897312396b5c6993d8092b9aff7faa93011"}
53
55
  puts rake "perf:library", { env: env }
54
56
  end
55
57
 
56
58
  test "rails perf:library with bad script" do
57
- # BUNDLE_GEMFILE="$(pwd)/gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:<linenumber>
59
+ # BUNDLE_GEMFILE="gemfiles/rails_git.gemfile" bundle exec m test/integration/tasks_test.rb:<linenumber>
58
60
 
59
- skip unless ENV['USING_RAILS_GIT']
61
+ skip # unless ENV['USING_RAILS_GIT']
60
62
 
61
63
  error = assert_raises {
62
64
  env = { "DERAILED_SCRIPT" => "nopenopenop", "TEST_COUNT" => 2, "DERAILED_SCRIPT_COUNT" => 2,
63
- "SHAS_TO_TEST" => "acb6631cd99cdfe7db356773ef74cad7cbb570ed,12bb9d32f56883914abcd98fd72e3c68c444808d"}
65
+ "SHAS_TO_TEST" => "fd9308a2925e862435859e1803e720e6eebe4bb6,aa85e897312396b5c6993d8092b9aff7faa93011"}
64
66
  puts rake "perf:library", { env: env }
65
67
  }
66
68
 
@@ -120,16 +122,56 @@ class TasksTest < ActiveSupport::TestCase
120
122
  env = {
121
123
  "PATH_TO_HIT" => 'foo_secret',
122
124
  "TEST_COUNT" => "2",
123
- "HTTP_AUTHORIZATION" => "Basic #{Base64.encode64("admin:secret")}",
125
+ "HTTP_AUTHORIZATION" => "Basic #{Base64.strict_encode64("admin:secret")}",
124
126
  "HTTP_CACHE_CONTROL" => "no-cache"
125
127
  }
126
128
  result = rake "perf:test", env: env
127
129
  assert_match 'Endpoint: "foo_secret"', result
128
- assert_match 'HTTP headers: {"Authorization"=>"Basic YWRtaW46c2VjcmV0\n", "Cache-Control"=>"no-cache"}', result
130
+ assert_match (/"Authorization"=>"Basic YWRtaW46c2VjcmV0"/), result
131
+ assert_match (/"Cache-Control"=>"no-cache"/), result
132
+
133
+ env["USE_SERVER"] = "webrick"
134
+ result = rake "perf:test", env: env
135
+ assert_match (/"Authorization"=>"Basic YWRtaW46c2VjcmV0"/), result
136
+ assert_match (/"Cache-Control"=>"no-cache"/), result
137
+ end
138
+
139
+ test 'CONTENT_TYPE' do
140
+ env = {
141
+ "REQUEST_METHOD" => "POST",
142
+ "PATH_TO_HIT" => "users",
143
+ "CONTENT_TYPE" => "application/json",
144
+ "REQUEST_BODY" => '{"user":{"email":"foo@bar.com","password":"123456","password_confirmation":"123456"}}',
145
+ "TEST_COUNT" => "2"
146
+ }
147
+
148
+ result = rake "perf:test", env: env
149
+ assert_match 'Body: {"user":{"email":"foo@bar.com","password":"123456","password_confirmation":"123456"}}', result
150
+ assert_match 'HTTP headers: {"Content-Type"=>"application/json"}', result
151
+
152
+ env["USE_SERVER"] = "webrick"
153
+ result = rake "perf:test", env: env
154
+ assert_match 'Body: {"user":{"email":"foo@bar.com","password":"123456","password_confirmation":"123456"}}', result
155
+ assert_match 'HTTP headers: {"Content-Type"=>"application/json"}', result
156
+ end
157
+
158
+ test 'REQUEST_METHOD and REQUEST_BODY' do
159
+ env = {
160
+ "REQUEST_METHOD" => "POST",
161
+ "PATH_TO_HIT" => "users",
162
+ "REQUEST_BODY" => "user%5Bemail%5D=foo%40bar.com&user%5Bpassword%5D=123456&user%5Bpassword_confirmation%5D=123456",
163
+ "TEST_COUNT" => "2"
164
+ }
165
+
166
+ result = rake "perf:test", env: env
167
+ assert_match 'Endpoint: "users"', result
168
+ assert_match 'Method: POST', result
169
+ assert_match 'Body: user%5Bemail%5D=foo%40bar.com&user%5Bpassword%5D=123456&user%5Bpassword_confirmation%5D=123456', result
129
170
 
130
171
  env["USE_SERVER"] = "webrick"
131
172
  result = rake "perf:test", env: env
132
- assert_match 'HTTP headers: {"Authorization"=>"Basic YWRtaW46c2VjcmV0\n", "Cache-Control"=>"no-cache"}', result
173
+ assert_match 'Method: POST', result
174
+ assert_match 'Body: user%5Bemail%5D=foo%40bar.com&user%5Bpassword%5D=123456&user%5Bpassword_confirmation%5D=123456', result
133
175
  end
134
176
 
135
177
  test 'USE_SERVER' do
@@ -0,0 +1,13 @@
1
+ class UsersController < ApplicationController
2
+ def create
3
+ User.create!(user_params)
4
+
5
+ head :created
6
+ end
7
+
8
+ private
9
+
10
+ def user_params
11
+ params.require(:user).permit(:email, :password, :password_confirmation)
12
+ end
13
+ end
@@ -11,6 +11,8 @@ Dummy::Application.configure do
11
11
  # Log error messages when you accidentally call methods on nil.
12
12
  config.whiny_nils = true
13
13
 
14
+ config.eager_load = false
15
+
14
16
  # Show full error reports and disable caching
15
17
  config.consider_all_requests_local = true
16
18
  config.action_controller.perform_caching = false
@@ -11,6 +11,8 @@ Dummy::Application.configure do
11
11
  config.consider_all_requests_local = false
12
12
  config.action_controller.perform_caching = true
13
13
 
14
+ config.eager_load = true
15
+
14
16
  # Specifies the header that your server uses for sending files
15
17
  config.action_dispatch.x_sendfile_header = "X-Sendfile"
16
18
 
@@ -12,6 +12,8 @@ Dummy::Application.configure do
12
12
  # Log error messages when you accidentally call methods on nil.
13
13
  config.whiny_nils = true
14
14
 
15
+ config.eager_load = false
16
+
15
17
  # Show full error reports and disable caching
16
18
  config.consider_all_requests_local = true
17
19
  config.action_controller.perform_caching = false
@@ -56,6 +56,7 @@ Dummy::Application.routes.draw do
56
56
 
57
57
  get "foo", to: "pages#index"
58
58
  get "foo_secret", to: "pages#secret"
59
+ post "users", to: "users#create"
59
60
 
60
61
  get "authenticated", to: "authenticated#index"
61
62
 
data/test/test_helper.rb CHANGED
@@ -6,6 +6,8 @@ require 'bundler/setup'
6
6
  # Configure Rails Envinronment
7
7
  ENV["RAILS_ENV"] = "test"
8
8
 
9
+ require "ruby2_keywords" if RUBY_VERSION < "2.7"
10
+
9
11
  require 'rails'
10
12
  require 'rails/test_help'
11
13
 
@@ -15,7 +17,6 @@ require 'pathname'
15
17
  require 'derailed_benchmarks'
16
18
 
17
19
  require File.expand_path("../rails_app/config/environment.rb", __FILE__)
18
- require "rails/test_help"
19
20
 
20
21
  ActionMailer::Base.delivery_method = :test
21
22
  ActionMailer::Base.perform_deliveries = true
@@ -32,7 +33,9 @@ require_relative "rails_app/config/environment"
32
33
 
33
34
  # https://github.com/plataformatec/devise/blob/master/test/orm/active_record.rb
34
35
  migrate_path = File.expand_path("../rails_app/db/migrate", __FILE__)
35
- if Rails.version >= "6.0"
36
+ if Rails.version >= "7.1"
37
+ ActiveRecord::MigrationContext.new(migrate_path).migrate
38
+ elsif Rails.version >= "6.0"
36
39
  ActiveRecord::MigrationContext.new(migrate_path, ActiveRecord::SchemaMigration).migrate
37
40
  elsif Rails.version.start_with? "5.2"
38
41
  ActiveRecord::MigrationContext.new(migrate_path).migrate
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derailed_benchmarks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-16 00:00:00.000000000 Z
11
+ date: 2024-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: heapy
@@ -48,14 +48,14 @@ dependencies:
48
48
  name: get_process_mem
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: '2.1'
135
+ version: 4.0.1
136
136
  type: :runtime
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
141
141
  - !ruby/object:Gem::Version
142
- version: '2.1'
142
+ version: 4.0.1
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: mini_histogram
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -155,7 +155,7 @@ dependencies:
155
155
  - !ruby/object:Gem::Version
156
156
  version: 0.3.0
157
157
  - !ruby/object:Gem::Dependency
158
- name: dead_end
158
+ name: rack-test
159
159
  requirement: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
@@ -169,7 +169,35 @@ dependencies:
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  - !ruby/object:Gem::Dependency
172
- name: rack-test
172
+ name: base64
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ type: :runtime
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ - !ruby/object:Gem::Dependency
186
+ name: mutex_m
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ type: :runtime
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ - !ruby/object:Gem::Dependency
200
+ name: bigdecimal
173
201
  requirement: !ruby/object:Gem::Requirement
174
202
  requirements:
175
203
  - - ">="
@@ -182,6 +210,76 @@ dependencies:
182
210
  - - ">="
183
211
  - !ruby/object:Gem::Version
184
212
  version: '0'
213
+ - !ruby/object:Gem::Dependency
214
+ name: drb
215
+ requirement: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ type: :runtime
221
+ prerelease: false
222
+ version_requirements: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: '0'
227
+ - !ruby/object:Gem::Dependency
228
+ name: logger
229
+ requirement: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - ">="
232
+ - !ruby/object:Gem::Version
233
+ version: '0'
234
+ type: :runtime
235
+ prerelease: false
236
+ version_requirements: !ruby/object:Gem::Requirement
237
+ requirements:
238
+ - - ">="
239
+ - !ruby/object:Gem::Version
240
+ version: '0'
241
+ - !ruby/object:Gem::Dependency
242
+ name: ostruct
243
+ requirement: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - ">="
246
+ - !ruby/object:Gem::Version
247
+ version: '0'
248
+ type: :runtime
249
+ prerelease: false
250
+ version_requirements: !ruby/object:Gem::Requirement
251
+ requirements:
252
+ - - ">="
253
+ - !ruby/object:Gem::Version
254
+ version: '0'
255
+ - !ruby/object:Gem::Dependency
256
+ name: ruby2_keywords
257
+ requirement: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - ">="
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ type: :runtime
263
+ prerelease: false
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ - !ruby/object:Gem::Dependency
270
+ name: appraisal
271
+ requirement: !ruby/object:Gem::Requirement
272
+ requirements:
273
+ - - ">="
274
+ - !ruby/object:Gem::Version
275
+ version: '0'
276
+ type: :development
277
+ prerelease: false
278
+ version_requirements: !ruby/object:Gem::Requirement
279
+ requirements:
280
+ - - ">="
281
+ - !ruby/object:Gem::Version
282
+ version: '0'
185
283
  - !ruby/object:Gem::Dependency
186
284
  name: webrick
187
285
  requirement: !ruby/object:Gem::Requirement
@@ -231,9 +329,9 @@ dependencies:
231
329
  - - ">"
232
330
  - !ruby/object:Gem::Version
233
331
  version: '3'
234
- - - "<="
332
+ - - "<"
235
333
  - !ruby/object:Gem::Version
236
- version: '7'
334
+ version: '7.1'
237
335
  type: :development
238
336
  prerelease: false
239
337
  version_requirements: !ruby/object:Gem::Requirement
@@ -241,9 +339,9 @@ dependencies:
241
339
  - - ">"
242
340
  - !ruby/object:Gem::Version
243
341
  version: '3'
244
- - - "<="
342
+ - - "<"
245
343
  - !ruby/object:Gem::Version
246
- version: '7'
344
+ version: '7.1'
247
345
  - !ruby/object:Gem::Dependency
248
346
  name: devise
249
347
  requirement: !ruby/object:Gem::Requirement
@@ -272,9 +370,11 @@ executables:
272
370
  extensions: []
273
371
  extra_rdoc_files: []
274
372
  files:
275
- - ".circleci/config.yml"
373
+ - ".devcontainer/devcontainer.json"
276
374
  - ".github/workflows/check_changelog.yml"
375
+ - ".github/workflows/ci.yml"
277
376
  - ".gitignore"
377
+ - Appraisals
278
378
  - CHANGELOG.md
279
379
  - Gemfile
280
380
  - README.md
@@ -286,7 +386,10 @@ files:
286
386
  - gemfiles/rails_5_2.gemfile
287
387
  - gemfiles/rails_6_0.gemfile
288
388
  - gemfiles/rails_6_1.gemfile
289
- - gemfiles/rails_git.gemfile
389
+ - gemfiles/rails_7_0.gemfile
390
+ - gemfiles/rails_7_1.gemfile
391
+ - gemfiles/rails_7_2.gemfile
392
+ - gemfiles/rails_head.gemfile
290
393
  - lib/derailed_benchmarks.rb
291
394
  - lib/derailed_benchmarks/auth_helper.rb
292
395
  - lib/derailed_benchmarks/auth_helpers/devise.rb
@@ -326,6 +429,7 @@ files:
326
429
  - test/rails_app/app/controllers/application_controller.rb
327
430
  - test/rails_app/app/controllers/authenticated_controller.rb
328
431
  - test/rails_app/app/controllers/pages_controller.rb
432
+ - test/rails_app/app/controllers/users_controller.rb
329
433
  - test/rails_app/app/helpers/application_helper.rb
330
434
  - test/rails_app/app/helpers/authenticated_helper.rb
331
435
  - test/rails_app/app/models/user.rb
@@ -387,7 +491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
491
  - !ruby/object:Gem::Version
388
492
  version: '0'
389
493
  requirements: []
390
- rubygems_version: 3.3.7
494
+ rubygems_version: 3.5.9
391
495
  signing_key:
392
496
  specification_version: 4
393
497
  summary: Benchmarks designed to performance test your ENTIRE site
@@ -417,6 +521,7 @@ test_files:
417
521
  - test/rails_app/app/controllers/application_controller.rb
418
522
  - test/rails_app/app/controllers/authenticated_controller.rb
419
523
  - test/rails_app/app/controllers/pages_controller.rb
524
+ - test/rails_app/app/controllers/users_controller.rb
420
525
  - test/rails_app/app/helpers/application_helper.rb
421
526
  - test/rails_app/app/helpers/authenticated_helper.rb
422
527
  - test/rails_app/app/models/user.rb
data/.circleci/config.yml DELETED
@@ -1,77 +0,0 @@
1
- version: 2.1
2
- orbs:
3
- ruby: circleci/ruby@1.1.2
4
- references:
5
- run_tests: &run_tests
6
- run:
7
- name: Run test suite
8
- command: bundle exec rake test
9
- # Needed because tests execute raw git commands
10
- set_git_config: &set_git_config
11
- run:
12
- name: Set Git config
13
- command: git config --global user.email "you@example.com"; git config --global user.name "Your Name"
14
- restore: &restore
15
- restore_cache:
16
- keys:
17
- - v1_bundler_deps-{{ .Environment.CIRCLE_JOB }}
18
- save: &save
19
- save_cache:
20
- paths:
21
- - ./vendor/bundle
22
- key: v1_bundler_deps-{{ .Environment.CIRCLE_JOB }} # CIRCLE_JOB e.g. "ruby-2.5"
23
- bundle: &bundle
24
- run:
25
- name: install dependencies
26
- command: |
27
- echo "export BUNDLE_JOBS=4" >> $BASH_ENV
28
- echo "export BUNDLE_RETRY=3" >> $BASH_ENV
29
- echo "export BUNDLE_PATH=$(pwd)/vendor/bundle" >> $BASH_ENV
30
- echo "export BUNDLE_GEMFILE=$(pwd)/gemfiles/$GEMFILE_NAME" >> $BASH_ENV
31
- source $BASH_ENV
32
-
33
- bundle install
34
- bundle update
35
- bundle clean
36
- mysteps: &mysteps
37
- steps:
38
- - checkout
39
- - <<: *set_git_config
40
- - <<: *restore
41
- - <<: *bundle
42
- - <<: *run_tests
43
- - <<: *save
44
-
45
- jobs:
46
- test:
47
- parameters:
48
- ruby_version:
49
- type: string
50
- gemfile:
51
- type: string
52
- docker:
53
- - image: "ruby:<< parameters.ruby_version >>"
54
- environment:
55
- GEMFILE_NAME: <<parameters.gemfile>>
56
- steps:
57
- - checkout
58
- - <<: *set_git_config
59
- - <<: *restore
60
- - <<: *bundle
61
- - <<: *run_tests
62
- - <<: *save
63
-
64
- workflows:
65
- all-tests:
66
- jobs:
67
- - test:
68
- matrix:
69
- parameters:
70
- ruby_version: ["2.5.8", "2.7.2", "3.0.0"]
71
- gemfile: ["rails_5_2.gemfile", "rails_6_1.gemfile", "rails_git.gemfile"]
72
- exclude:
73
- - ruby_version: "3.0.0"
74
- gemfile: rails_5_2.gemfile
75
- - ruby_version: "2.5.8"
76
- gemfile: rails_git.gemfile
77
- name: test-ruby-<<matrix.ruby_version>>-<<matrix.gemfile>>