Skip to content

Commit

Permalink
Fix compatibility with Ruby 2.2 (#2)
Browse files Browse the repository at this point in the history
* 🔥 Remove appraisal gemfile locks

* 👷 Normalize names of status checks

* 👷 Ruby 2.2 need rubygems update

- rubygems: "2.7.11"
- bundler: "1.17.3"

* 👷 Set coverage expectations to 61/50 line/branch

* 👷 Normalize heads and current workflows

* 👷 Normalize coverage and current workflows

* 🐛 Ruby 2.2 compatibility

* 👷 Normalize coverage and style workflows

* 👷 Prevent premature loading of code coverage gems

* 📝 Documentation

* 👷 Prevent premature loading of code coverage gems

* 👷 Coverage enforcement @ 60/50 line/branch
  • Loading branch information
pboling authored Feb 22, 2025
1 parent bd19d4e commit df8efa6
Show file tree
Hide file tree
Showing 39 changed files with 117 additions and 936 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export K_SOUP_COV_DO=true # Means you want code coverage
export K_SOUP_COV_COMMAND_NAME="RSpec Coverage"
export K_SOUP_COV_FORMATTERS="html,tty"
export K_SOUP_COV_MIN_BRANCH=50 # Means you want to enforce X% branch coverage
export K_SOUP_COV_MIN_LINE=61 # Means you want to enforce X% line coverage
export K_SOUP_COV_MIN_LINE=60 # Means you want to enforce X% line coverage
export K_SOUP_COV_MIN_HARD=true # Means you want the build to fail if the coverage thresholds are not met
export K_SOUP_COV_MULTI_FORMATTERS=true
export MAX_ROWS=1 # Setting for simplecov-console gem for tty output, limits to the worst N rows of bad coverage
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ancient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ jobs:
matrix:
include:
# Ruby 2.3
- ruby: "2.3"
- ruby: "ruby-2.3"
appraisal: "ruby-2-3"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: "3.3.27"
bundler: "2.3.27"

# Ruby 2.4
- ruby: "2.4"
- ruby: "ruby-2.4"
appraisal: "ruby-2-4"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: "3.3.27"
bundler: "2.3.27"

# Ruby 2.5
- ruby: "2.5"
- ruby: "ruby-2.5"
appraisal: "ruby-2-5"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Test Coverage

env:
K_SOUP_COV_MIN_BRANCH: 100
K_SOUP_COV_MIN_LINE: 100
K_SOUP_COV_MIN_BRANCH: 50
K_SOUP_COV_MIN_LINE: 60
K_SOUP_COV_MIN_HARD: true
K_SOUP_COV_DO: true
K_SOUP_COV_COMMAND_NAME: "RSpec Coverage"
Expand All @@ -29,8 +29,8 @@ concurrency:
cancel-in-progress: true

jobs:
test:
name: Specs with Coverage ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
coverage:
name: Code Coverage on ${{ matrix.ruby }}@current
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
Expand All @@ -41,7 +41,7 @@ jobs:
matrix:
include:
# Coverage
- ruby: "3.4"
- ruby: "ruby"
appraisal: "coverage"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
Expand Down Expand Up @@ -74,11 +74,11 @@ jobs:
# Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root)
# We need to do this first to get appraisal installed.
# NOTE: This does not use the main Gemfile at all.
- name: Bundle install for Appraisal ${{ matrix.appraisal }}
- name: Install Root Appraisal
run: bundle
- name: Install Appraisal ${{ matrix.appraisal }} dependencies
- name: Appraisal for ${{ matrix.appraisal }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle
- name: Run ${{ matrix.appraisal }} tests via ${{ matrix.exec_cmd }}
- name: Tests for ${{ matrix.ruby }}@current via ${{ matrix.exec_cmd }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }}

- name: CodeClimate Post-build Notification
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/current.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concurrency:

jobs:
test:
name: Specs ${{ matrix.ruby }}@${{ matrix.name_extra || '' }}
name: Specs ${{ matrix.ruby }}@${{ matrix.appraisal }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
Expand All @@ -38,30 +38,29 @@ jobs:
include:
# Ruby 3.4
- ruby: "ruby"
appraisal: "ruby-current"
appraisal: "current"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: latest
bundler: latest
name_extra: "ruby-3.4" # NOTE: This will become out of date!

# truffleruby-24.1 (targets Ruby 3.3.5 compatibility)
# truffleruby-24.1
# (according to documentation: targets Ruby 3.3 compatibility)
# (according to runtime: targets Ruby 3.2 compatibility)
- ruby: "truffleruby"
appraisal: "ruby-current"
appraisal: "current"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: default
bundler: default
name_extra: "truffleruby-24.1" # NOTE: This will become out of date!

# jruby-9.4 (targets Ruby 3.1 compatibility)
- ruby: "jruby"
appraisal: "ruby-current"
appraisal: "current"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: default
bundler: default
name_extra: "jruby-9.4" # NOTE: This will become out of date!

steps:
- name: Checkout
Expand All @@ -80,7 +79,7 @@ jobs:
# NOTE: This does not use the main Gemfile at all.
- name: Install Root Appraisal
run: bundle
- name: Appraisal for ${{ matrix.appraisal }}
- name: Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle
- name: Tests for ${{ matrix.ruby }}@${{ matrix.name_extra }} via ${{ matrix.exec_cmd }}
- name: Tests for ${{ matrix.ruby }}@${{ matrix.appraisal }} via ${{ matrix.exec_cmd }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }}
12 changes: 6 additions & 6 deletions .github/workflows/heads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ concurrency:

jobs:
test:
name: Specs ${{ matrix.ruby }} ${{ matrix.appraisal }}${{ matrix.name_extra || '' }}
name: Specs ${{ matrix.ruby }}@${{ matrix.appraisal }}${{ matrix.name_extra || '' }}
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
Expand All @@ -39,23 +39,23 @@ jobs:
# NOTE: Heads use default rubygems / bundler; their defaults are custom, unreleased, and from the future!
# ruby-head
- ruby: "ruby-head"
appraisal: "ruby-head"
appraisal: "head"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: default
bundler: default

# truffleruby-head
- ruby: "truffleruby-head"
appraisal: "truffleruby-head"
appraisal: "head"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: default
bundler: default

# jruby-head
- ruby: "jruby-head"
appraisal: "jruby-head"
appraisal: "head"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
rubygems: default
Expand All @@ -78,7 +78,7 @@ jobs:
# NOTE: This does not use the main Gemfile at all.
- name: Install Root Appraisal
run: bundle
- name: Appraisal for ${{ matrix.appraisal }}
- name: Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle
- name: Tests for ${{ matrix.ruby }} via ${{ matrix.exec_cmd }}
- name: Tests for ${{ matrix.ruby }}@${{ matrix.appraisal }} via ${{ matrix.exec_cmd }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }}
2 changes: 1 addition & 1 deletion .github/workflows/hoary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
matrix:
include:
# Ruby 2.2
- ruby: "2.2"
- ruby: "ruby-2.2"
appraisal: "ruby-2-2"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
matrix:
include:
# Ruby 3.0
- ruby: "3.0"
- ruby: "ruby-3.0"
appraisal: "ruby-3-0"
exec_cmd: "rake spec"
gemfile: "Appraisal.root"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:

