Skip to content

Commit f32b0cd

Browse files
committed
chore(test): move from travis to github workflows
- gemspec rails to be >= 6 - use Appraisals to separate gemfiles between rails version
1 parent dd4f44d commit f32b0cd

File tree

9 files changed

+87
-20
lines changed

9 files changed

+87
-20
lines changed

.github/workflows/ruby.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Ruby
9+
10+
on:
11+
push:
12+
branches: ['master']
13+
pull_request:
14+
branches: ['master']
15+
schedule:
16+
- cron: '0 0 * * 0'
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
ruby-version: ['3.0', '3.1']
27+
activerecord: ['6.0', '6.1']
28+
env:
29+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up Ruby
33+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
34+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
35+
# uses: ruby/setup-ruby@v1
36+
uses: ruby/setup-ruby@v1
37+
with:
38+
ruby-version: ${{ matrix.ruby-version }}
39+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
40+
- name: Run tests
41+
run: bundle exec rake

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ test/dummy/.sass-cache
88
vendor/bundle
99
Gemfile.lock
1010
.ruby-version
11+
gemfiles/*.gemfile.lock

.travis.yml

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

Appraisals

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
appraise "rails-6.0" do
2+
gem 'rails', '~> 6.0'
3+
end
4+
5+
appraise "rails-6.1" do
6+
gem 'rails', '~> 6.1'
7+
end
8+
9+
appraise "rails-7.0" do
10+
gem 'rails', '~> 7.0'
11+
end
12+
13+
appraise "rails-7.1" do
14+
gem 'rails', '~> 7.1'
15+
end

gemfiles/rails_6.0.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 6.0"
6+
7+
gemspec path: "../"

gemfiles/rails_6.1.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 6.1"
6+
7+
gemspec path: "../"

gemfiles/rails_7.0.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 7.0"
6+
7+
gemspec path: "../"

gemfiles/rails_7.1.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 7.1"
6+
7+
gemspec path: "../"

rails_utils.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ Gem::Specification.new do |s|
1717

1818
s.required_ruby_version = ">= 3.0"
1919

20-
s.add_dependency "rails", "~> 6"
20+
s.add_dependency "rails", ">= 6"
2121

2222
s.add_development_dependency "minitest" , ">= 4.7.5"
2323
s.add_development_dependency "sprockets", '~>3.0'
24+
s.add_development_dependency "appraisal", "~> 2.1"
2425
s.add_development_dependency "mocha"
2526

2627
s.license = 'MIT'

0 commit comments

Comments
 (0)