Skip to content

Commit

Permalink
Merge branch 'dev' into ruby321_go
Browse files Browse the repository at this point in the history
  • Loading branch information
fallwith committed Feb 15, 2023
2 parents da615d9 + 9f4d2bb commit d67af47
Show file tree
Hide file tree
Showing 156 changed files with 952 additions and 2,219 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.2.10, 3.2.1]
ruby-version: [2.4.10, 3.2.1]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -54,27 +54,27 @@ jobs:
key: ${{ matrix.ruby-version }}
map: |
{
"2.2.10": {
"rails": "norails,rails41,rails32"
"2.4.10": {
"rails": "norails,rails42,rails52"
},
"3.2.1": {
"rails": "norails,rails61,rails70"
}
}
- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/cache@v3.2.2
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.2.10'
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.4.10'
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
--health-timeout 5s
--health-retries 5
mongodb:
image: ${{ contains(fromJson('["2.2.10", "2.3.8", "2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
ports:
- 27017:27017
mysql:
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
fail-fast: false
matrix:
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.2.10, 3.2.1]
ruby-version: [2.4.10, 3.2.1]

steps:
- name: Configure git
Expand All @@ -202,19 +202,19 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}

# This allows the cache in the following step to be able to write files to the directory needed for mysql
- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql directory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/cache@v3.2.2
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.2.10'
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.4.10'
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.2.10, 2.3.8, 2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.1]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.1]

steps:
- name: Configure git
Expand All @@ -61,12 +61,6 @@ jobs:
key: ${{ matrix.ruby-version }}
map: |
{
"2.2.10": {
"rails": "norails,rails41,rails40,rails32"
},
"2.3.8": {
"rails": "norails,rails52,rails51,rails42,rails41,rails40,rails32"
},
"2.4.10": {
"rails": "norails,rails52,rails51,rails42"
},
Expand All @@ -90,19 +84,19 @@ jobs:
}
}
- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/cache@v3.2.2
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8' || matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10')
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10')
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down Expand Up @@ -159,7 +153,7 @@ jobs:
--health-timeout 5s
--health-retries 5
mongodb:
image: ${{ contains(fromJson('["2.2.10", "2.3.8", "2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
ports:
- 27017:27017
mysql:
Expand Down Expand Up @@ -203,7 +197,7 @@ jobs:
fail-fast: false
matrix:
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.2.10, 2.3.8, 2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.1]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.7, 3.0.5, 3.1.3, 3.2.1]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -220,19 +214,19 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8'
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql dirextory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8'
- if: matrix.ruby-version == '2.4.10'
name: Cache mysql55
id: mysql55-cache
uses: actions/cache@v3.2.2
with:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.2.10' || matrix.ruby-version == '2.3.8')
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10')
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_jruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
env:
TEST_CMD: "bundle exec rake test:multiverse[group=${{ matrix.multiverse }}]"
VERBOSE_TEST_OUTPUT: true
RETRY_ATTEMPS: 5
RETRY_ATTEMPTS: 5
SERIALIZE: 1
DB_PORT: ${{ job.services.mysql.ports[3306] }}
JRUBY_OPTS: --dev --debug
Expand Down
31 changes: 6 additions & 25 deletions .github/workflows/scripts/setup_bundler
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function using_old_rails {

function using_old_ruby {
# example RUBY_VERSION strings:
# '2.2.10' => true, starts with "2", next digit is not a "6" or "7"
# '2.4.10' => true, starts with "2", next digit is not a "6" or "7"
# '2.7.7' => false, starts with "2", next digit is "7"
# '3.1.3' => false, does not start with "2"
echo "DEBUG: RUBY_VERSION = $RUBY_VERSION"
Expand All @@ -28,12 +28,7 @@ function update_to_desired_rubygems_version {
# correctly install Bundler 1.17 for the multiverse test suite
# Rubies < 2.3 need to use update_rubygems,
# newer Rubies can use 'gem update --system'
if [[ $RUBY_VERSION = "2.2.10" ]]; then
echo "DEBUG: installing rubygems-update version 2.7.11"
gem install rubygems-update:2.7.11
echo "DEBUG: running 'rubygems-update'"
update_rubygems
elif [[ $RUBY_VERSION =~ 2.[^7] ]]; then
if [[ $RUBY_VERSION =~ 2.[^7] ]]; then
echo "DEBUG: running 'gem update --system 3.0.6 --force'"
gem update --system 3.0.6 --force >/dev/null
else
Expand All @@ -56,23 +51,10 @@ function install_desired_bundler_version {
echo "DEBUG: running 'gem list bundler'"
gem list bundler
echo "DEBUG: RUBY_VERSION = $RUBY_VERSION"
if [[ $RUBY_VERSION != "2.2.10" ]]; then
echo "DEBUG: running 'gem uninstall bundler'"
gem uninstall bundler
echo "DEBUG: running 'gem list bundler' again"
gem list bundler
fi
}

function configure_bundler {
if ! [[ $RUBY_VERSION =~ 2.[23] ]]; then
echo "DEBUG: Ruby is not at version 2.2-2.5, skipping 'bundler config'"
return
fi

# add mysql specific config for bundler when we are using older mysql
echo "DEBUG: running 'bundle config'"
bundle config --global build.mysql2 --with-mysql-config=/usr/local/mysql55/bin/mysql_config
echo "DEBUG: running 'gem uninstall bundler'"
gem uninstall bundler
echo "DEBUG: running 'gem list bundler' again"
gem list bundler
}

function install_ruby_version_specific_gems {
Expand Down Expand Up @@ -108,7 +90,6 @@ function set_up_bundler {

update_to_desired_rubygems_version
install_desired_bundler_version
configure_bundler
}

echo "DEBUG: setting up Bundler"
Expand Down
28 changes: 0 additions & 28 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1081,18 +1081,6 @@ Performance/MapCompact:
Performance/MethodObjectAsBlock:
Enabled: false

# TODO: OLD RUBIES - Requires 2.4
Performance/RegexpMatch:
Enabled: false

# TODO: OLD RUBIES - Requires 2.4
Performance/Sum:
Enabled: false

# TODO: OLD RUBIES - Requires 2.3
Performance/UnfreezeString:
Enabled: false

# Disabling for now
Security/Eval:
Enabled: false
Expand Down Expand Up @@ -1330,11 +1318,6 @@ Style/ExplicitBlockArgument:
Style/ExponentialNotation:
Enabled: false

# TODO: MAJOR VERSION - Re-enable FetchEnvVar after dropping support for Ruby 2.2
# Ruby 2.3+ allows for ENV.fetch('KEY') { default }
Style/FetchEnvVar:
Enabled: false

Style/FloatDivision:
Enabled: false

Expand Down Expand Up @@ -1740,17 +1723,6 @@ Style/RescueStandardError:
Style/ReturnNil:
Enabled: false

# Can't use, not available in Ruby 2.2
Style/SafeNavigation:
Enabled: false
# ConvertCodeThatCanStartToReturnNil: false
# AllowedMethods:
# - present?
# - blank?
# - presence
# - try
# - try!

Style/Sample:
Enabled: true

Expand Down
44 changes: 41 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-10-03 22:57:47 UTC using RuboCop version 1.36.0.
# on 2023-02-02 15:27:55 UTC using RuboCop version 1.44.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 412
# Offense count: 422
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 54
Expand All @@ -31,7 +31,13 @@ Minitest/DuplicateTestRun:
- 'test/multiverse/suites/rails/error_tracing_test.rb'
- 'test/multiverse/suites/sinatra/ignoring_test.rb'

# Offense count: 263
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Minitest/EmptyLineBeforeAssertionMethods:
Exclude:
- 'test/new_relic/agent_test.rb'

# Offense count: 269
Minitest/MultipleAssertions:
Max: 28

Expand All @@ -57,6 +63,38 @@ Minitest/EmptyLineBeforeAssertionMethods:
- 'test/new_relic/agent_test.rb'
- 'test/new_relic/cli/commands/deployments_test.rb'

# Offense count: 23
# This cop supports safe autocorrection (--autocorrect).
Performance/RegexpMatch:
Enabled: false

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: OnlySumOrWithInitialValue.
Performance/Sum:
Exclude:
- 'lib/new_relic/agent/system_info.rb'

# Offense count: 72
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/UnfreezeString:
Enabled: false

# Offense count: 21
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:
Enabled: false

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantStringEscape:
Exclude:
- 'test/new_relic/agent/logging_test.rb'

# Offense count: 115
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Enabled: false

0 comments on commit d67af47

Please sign in to comment.