Skip to content

CI: Expand ruby version matrix for broader Ruby compatibility#58

Open
extern-c wants to merge 9 commits into
CycloneDX:masterfrom
extern-c:ci/expand-ruby-version-matrix
Open

CI: Expand ruby version matrix for broader Ruby compatibility#58
extern-c wants to merge 9 commits into
CycloneDX:masterfrom
extern-c:ci/expand-ruby-version-matrix

Conversation

@extern-c
Copy link
Copy Markdown

@extern-c extern-c commented May 20, 2026

Description

This PR resolves issue #43 by addressing dependency conflicts and updating supported Ruby versions. CI was previously failing due to Gemfile.lock constraints across multiple Ruby versions. Ruby 2.7 support was also causing dependency incompatibilities.

Please note that Ruby 2.7 reached end of life on March 31, 2023. Dropping support for this version helps reduce ongoing maintenance burden and avoid future dependency incompatibilities.

Ruby version EOL
4.0 TBD
3.4 TBD
3.3 2027-03-31
3.2 2026-04-01
3.1 2025-03-26
3.0 2024-04-23
2.7 2023-03-31

Source: Ruby Maintenance Branches

I understand that there are different opinions on whether Gemfile.lock should be included in gems; however, in this case, I believe the benefits of omitting it outweigh the drawbacks.

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: [e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.]
    • LLMs and versions: [e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.]
    • Prompts: [Summarize the key prompts or instructions given to the AI tools]

Affirmation

extern-c added 5 commits May 20, 2026 02:24
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 20, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@extern-c extern-c marked this pull request as ready for review May 21, 2026 03:14
@extern-c extern-c requested a review from a team as a code owner May 21, 2026 03:14
@jkowalleck jkowalleck requested a review from Copilot May 21, 2026 06:13
@jkowalleck jkowalleck linked an issue May 21, 2026 that may be closed by this pull request
@jkowalleck jkowalleck self-requested a review May 21, 2026 06:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the gem’s supported Ruby baseline and CI matrix to validate compatibility across a wider set of modern Ruby versions, while removing the repository Gemfile.lock to avoid cross-version dependency resolution conflicts.

Changes:

  • Drop Ruby 2.7 support (gemspec + RuboCop target) and re-enable CI for Ruby 3.0/3.1 while adding Ruby 4.0 to the matrix.
  • Remove Gemfile.lock from the repo and ignore it going forward.
  • Adjust BOM component hash construction formatting and tweak dev dependency constraints.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/cyclonedx/bom_component.rb Makes hashes/licenses array entries explicit hash objects.
Gemfile.lock Removes the lockfile from the repository.
cyclonedx-ruby.gemspec Raises minimum Ruby to 3.0 and adjusts cucumber dev dependency constraints.
.rubocop.yml Updates RuboCop target Ruby version to 3.0.
.gitignore Ignores Gemfile.lock going forward.
.github/workflows/ruby.yml Expands CI Ruby version matrix (adds 4.0, re-adds 3.0/3.1).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cyclonedx-ruby.gemspec Outdated
Comment thread cyclonedx-ruby.gemspec
spec.description = 'CycloneDX is a lightweight software bill-of-material (SBOM) specification designed for use in application security contexts and supply chain component analysis. This Gem generates CycloneDX BOMs from Ruby projects.'
spec.homepage = 'https://github.com/CycloneDX/cyclonedx-ruby-gem'
spec.license = 'Apache-2.0'
spec.required_ruby_version = '>= 2.7.0'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does change the supported ruby version, right?
If so, then this seems to be an unintended change.

Copy link
Copy Markdown
Author

@extern-c extern-c May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I'm proposing we drop support for Ruby 2.7.0 (EOL: 2023-03-31) to help reduce maintenance burden, avoid future dependency incompatibilities, and enable further modernization of the gem. This would make Ruby >= 3.0 a requirement to run cyclonedx-ruby-gem, starting with the next release.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ney, this would be a completely different scope.
and mist importantly, this would be a breaking change, too.

