Skip to content

Commit b13cfc0

Browse files
authored
Migrate to GitHub actions (#160)
1 parent 0dc4dc2 commit b13cfc0

13 files changed

+186
-83
lines changed

.github/workflows/test.yml

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
schedule:
9+
- cron: '02 4 * * *'
10+
11+
jobs:
12+
static:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: 2.7
19+
bundler-cache: true
20+
- run : bundle exec rake rubocop
21+
test:
22+
runs-on: ubuntu-latest
23+
services:
24+
postgres:
25+
image: postgres
26+
env:
27+
POSTGRES_PASSWORD: password
28+
options: >-
29+
--health-cmd pg_isready
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
ports:
34+
# Maps tcp port 5432 on service container to the host
35+
- 5432:5432
36+
env:
37+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
38+
RUN_GENERATORS: ${{ matrix.run_generators }}
39+
PGPASSWORD: password
40+
DATABASE_ADAPTER: ${{ matrix.database_adapter }}
41+
DATABASE_NAME: ${{ matrix.database_name }}
42+
DATABASE_PASSWORD: ${{ matrix.database_password }}
43+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
44+
strategy:
45+
matrix:
46+
rvm: ["2.7"]
47+
gemfile: ["Gemfile"]
48+
run_generators: ["false"]
49+
database_adapter: ['sqlite3']
50+
database_name: [":memory:"]
51+
database_password: ["password"]
52+
include:
53+
- rvm: ruby-head
54+
gemfile: gemfiles/rails_master.gemfile
55+
run_generators: "false"
56+
database_adapter: 'sqlite3'
57+
database_name: ":memory:"
58+
- rvm: 2.3.8
59+
gemfile: gemfiles/rails_3.2.gemfile
60+
run_generators: "false"
61+
database_adapter: 'sqlite3'
62+
database_name: ":memory:"
63+
- rvm: 2.3.8
64+
gemfile: gemfiles/rails_4.2.gemfile
65+
run_generators: "false"
66+
database_adapter: 'sqlite3'
67+
database_name: ":memory:"
68+
- rvm: 2.7
69+
gemfile: gemfiles/rails_5.2.gemfile
70+
run_generators: "false"
71+
database_adapter: 'sqlite3'
72+
database_name: ":memory:"
73+
- rvm: 2.7
74+
gemfile: gemfiles/rails_6.0.gemfile
75+
run_generators: "false"
76+
database_adapter: 'sqlite3'
77+
database_name: ":memory:"
78+
- rvm: 2.7
79+
gemfile: gemfiles/rails_5.2.gemfile
80+
run_generators: "false"
81+
database_adapter: 'sqlite3'
82+
database_name: ":memory:"
83+
- rvm: 2.7
84+
gemfile: gemfiles/rails_6.0.gemfile
85+
run_generators: "true"
86+
database_adapter: 'sqlite3'
87+
database_name: ":memory:"
88+
- rvm: 2.7
89+
gemfile: gemfiles/rails_6.0.gemfile
90+
database_adapter: 'postgresql'
91+
database_name: 'ci_test'
92+
database_password: "password"
93+
run_generators: "false"
94+
- rvm: 2.7
95+
gemfile: gemfiles/rails_7.0.gemfile
96+
run_generators: "true"
97+
database_adapter: 'sqlite3'
98+
database_name: ":memory:"
99+
steps:
100+
- uses: actions/checkout@v2
101+
- uses: ruby/setup-ruby@v1
102+
with:
103+
ruby-version: ${{ matrix.rvm }}
104+
bundler-cache: true
105+
- run: psql -c 'create database ci_test;' -U postgres -h localhost
106+
- run: bundle exec rake
107+
documentation:
108+
runs-on: ubuntu-latest
109+
needs: ['test', 'static']
110+
if: github.ref == 'refs/heads/master'
111+
steps:
112+
- uses: actions/checkout@v2
113+
- uses: ruby/setup-ruby@v1
114+
with:
115+
ruby-version: 2.7
116+
bundler-cache: true
117+
- run: 'bundle exec yard doc --private'
118+
- uses: JamesIves/github-pages-deploy-action@4.1.7
119+
with:
120+
branch: gh-pages
121+
folder: doc
122+

.travis.yml

-54
This file was deleted.

Appraisals

+7
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,19 @@ appraise 'rails-6.0' do
4141
end
4242
end
4343

44+
appraise 'rails-7.0' do
45+
gem 'activerecord', '~> 7'
46+
gem 'activesupport', '~> 7'
47+
gem 'railties', '~> 7'
48+
end
49+
4450
appraise 'rails-master' do
4551
gem 'activerecord', git: 'https://github.com/rails/rails.git'
4652
gem 'activesupport', git: 'https://github.com/rails/rails.git'
4753
gem 'railties', git: 'https://github.com/rails/rails.git'
4854

4955
group :development do
5056
gem 'sqlite3'
57+
gem 'pg', git: 'https://github.com/ged/ruby-pg.git'
5158
end
5259
end

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gem 'railties'
99

1010
group :development do
1111
gem 'appraisal'
12-
gem 'coveralls', require: false
12+
gem 'coveralls_reborn', require: false
1313
gem 'jeweler'
1414
gem 'pg'
1515
gem 'pry'

Gemfile.lock

+14-15
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@ GEM
3636
builder (3.2.4)
3737
coderay (1.1.3)
3838
concurrent-ruby (1.1.9)
39-
coveralls (0.8.23)
40-
json (>= 1.8, < 3)
41-
simplecov (~> 0.16.1)
42-
term-ansicolor (~> 1.3)
43-
thor (>= 0.19.4, < 2.0)
44-
tins (~> 1.6)
39+
coveralls_reborn (0.23.1)
40+
simplecov (>= 0.18.1, < 0.22.0)
41+
term-ansicolor (~> 1.6)
42+
thor (>= 0.20.3, < 2.0)
43+
tins (~> 1.16)
4544
crass (1.0.6)
4645
descendants_tracker (0.0.4)
4746
thread_safe (~> 0.3, >= 0.3.1)
4847
diff-lcs (1.4.4)
49-
docile (1.3.2)
48+
docile (1.4.0)
5049
erubi (1.10.0)
5150
faraday (0.9.2)
5251
multipart-post (>= 1.2, < 3)
@@ -74,7 +73,6 @@ GEM
7473
rake
7574
rdoc
7675
semver2
77-
json (2.3.0)
7876
jwt (2.2.1)
7977
loofah (2.12.0)
8078
crass (~> 1.0.2)
@@ -150,19 +148,20 @@ GEM
150148
parser (>= 3.0.1.1)
151149
ruby-progressbar (1.11.0)
152150
semver2 (3.4.2)
153-
simplecov (0.16.1)
151+
simplecov (0.21.2)
154152
docile (~> 1.1)
155-
json (>= 1.8, < 3)
156-
simplecov-html (~> 0.10.0)
157-
simplecov-html (0.10.2)
153+
simplecov-html (~> 0.11)
154+
simplecov_json_formatter (~> 0.1)
155+
simplecov-html (0.12.3)
156+
simplecov_json_formatter (0.1.3)
158157
sqlite3 (1.4.2)
159158
sync (0.5.0)
160159
term-ansicolor (1.7.1)
161160
tins (~> 1.0)
162161
thor (1.1.0)
163162
thread_safe (0.3.6)
164163
timecop (0.9.4)
165-
tins (1.24.1)
164+
tins (1.30.0)
166165
sync
167166
tzinfo (2.0.4)
168167
concurrent-ruby (~> 1.0)
@@ -178,7 +177,7 @@ DEPENDENCIES
178177
activesupport
179178
ancestry
180179
appraisal
181-
coveralls
180+
coveralls_reborn
182181
jeweler
183182
pg
184183
pry
@@ -190,4 +189,4 @@ DEPENDENCIES
190189
yard
191190

192191
BUNDLED WITH
193-
2.1.4
192+
2.2.30

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ ActsAsMessageable
22
=================
33

44
The Acts As Messageable allows communication between the models.
5-
6-
[![Build Status](https://secure.travis-ci.org/LTe/acts-as-messageable.png)](http://travis-ci.org/LTe/acts-as-messageable)
5+
[![Build Status](https://github.com/LTe/acts-as-messageable/actions/workflows/test.yml/badge.svg)](https://github.com/LTe/acts-as-messageable/actions/workflows/test.yml)
76
[![Code Climate](https://codeclimate.com/github/LTe/acts-as-messageable.png)](https://codeclimate.com/github/LTe/acts-as-messageable)
87
[![Coverage Status](https://coveralls.io/repos/LTe/acts-as-messageable/badge.png?branch=master)](https://coveralls.io/r/LTe/acts-as-messageable?branch=master)
98
[![Gem Version](https://badge.fury.io/rb/acts-as-messageable.png)](http://badge.fury.io/rb/acts-as-messageable)

gemfiles/rails_3.2.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem 'railties', '~> 3.2.22'
1111

1212
group :development do
1313
gem 'appraisal'
14-
gem 'coveralls', require: false
14+
gem 'coveralls_reborn', require: false
1515
gem 'jeweler'
1616
gem 'pg'
1717
gem 'pry'

gemfiles/rails_4.2.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem 'rdoc', '6.2.0'
1212

1313
group :development do
1414
gem 'appraisal'
15-
gem 'coveralls', require: false
15+
gem 'coveralls_reborn', require: false
1616
gem 'jeweler'
1717
gem 'pg'
1818
gem 'pry'

gemfiles/rails_5.2.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem 'railties', '~> 5.2.0'
1111

1212
group :development do
1313
gem 'appraisal'
14-
gem 'coveralls', require: false
14+
gem 'coveralls_reborn', require: false
1515
gem 'jeweler'
1616
gem 'pg'
1717
gem 'pry'

gemfiles/rails_6.0.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gem 'railties', '~> 6'
1111

1212
group :development do
1313
gem 'appraisal'
14-
gem 'coveralls', require: false
14+
gem 'coveralls_reborn', require: false
1515
gem 'jeweler'
1616
gem 'pg'
1717
gem 'pry'

gemfiles/rails_7.0.gemfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
# This file was generated by Appraisal
4+
5+
source 'http://rubygems.org'
6+
7+
gem 'activerecord', '~> 7'
8+
gem 'activesupport', '~> 7'
9+
gem 'ancestry'
10+
gem 'railties', '~> 7'
11+
12+
group :development do
13+
gem 'appraisal'
14+
gem 'coveralls_reborn', require: false
15+
gem 'jeweler'
16+
gem 'pg'
17+
gem 'pry'
18+
gem 'rspec'
19+
gem 'rubocop', require: false
20+
gem 'sqlite3'
21+
gem 'timecop'
22+
gem 'yard'
23+
end

gemfiles/rails_master.gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ gem 'railties', git: 'https://github.com/rails/rails.git'
1111

1212
group :development do
1313
gem 'appraisal'
14-
gem 'coveralls', require: false
14+
gem 'coveralls_reborn', require: false
1515
gem 'jeweler'
16-
gem 'pg'
16+
gem 'pg', git: 'https://github.com/ged/ruby-pg.git'
1717
gem 'pry'
1818
gem 'rspec'
1919
gem 'rubocop', require: false

spec/spec_helper.rb

+12-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424

2525
RSpec.configure do |config|
2626
config.before(:all) do
27-
ActiveRecord::Base.establish_connection(
28-
adapter: ENV.fetch('DATABASE_ADAPTER', 'sqlite3'),
29-
database: ENV.fetch('DATABASE_NAME', ':memory:')
30-
)
27+
establish_connection
3128
create_database
3229

3330
@alice = User.create email: 'alice@example.com'
@@ -47,12 +44,22 @@
4744
end
4845

4946
config.around(:each) do |example|
50-
supported_rails = Array.wrap(example.metadata[:rails]).presence || [3, 4, 5, 6]
47+
supported_rails = Array.wrap(example.metadata[:rails]).presence || [3, 4, 5, 6, 7]
5148

5249
example.run if supported_rails.include?(Rails::VERSION::MAJOR)
5350
end
5451
end
5552

53+
def establish_connection
54+
ActiveRecord::Base.establish_connection(
55+
adapter: ENV.fetch('DATABASE_ADAPTER', 'sqlite3'),
56+
database: ENV.fetch('DATABASE_NAME', ':memory:'),
57+
password: ENV.fetch('DATABASE_PASSWORD', 'password'),
58+
host: 'localhost',
59+
user: 'postgres'
60+
)
61+
end
62+
5663
def create_database
5764
ActiveRecord::Schema.define(version: 1) do
5865
enable_extension 'pgcrypto' if ENV.fetch('DATABASE_ADAPTER', '') == 'postgresql' && !extension_enabled?('pgcrypto')

0 commit comments

Comments
 (0)