Skip to content

Commit 5706e93

Browse files
committed
Generate extensions to run specs on GH actions
1 parent 8b4ce8a commit 5706e93

4 files changed

Lines changed: 103 additions & 12 deletions

File tree

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ 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

0 commit comments

Comments
 (0)