this PR should be about one thing and one thing only: complete the CI/CT matrix.

please keep things simple, single-soped: one step at a time.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundler is unable to resolve dependencies for Ruby 2.7 with the current gemspec. I was able to retain support for Ruby 3.0+ and Ruby 4.0 in CI by loosening dependency constrains slightly, but Ruby 2.7 remains incompatible.

Resolving dependencies...
ffi-1.17.4-x86_64-linux-musl requires ruby version < 4.1.dev, >= 3.0, which is incompatible with the current version, ruby
2.7.8p225

There are a few ways to address this, such as maintaining multiple Gemfile.lock files or using Appraisal to manage separate dependency sets. However, this would introduce additional complexity, especially given that Ruby 2.7 reached end-of-life in 2023.

If there is a strong need to continue supporting Ruby 2.7, I'm happy to revisit this and explore those alternatives.

Copy link
Copy Markdown
Author

@extern-c extern-c May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPD: Bundler successfully resolves the project's dependencies in the CI environment when running in a fork of the repository using the same configuration, so Ruby 2.7 support has been restored. The earlier error was specific to my development environment. Ruby 2.7 support can be kept for now, although the setup is somewhat fragile for that Ruby version. This can be improved in a follow-up PR.

Comment thread .rubocop.yml
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.7
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extern-c please explain this change. is this related to the scope of completing the CI/CT matrix?

Copy link
Copy Markdown
Author

@extern-c extern-c May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TargetRubyVersion was updated from 2.7 to 3.0 to align with the gem's new minimum supported Ruby version introduced in this PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #58 (comment).

Comment thread Gemfile.lock Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed? not a blocker, just a question?

purl: @purl,
hashes: [
alg: HASH_ALG,
content: @hash
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a bugfix, not a CI pipeline relevant change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extern-c please explain this change. is this related to the scope of completing the CI/CT matrix?

Copy link
Copy Markdown
Author

@extern-c extern-c May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop started emitting Style/HashAsLastArrayItem: Wrap hash in { and} offenses after TargetRubyVersion was updated from 2.7 to 3.0. These changes address the new offenses introduced by the Ruby version bump to avoid adding additional violations. The codebase may still contain other existing offenses, but this change does not introduce new ones.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #58 (comment).

Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
purl: @purl,
hashes: [
alg: HASH_ALG,
content: @hash
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extern-c please explain this change. is this related to the scope of completing the CI/CT matrix?

Comment thread Gemfile.lock Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed? not a blocker, just a question?

Copy link
Copy Markdown
Author

@extern-c extern-c May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current Gemfile.lock prevents Bundler from resolving dependencies across all Ruby versions supported by the project. Here is the output from bundler install with Ruby 2.7:

Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    Ruby

    cyclonedx-ruby was resolved to 1.2.0, which depends on
      Ruby (>= 2.7.0)

    cyclonedx-ruby was resolved to 1.2.0, which depends on
      nokogiri (~> 1.15) was resolved to 1.18.10, which depends on
        Ruby (>= 3.1.0)

Ruby (>= 3.1.0), which is required by gem 'cyclonedx-ruby', is not available in the local ruby installation

While there are different views on committing Gemfile.lock for libraries/gems, in this case, I believe the benefits of omitting it outweigh the drawbacks. We could maintain multiple Gemfile.lock files or use Appraisal to handle this, but I think that would introduce unnecessary complexity.

Comment thread .rubocop.yml
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.7
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extern-c please explain this change. is this related to the scope of completing the CI/CT matrix?

Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@extern-c extern-c force-pushed the ci/expand-ruby-version-matrix branch from e5037d9 to 8ab4cf1 Compare May 22, 2026 11:28
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI/CT: test with alls supported ruby versions

3 participants