Skip to content

Commit f3f3614

Browse files
authored
Merge pull request #18 from SuperGoodSoft/alistair/fix-ci
Update CI to Actions, use standard, fix issues related to newer Rails versions
2 parents e14eac8 + d9fbb42 commit f3f3614

File tree

39 files changed

+289
-251
lines changed

39 files changed

+289
-251
lines changed

.circleci/config.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# .git-blame-ignore-revs
2+
# Convert to standardrb
3+
0bc0e15a823ecbbf28a7c09825c4330f37f88ccb

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: lint-${{ github.ref_name }}
7+
cancel-in-progress: ${{ github.ref_name != 'master' }}
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ruby:
14+
name: Check Ruby
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
- name: Install Ruby and gems
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: "3.4"
23+
bundler-cache: true
24+
- name: Lint Ruby files
25+
run: bundle exec standardrb

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
schedule:
8+
- cron: "0 0 * * 4" # every Thursday
9+
concurrency:
10+
group: test-${{ github.ref_name }}
11+
cancel-in-progress: ${{ github.ref_name != 'master' }}
12+
permissions:
13+
contents: read
14+
jobs:
15+
rspec:
16+
name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }}
17+
runs-on: ubuntu-24.04
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
rails-version:
22+
- "7.2"
23+
- "8.0"
24+
ruby-version:
25+
- "3.3"
26+
- "3.4"
27+
solidus-branch:
28+
- "v4.4"
29+
- "v4.5"
30+
- "v4.6"
31+
database:
32+
- "postgresql"
33+
- "mysql"
34+
- "sqlite"
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Run extension tests
38+
uses: solidusio/test-solidus-extension@main
39+
with:
40+
database: ${{ matrix.database }}
41+
rails-version: ${{ matrix.rails-version }}
42+
ruby-version: ${{ matrix.ruby-version }}
43+
solidus-branch: ${{ matrix.solidus-branch }}
44+
- name: Upload coverage reports to Codecov
45+
uses: codecov/codecov-action@v5
46+
continue-on-error: true
47+
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
files: ./coverage/coverage.xml

.rubocop.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require:
2-
- solidus_dev_support/rubocop
2+
- standard
33

4-
RSpec/MultipleMemoizedHelpers:
5-
Enabled: false
4+
inherit_gem:
5+
standard: config/base.yml

.standard.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parallel: true # default: false
2+
format: progress # default: Standard::Formatter
3+
ignore:
4+
- 'vendor/**/*'
5+
- 'sandbox/**/*'

Gemfile

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7-
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
8-
%w[solidusio/solidus solidusio/solidus_frontend]
9-
else
10-
%w[solidusio/solidus] * 2
11-
end
12-
gem 'solidus', github: solidus_git, branch: branch
13-
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
6+
branch = ENV.fetch "SOLIDUS_BRANCH", "main"
7+
8+
gem "solidus", github: "solidusio/solidus", branch: branch
9+
10+
# The `solidus_frontend` gem is deprecated and isn't expected to have major
11+
# version updates after v3.2.
12+
if branch >= "v3.2"
13+
gem "solidus_frontend"
14+
elsif branch == "main"
15+
gem "solidus_frontend", github: "solidusio/solidus_frontend", branch: branch
16+
else
17+
gem "solidus_frontend", github: "solidusio/solidus", branch: branch
18+
end
1419

1520
# Needed to help Bundler figure out how to resolve dependencies,
1621
# otherwise it takes forever to resolve them.
1722
# See https://github.com/bundler/bundler/issues/6677
18-
gem 'rails', '~> 6.0'
23+
rails_requirement_string = ENV.fetch("RAILS_VERSION", "~> 8.0")
24+
gem "rails", rails_requirement_string
1925

2026
# Provides basic authentication functionality for testing parts of your engine
21-
gem 'solidus_auth_devise'
27+
gem "solidus_auth_devise"
2228

23-
case ENV['DB']
24-
when 'mysql'
25-
gem 'mysql2'
26-
when 'postgresql'
27-
gem 'pg'
29+
case ENV["DB"]
30+
when "mysql"
31+
gem "mysql2"
32+
when "postgresql"
33+
gem "pg"
2834
else
29-
gem 'sqlite3'
35+
rails_version = Gem::Requirement.new(rails_requirement_string).requirements[0][1]
36+
sqlite_version = (rails_version < Gem::Version.new(7.2)) ? "~> 1.4" : "~> 2.0"
37+
38+
gem "sqlite3", sqlite_version
3039
end
3140

3241
gemspec
@@ -36,4 +45,4 @@ gemspec
3645
#
3746
# We use `send` instead of calling `eval_gemfile` to work around an issue with
3847
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
39-
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
48+
send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ bundle
193193
bin/rake
194194
```
195195

196-
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
196+
To run [Standard](https://github.com/standardrb/standard)
197197

198198
```shell
199-
bundle exec rubocop
199+
bundle exec standardrb --fix
200200
```
201201

202202
When testing your application's integration with this extension you may use its factories.

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'solidus_dev_support/rake_tasks'
3+
require "solidus_dev_support/rake_tasks"
44
SolidusDevSupport::RakeTasks.install
55

6-
task default: 'extension:specs'
6+
task default: "extension:specs"

app/controllers/spree/affirm_v2/callback_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def confirm
3535
amount: affirm_transaction_object.amount / 100.0
3636
}
3737
)
38-
order.next! unless order.state == 'confirm'
38+
order.next! unless order.state == "confirm"
3939
redirect_to checkout_state_path(order.state)
4040
end
4141
end

0 commit comments

Comments
 (0)