jobs:
rubocop:
name: RuboCop Gradual
name: Style on ${{ matrix.ruby }}@current
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }}
Expand All @@ -34,7 +34,7 @@ jobs:
matrix:
include:
# Style
- ruby: "3.4"
- ruby: "ruby"
appraisal: "style"
exec_cmd: "rake rubocop_gradual:check"
gemfile: "Appraisal.root"
Expand All @@ -56,9 +56,9 @@ jobs:
# Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root)
# We need to do this first to get appraisal installed.
# NOTE: This does not use the main Gemfile at all.
- name: Bundle install for Appraisal ${{ matrix.appraisal }}
- name: Install Root Appraisal
run: bundle
- name: Install Appraisal ${{ matrix.appraisal }} dependencies
- name: Appraisal for ${{ matrix.appraisal }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle
- name: Run ${{ matrix.appraisal }} tests via ${{ matrix.exec_cmd }}
- name: Run ${{ matrix.appraisal }} checks via ${{ matrix.exec_cmd }}
run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# rspec failure tracking
.rspec_status

# IDEs
/.idea/

# Packaging Artifacts
*.gem
gemfiles/*.gemfile.lock
Appraisal.*.gemfile.lock
27 changes: 0 additions & 27 deletions .rubocop_gradual.lock

This file was deleted.

44 changes: 20 additions & 24 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# frozen_string_literal: true

# HOW TO UPDATE APPRAISALS:
# BUNDLE_GEMFILE=Appraisal.root.gemfile bundle
# BUNDLE_GEMFILE=Appraisal.root.gemfile bundle exec appraisal update

# Used for head (nightly) releases of ruby, truffleruby, and jruby.
# Split into discrete appraisals if one of them needs a dependency locked discretely.
appraise "head" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

# Used for current releases of ruby, truffleruby, and jruby.
# Split into discrete appraisals if one of them needs a dependency locked discretely.
appraise "current" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

appraise "ruby-2-2" do
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end
Expand Down Expand Up @@ -52,12 +72,6 @@ appraise "ruby-3-3" do
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

appraise "ruby-current" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

# Only run security audit on latest Ruby version
appraise "audit" do
gem "mutex_m", "~> 0.2"
Expand All @@ -81,21 +95,3 @@ appraise "style" do
eval_gemfile "modular/style.gemfile"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

appraise "ruby-head" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

appraise "truffleruby-head" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end

appraise "jruby-head" do
gem "mutex_m", ">= 0.2"
gem "stringio", ">= 3.0"
remove_gem "appraisal" # only present because it must be in the gemfile because we target a git branch
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ GEM
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-pending_for (0.1.16)
rspec-core
ruby_engine (>= 1, < 3)
ruby_version (~> 1.0)
rspec-stubbed_env (1.0.1)
rspec-support (3.13.2)
rubocop (1.71.2)
Expand Down Expand Up @@ -174,6 +178,8 @@ GEM
rubocop-thread_safety (0.6.0)
rubocop (>= 1.48.1)
ruby-progressbar (1.13.0)
ruby_engine (2.0.3)
ruby_version (1.0.3)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -243,10 +249,12 @@ DEPENDENCIES
reek (~> 6.4)
rspec (~> 3.13)
rspec-block_is_expected (~> 1.0)
rspec-pending_for (~> 0.1, >= 0.1.16)
rspec-stubbed_env (~> 1.0, >= 1.0.1)
rubocop-lts (~> 8.1, >= 8.1.1)
rubocop-packaging (~> 0.5, >= 0.5.2)
rubocop-rspec (~> 3.2)
simplecov
standard (>= 1.35.1, != 1.42.0, != 1.41.1)
yard (~> 0.9, >= 0.9.37)
yard-junk (~> 0.0, >= 0.0.10)
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ It is different from, and improves on, the standard rake task in that it:
- does various checks to ensure the generated checksums will be valid
- does `git commit` the generated checksums

The script accomplishes the same thing if you prefer that:
```shell
gem_checksums
```

## Installation

Install the gem and add to the gem's Gemfile by executing:
Expand Down Expand Up @@ -47,6 +52,12 @@ This gem ships an improved version as `build:checksums`, based on the
rake build:checksums
```

Or...

```shell
gem_checksums
```

Generating checksums makes sense when you are building and releasing a gem, so how does it fit into that process?

### How To: Release gem with checksums generated by `gem_checksums`
Expand Down
1 change: 1 addition & 0 deletions gem_checksums.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Gem::Specification.new do |spec|
# Tests
spec.add_development_dependency("rspec", "~> 3.13") # ruby >= 0
spec.add_development_dependency("rspec-block_is_expected", "~> 1.0") # ruby >= 1.8.7
spec.add_development_dependency("rspec-pending_for", "~> 0.1", ">= 0.1.16") # ruby >= 1.8.7
spec.add_development_dependency("rspec-stubbed_env", "~> 1.0", ">= 1.0.1") # Ruby >= 1.8.7

# Development Tasks
Expand Down
Loading

0 comments on commit df8efa6

Please sign in to comment.