Skip to content

Commit 650d32e

Browse files
authored
Merge pull request #227 from solidusio/use-github-actions
Use GitHub Actions
2 parents 5638b51 + c2b4db4 commit 650d32e

File tree

9 files changed

+209
-79
lines changed

9 files changed

+209
-79
lines changed

.circleci/config.yml

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

.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 != 'main' }}
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.2"
23+
bundler-cache: true
24+
- name: Lint Ruby files
25+
run: bundle exec rubocop -ESP

.github/workflows/test.yml

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

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ gemspec
1010
branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
1111
gem 'solidus', github: 'solidusio/solidus', branch: branch
1212

13-
rails_version = ENV.fetch("RAILS_VERSION", "~> 7.0")
14-
gem 'rails', rails_version
13+
rails_version = ENV.fetch("RAILS_VERSION", "7.0")
14+
gem 'rails', "~> #{rails_version}"
1515

1616
gem 'bundler'
1717
gem 'rake'
@@ -21,13 +21,13 @@ group :test do
2121
gem 'mysql2'
2222
gem 'pg'
2323
gem 'solidus_auth_devise'
24-
gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0'
24+
gem 'sqlite3', rails_version < '7.2' ? '~> 1.4' : '~> 2.0'
2525
end
2626

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

31-
if rails_version == "~> 7.0"
31+
if rails_version == "7.0"
3232
gem 'concurrent-ruby', '< 1.3.5'
3333
end

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# solidus_dev_support
22

33

4-
[![CircleCI](https://circleci.com/gh/solidusio/solidus_dev_support.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_dev_support)
4+
[![Test](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml/badge.svg)](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml)
55
[![codecov](https://codecov.io/gh/solidusio/solidus_dev_support/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_dev_support)
66

77
This gem contains common development functionality for Solidus extensions.
@@ -138,15 +138,10 @@ require 'solidus_dev_support/rspec/coverage'
138138
**Note: Make sure to add this at the VERY TOP of your spec_helper, otherwise you'll get skewed
139139
coverage reports!**
140140

141-
If your extension is in a public repo and being tested on Travis or CircleCI, there's nothing else
141+
If your extension is in a public repo and being tested on GitHub actions, there's nothing else
142142
you need to do! If your setup is more complex, look at the
143143
[SimpleCov](https://github.com/colszowka/simplecov)
144-
and [codecov-ruby](https://github.com/codecov/codecov-ruby) docs.
145-
146-
> [!WARNING]
147-
> The Codecov ruby uploader is deprecated.
148-
> Please use the Codecov CLI uploader to upload code coverage reports.
149-
> See https://docs.codecov.com/docs/deprecated-uploader-migration-guide#ruby-uploader for more information on upgrading.
144+
and [codecov](https://about.codecov.io/language/ruby/) docs.
150145

151146
#### Using GitHub Actions
152147

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 != 'main' }}
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.2"
23+
bundler-cache: true
24+
- name: Lint Ruby files
25+
run: bundle exec rubocop -ESP
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
schedule:
9+
- cron: "0 0 * * 4" # every Thursday
10+
11+
concurrency:
12+
group: test-${{ github.ref_name }}
13+
cancel-in-progress: ${{ github.ref_name != 'main' }}
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
rspec:
20+
name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }}
21+
runs-on: ubuntu-24.04
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
rails-version:
26+
- "7.0"
27+
- "7.1"
28+
- "7.2"
29+
ruby-version:
30+
- "3.1"
31+
- "3.4"
32+
solidus-branch:
33+
- "v4.1"
34+
- "v4.2"
35+
- "v4.3"
36+
- "v4.4"
37+
- "v4.5"
38+
database:
39+
- "postgresql"
40+
- "mysql"
41+
- "sqlite"
42+
exclude:
43+
- rails-version: "7.2"
44+
solidus-branch: "v4.3"
45+
- rails-version: "7.2"
46+
solidus-branch: "v4.2"
47+
- rails-version: "7.2"
48+
solidus-branch: "v4.1"
49+
- rails-version: "7.1"
50+
solidus-branch: "v4.2"
51+
- rails-version: "7.1"
52+
solidus-branch: "v4.1"
53+
- ruby-version: "3.4"
54+
rails-version: "7.0"
55+
env:
56+
CODECOV_COVERAGE_PATH: ./coverage/coverage.xml
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Run extension tests
60+
uses: solidusio/test-solidus-extension@main
61+
with:
62+
database: ${{ matrix.database }}
63+
rails-version: ${{ matrix.rails-version }}
64+
ruby-version: ${{ matrix.ruby-version }}
65+
solidus-branch: ${{ matrix.solidus-branch }}
66+
- name: Upload coverage reports to Codecov
67+
uses: codecov/codecov-action@v5
68+
continue-on-error: true
69+
with:
70+
token: ${{ secrets.CODECOV_TOKEN }}
71+
files: ${{ env.CODECOV_COVERAGE_PATH }}

lib/solidus_dev_support/templates/extension/Gemfile.tt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,27 @@ else
1515
gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
1616
end
1717

18-
rails_version = ENV.fetch('RAILS_VERSION', '~> 7.0')
19-
gem 'rails', rails_version
18+
rails_version = ENV.fetch('RAILS_VERSION', '7.0')
19+
gem 'rails', "~> #{rails_version}"
2020

2121
case ENV.fetch('DB', nil)
2222
when 'mysql'
2323
gem 'mysql2'
2424
when 'postgresql'
2525
gem 'pg'
2626
else
27-
gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0'
27+
gem 'sqlite3', rails_version < '7.2' ? '~> 1.4' : '~> 2.0'
2828
end
2929

30-
if rails_version == '~> 7.0'
30+
if rails_version == '7.0'
3131
gem 'concurrent-ruby', '< 1.3.5'
3232
end
3333

34+
if RUBY_VERSION >= '3.4'
35+
# Solidus Promotions uses CSV but does not have it as dependency yet.
36+
gem 'csv'
37+
end
38+
3439
# While we still support Ruby < 3 we need to workaround a limitation in
3540
# the 'async' gem that relies on the latest ruby, since RubyGems doesn't
3641
# resolve gems based on the required ruby version.

lib/solidus_dev_support/templates/extension/bin/sandbox.tt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ group :test, :development do
6161
end
6262
RUBY
6363

64+
echo "Generating manifest file"
65+
mkdir -p app/assets/config
66+
cat <<MANIFESTJS > app/assets/config/manifest.js
67+
//= link_tree ../images
68+
//= link_directory ../javascripts .js
69+
//= link_directory ../stylesheets .css
70+
MANIFESTJS
71+
6472
unbundled bundle install --gemfile Gemfile
6573

6674
unbundled bundle exec rake db:drop db:create

0 commit comments

Comments
 (0)