Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ gemspec
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
gem 'solidus', github: 'solidusio/solidus', branch: branch

# A workaround for https://github.com/bundler/bundler/issues/6677
gem 'rails', '>0.a'
rails_version = ENV.fetch("RAILS_VERSION", "~> 7.0")
gem 'rails', rails_version

gem 'bundler'
gem 'rake'
Expand All @@ -21,9 +21,13 @@ group :test do
gem 'mysql2'
gem 'pg'
gem 'solidus_auth_devise'
gem 'sqlite3', '~> 1.4'
gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0'
end

# Use a local Gemfile to include development dependencies that might not be
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
eval_gemfile 'Gemfile-local' if File.exist? 'Gemfile-local'

if rails_version == "~> 7.0"
gem 'concurrent-ruby', '< 1.3.5'
end
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,33 @@ you need to do! If your setup is more complex, look at the
[SimpleCov](https://github.com/colszowka/simplecov)
and [codecov-ruby](https://github.com/codecov/codecov-ruby) docs.

> [!WARNING]
> The Codecov ruby uploader is deprecated.
> Please use the Codecov CLI uploader to upload code coverage reports.
> See https://docs.codecov.com/docs/deprecated-uploader-migration-guide#ruby-uploader for more information on upgrading.

#### Using GitHub Actions

The recommended way to upload coverage reports to Codecov with GitHub Actions is to use the `solidusio/test-solidus-extension`
workflow.

```yaml
jobs:
RSpec:
env:
CODECOV_COVERAGE_PATH: ./coverage/coverage.xml
steps:
- uses: actions/checkout@v4
- name: Run extension tests
uses: solidusio/test-solidus-extension@main
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.CODECOV_COVERAGE_PATH }}
```

### RuboCop configuration

solidus_dev_support includes a default [RuboCop](https://github.com/rubocop-hq/rubocop)
Expand Down
10 changes: 9 additions & 1 deletion lib/solidus_dev_support/rspec/coverage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
if ENV['CODECOV_TOKEN']
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
warn <<~WARN
DEPRECATION WARNING: The Codecov ruby uploader is deprecated.
Please use the Codecov CLI uploader to upload code coverage reports.
See https://docs.codecov.com/docs/deprecated-uploader-migration-guide#ruby-uploader for more information on upgrading.
WARN
elsif ENV['CODECOV_COVERAGE_PATH']
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
else
warn "Provide a CODECOV_TOKEN environment variable to enable Codecov uploads"
warn "Provide a CODECOV_COVERAGE_PATH environment variable to enable Codecov uploads"
end
12 changes: 7 additions & 5 deletions lib/solidus_dev_support/templates/extension/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ else
gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
end

# Needed to help Bundler figure out how to resolve dependencies,
# otherwise it takes forever to resolve them.
# See https://github.com/bundler/bundler/issues/6677
gem 'rails', '>0.a'
rails_version = ENV.fetch('RAILS_VERSION', '~> 7.0')
gem 'rails', rails_version

case ENV.fetch('DB', nil)
when 'mysql'
gem 'mysql2'
when 'postgresql'
gem 'pg'
else
gem 'sqlite3', '~> 1.4'
gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0'
end

if rails_version == '~> 7.0'
gem 'concurrent-ruby', '< 1.3.5'
end

# While we still support Ruby < 3 we need to workaround a limitation in
Expand Down
1 change: 1 addition & 0 deletions solidus_dev_support.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ Gem::Specification.new do |spec|
spec.add_dependency 'rubocop-rails', '~> 2.3'
spec.add_dependency 'rubocop-rspec', '~> 2.0'
spec.add_dependency 'selenium-webdriver', '~> 4.11'
spec.add_dependency 'simplecov-cobertura', '~> 2.1'
spec.add_dependency 'solidus_core', ['>= 2.0', '< 5']
end
2 changes: 1 addition & 1 deletion spec/features/create_extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def check_run_specs
output = sh('bundle exec rspec')
expect(output).to include('loading test_extension factories')
expect(output).to include('1 example, 0 failures')
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_TOKEN environment variable to enable Codecov uploads')
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_COVERAGE_PATH environment variable to enable Codecov uploads')
end
end

Expand Down