Skip to content

Commit 20d5dab

Browse files
authored
Merge pull request #69 from petergoldstein/feature/switch_to_gh_actions
Switch to GitHub Actions and Add Ruby 3.1 / Rails 7
2 parents c4d02ae + 7c71458 commit 20d5dab

11 files changed

Lines changed: 101 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}'
8+
runs-on: 'ubuntu-20.04'
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
ruby: ['3.1', '3.0', '2.7', '2.6', '2.5']
13+
rails: ['5.1', '5.2', '6.0', '6.1', '7.0']
14+
exclude:
15+
- ruby: '3.1'
16+
rails: '5.1'
17+
- ruby: '3.1'
18+
rails: '5.2'
19+
- ruby: '3.1'
20+
rails: '6.0'
21+
- ruby: '3.0'
22+
rails: '5.1'
23+
- ruby: '3.0'
24+
rails: '5.2'
25+
- ruby: '2.6'
26+
rails: '7.0'
27+
- ruby: '2.5'
28+
rails: '7.0'
29+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
30+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Set up Ruby ${{ matrix.ruby }}
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: ${{ matrix.ruby }}
37+
bundler-cache: true # 'bundle install' and cache
38+
- name: Copy config file
39+
run: cp spec/support/sample.config.yml spec/support/config.yml
40+
- name: Run tests
41+
run: bundle exec rake
42+
43+
services:
44+
mysql:
45+
image: mysql:5.7
46+
env:
47+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
48+
ports:
49+
- 3306:3306
50+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
51+
52+
postgres:
53+
# Docker Hub image
54+
image: postgres
55+
# Provide the password for postgres
56+
env:
57+
POSTGRES_USER: postgres
58+
POSTGRES_PASSWORD: postgres
59+
ports:
60+
- 5432:5432
61+
# Set health checks to wait until postgres has started
62+
options: >-
63+
--health-cmd pg_isready
64+
--health-interval 10s
65+
--health-timeout 5s
66+
--health-retries 5
67+

Appraisals

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
appraise "rails-5.1" do
2-
gem "rails", "~>5.1.0"
2+
gem "rails", "~> 5.1.0"
33
end
44

55
appraise "rails-5.2" do
6-
gem "rails", "~>5.2.0"
6+
gem "rails", "~> 5.2.0"
77
end
88

99
appraise "rails-6.0" do
10-
gem "rails", "~>6.0.0"
10+
gem "rails", "~> 6.0.0"
1111
end
1212

1313
appraise "rails-6.1" do
14-
gem "rails", "~>6.1.0"
14+
gem "rails", "~> 6.1.0"
15+
end
16+
17+
appraise "rails-7.0" do
18+
gem "rails", "~> 7.0.0"
1519
end

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ gemspec
55
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
66

77
gem "rails", "~>5.2"
8-
gem "byebug"
98

109
group :test do
1110
gem "simplecov", require: false

gemfiles/rails_5.1.gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
source "https://rubygems.org"
44

55
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
6-
gem "rails", "~>5.1.0"
7-
gem "byebug"
6+
gem "rails", "~> 5.1.0"
87

98
group :test do
109
gem "simplecov", require: false

gemfiles/rails_5.2.gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
source "https://rubygems.org"
44

55
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
6-
gem "rails", "~>5.2.0"
7-
gem "byebug"
6+
gem "rails", "~> 5.2.0"
87

98
group :test do
109
gem "simplecov", require: false

gemfiles/rails_6.0.gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
source "https://rubygems.org"
44

55
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
6-
gem "rails", "~>6.0.0"
7-
gem "byebug"
6+
gem "rails", "~> 6.0.0"
87

98
group :test do
109
gem "simplecov", require: false

gemfiles/rails_6.1.gemfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
source "https://rubygems.org"
44

55
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
6-
gem "rails", "~>6.1.0"
7-
gem "byebug"
6+
gem "rails", "~> 6.1.0"
87

98
group :test do
109
gem "simplecov", require: false
1110
gem "codecov", require: false
1211
end
1312

13+
if RUBY_VERSION >= '3.1'
14+
gem 'net-smtp', require: false
15+
gem 'net-imap', require: false
16+
gem 'net-pop', require: false
17+
end
18+
19+
1420
gemspec path: "../"

gemfiles/rails_7.0.gemfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
6+
gem "rails", "~> 7.0.0"
7+
8+
group :test do
9+
gem "simplecov", require: false
10+
gem "codecov", require: false
11+
end
12+
13+
gemspec path: "../"

spec/database_cleaner/active_record/base_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module ActiveRecord
156156
context "and there are models" do
157157

158158
it "fetches from connection pool" do
159-
expect(strategy.connection_class.to_s).to eq "Kernel::User"
159+
expect(["Kernel::Agent", "Kernel::User"]).to include(strategy.connection_class.to_s)
160160
end
161161
end
162162
end

spec/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require "bundler/setup"
2-
require "byebug"
32

43
if ENV['COVERAGE'] == 'true'
54
require "simplecov"

0 commit comments

Comments
 (0)