gemika 0.4.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +112 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +31 -4
- data/Gemfile.5.2.mysql2 +1 -1
- data/Gemfile.5.2.mysql2.lock +4 -4
- data/Gemfile.5.2.pg.lock +2 -2
- data/Gemfile.5.2.sqlite3.lock +2 -2
- data/{Gemfile.6.0.pg → Gemfile.6.1.pg} +2 -2
- data/{Gemfile.6.0.pg.lock → Gemfile.6.1.pg.lock} +21 -22
- data/{Gemfile.4.2.pg → Gemfile.7.0.pg} +3 -5
- data/Gemfile.7.0.pg.lock +64 -0
- data/README.md +77 -7
- data/lib/gemika/database.rb +2 -2
- data/lib/gemika/env.rb +9 -1
- data/lib/gemika/errors.rb +2 -0
- data/lib/gemika/github_actions_generator.rb +150 -0
- data/lib/gemika/matrix/github_actions_config.rb +61 -0
- data/lib/gemika/matrix/travis_config.rb +42 -0
- data/lib/gemika/matrix.rb +109 -42
- data/lib/gemika/tasks/gemika.rb +14 -0
- data/lib/gemika/tasks/matrix.rb +4 -4
- data/lib/gemika/tasks.rb +1 -0
- data/lib/gemika/version.rb +1 -1
- data/spec/fixtures/github_actions_yml/Gemfile_without_gemika +1 -0
- data/spec/fixtures/github_actions_yml/excludes.yml +13 -0
- data/spec/fixtures/github_actions_yml/gemfile_without_gemika.yml +8 -0
- data/spec/fixtures/github_actions_yml/includes.yml +20 -0
- data/spec/fixtures/github_actions_yml/invalid.yml +8 -0
- data/spec/fixtures/github_actions_yml/missing_gemfile.yml +8 -0
- data/spec/fixtures/github_actions_yml/multiple_jobs.yml +16 -0
- data/spec/fixtures/github_actions_yml/two_by_two.yml +10 -0
- data/spec/fixtures/migrate/expected_github_actions.yml +129 -0
- data/{.travis.yml → spec/fixtures/migrate/travis.yml} +1 -1
- data/spec/gemika/matrix/row_spec.rb +62 -0
- data/spec/gemika/matrix_spec.rb +100 -0
- data/spec/spec_helper.rb +5 -1
- data/spec/support/database.github.yml +13 -0
- metadata +24 -15
- data/Gemfile.2.3.mysql2 +0 -18
- data/Gemfile.2.3.mysql2.lock +0 -42
- data/Gemfile.3.2.mysql2 +0 -18
- data/Gemfile.3.2.mysql2.lock +0 -67
- data/Gemfile.4.2.mysql2 +0 -17
- data/Gemfile.4.2.mysql2.lock +0 -69
- data/Gemfile.4.2.pg.lock +0 -69
- data/spec/support/database.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5738e95e2a60c2d8770b3e2c9c1af954fc9907fa08052881f4907ab92ab6486
|
4
|
+
data.tar.gz: d7a393eb17698030280a0de6a1f54339c58e7ed0102c622e3bcf41d84d240f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89340ce5602cd4b6321f774f99112230954d4eaa7eabdea7e1bb5f8c3441dda4feb5db9d29b1c921a07432c98b601f843e1b813e62ff5a620c0c0f3b8b5c3935
|
7
|
+
data.tar.gz: 70999ba66ef99d68eda7b1d5c800343c0c7ad2b1139386509c1d9d43f32847db50334695a1138244b2c67d573bb75470b387f8cbf979c88051bf9b0e346ff6d2
|
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
name: Tests
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
test_mysql:
|
12
|
+
runs-on: ubuntu-20.04
|
13
|
+
services:
|
14
|
+
mysql:
|
15
|
+
image: mysql:5.6
|
16
|
+
env:
|
17
|
+
MYSQL_ROOT_PASSWORD: password
|
18
|
+
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout
|
19
|
+
5s --health-retries 5
|
20
|
+
ports:
|
21
|
+
- 3306:3306
|
22
|
+
strategy:
|
23
|
+
fail-fast: false
|
24
|
+
matrix:
|
25
|
+
include:
|
26
|
+
- ruby: 2.5.3
|
27
|
+
gemfile: Gemfile.5.2.mysql2
|
28
|
+
env:
|
29
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- name: Install ruby
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: "${{ matrix.ruby }}"
|
36
|
+
- name: Setup database
|
37
|
+
run: |
|
38
|
+
mysql -e 'create database IF NOT EXISTS test;' -u root --password=password -P 3306 -h 127.0.0.1
|
39
|
+
- name: Bundle
|
40
|
+
run: |
|
41
|
+
gem install bundler:2.2.15
|
42
|
+
bundle install --no-deployment
|
43
|
+
- name: Run tests
|
44
|
+
run: bundle exec rspec
|
45
|
+
test_pg:
|
46
|
+
runs-on: ubuntu-20.04
|
47
|
+
services:
|
48
|
+
postgres:
|
49
|
+
image: postgres
|
50
|
+
env:
|
51
|
+
POSTGRES_PASSWORD: postgres
|
52
|
+
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
53
|
+
--health-retries 5"
|
54
|
+
ports:
|
55
|
+
- 5432:5432
|
56
|
+
strategy:
|
57
|
+
fail-fast: false
|
58
|
+
matrix:
|
59
|
+
include:
|
60
|
+
- ruby: 2.5.3
|
61
|
+
gemfile: Gemfile.5.2.pg
|
62
|
+
- ruby: 2.6.7
|
63
|
+
gemfile: Gemfile.6.1.pg
|
64
|
+
- ruby: 2.7.3
|
65
|
+
gemfile: Gemfile.6.1.pg
|
66
|
+
- ruby: 2.7.3
|
67
|
+
gemfile: Gemfile.7.0.pg
|
68
|
+
- ruby: 3.0.3
|
69
|
+
gemfile: Gemfile.6.1.pg
|
70
|
+
- ruby: 3.0.3
|
71
|
+
gemfile: Gemfile.7.0.pg
|
72
|
+
env:
|
73
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
74
|
+
steps:
|
75
|
+
- uses: actions/checkout@v2
|
76
|
+
- name: Install ruby
|
77
|
+
uses: ruby/setup-ruby@v1
|
78
|
+
with:
|
79
|
+
ruby-version: "${{ matrix.ruby }}"
|
80
|
+
- name: Setup database
|
81
|
+
run: |
|
82
|
+
sudo apt-get update
|
83
|
+
sudo apt-get install -y postgresql-client
|
84
|
+
PGPASSWORD=postgres psql -c 'create database test;' -U postgres -p 5432 -h localhost
|
85
|
+
- name: Bundle
|
86
|
+
run: |
|
87
|
+
gem install bundler:2.2.15
|
88
|
+
bundle install --no-deployment
|
89
|
+
- name: Run tests
|
90
|
+
run: bundle exec rspec
|
91
|
+
test_sqlite:
|
92
|
+
runs-on: ubuntu-20.04
|
93
|
+
strategy:
|
94
|
+
fail-fast: false
|
95
|
+
matrix:
|
96
|
+
include:
|
97
|
+
- ruby: 2.5.3
|
98
|
+
gemfile: Gemfile.5.2.sqlite3
|
99
|
+
env:
|
100
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
101
|
+
steps:
|
102
|
+
- uses: actions/checkout@v2
|
103
|
+
- name: Install ruby
|
104
|
+
uses: ruby/setup-ruby@v1
|
105
|
+
with:
|
106
|
+
ruby-version: "${{ matrix.ruby }}"
|
107
|
+
- name: Bundle
|
108
|
+
run: |
|
109
|
+
gem install bundler:2.2.15
|
110
|
+
bundle install --no-deployment
|
111
|
+
- name: Run tests
|
112
|
+
run: bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.3
|
data/CHANGELOG.md
CHANGED
@@ -7,17 +7,44 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
7
7
|
|
8
8
|
### Breaking changes
|
9
9
|
|
10
|
-
-
|
10
|
+
- Remove no longer supported ruby versions (2.3.8)
|
11
11
|
|
12
12
|
### Compatible changes
|
13
13
|
|
14
|
-
-
|
14
|
+
- test against ActiveRecord 7.0
|
15
15
|
|
16
|
-
## 0.
|
16
|
+
## 0.7.0 - 2022-01-19
|
17
17
|
|
18
18
|
### Breaking changes
|
19
19
|
|
20
|
-
-
|
20
|
+
- Remove no longer supported ruby versions (2.3.8)
|
21
|
+
|
22
|
+
### Compatible changes
|
23
|
+
|
24
|
+
- test against ActiveRecord 7.0
|
25
|
+
- add support for rbenv aliases
|
26
|
+
|
27
|
+
## 0.6.1 - 2021-04-20
|
28
|
+
|
29
|
+
### Compatible changes
|
30
|
+
|
31
|
+
- fix deprecation warning for Bundler.with_clean_env on Bundler >= 2
|
32
|
+
|
33
|
+
## 0.6.0 - 2021-04-20
|
34
|
+
|
35
|
+
### Compatible changes
|
36
|
+
|
37
|
+
- add Ruby 3 compatibility
|
38
|
+
- drop Ruby 2.2 support
|
39
|
+
|
40
|
+
## 0.5.0 - 2020-10-09
|
41
|
+
|
42
|
+
### Compatible changes
|
43
|
+
|
44
|
+
- add support for github actions instead of travis
|
45
|
+
- add method to migrate travis to github actions workflow
|
46
|
+
|
47
|
+
## 0.4.0 - 2019-08-07
|
21
48
|
|
22
49
|
### Compatible changes
|
23
50
|
|
data/Gemfile.5.2.mysql2
CHANGED
data/Gemfile.5.2.mysql2.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gemika (0.
|
4
|
+
gemika (0.7.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
method_source (0.9.2)
|
28
28
|
minitest (5.11.3)
|
29
|
-
mysql2 (0.
|
29
|
+
mysql2 (0.5.3)
|
30
30
|
pry (0.12.2)
|
31
31
|
coderay (~> 1.1.0)
|
32
32
|
method_source (~> 0.9.0)
|
@@ -55,7 +55,7 @@ DEPENDENCIES
|
|
55
55
|
activerecord (~> 5.2.0)
|
56
56
|
database_cleaner
|
57
57
|
gemika!
|
58
|
-
mysql2
|
58
|
+
mysql2
|
59
59
|
pry
|
60
60
|
rake
|
61
61
|
rspec (~> 3.5)
|
@@ -64,4 +64,4 @@ RUBY VERSION
|
|
64
64
|
ruby 2.2.4p230
|
65
65
|
|
66
66
|
BUNDLED WITH
|
67
|
-
|
67
|
+
2.2.15
|
data/Gemfile.5.2.pg.lock
CHANGED
data/Gemfile.5.2.sqlite3.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gemika (0.
|
4
|
+
gemika (0.7.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (6.
|
10
|
-
activesupport (= 6.
|
11
|
-
activerecord (6.
|
12
|
-
activemodel (= 6.
|
13
|
-
activesupport (= 6.
|
14
|
-
activesupport (6.
|
9
|
+
activemodel (6.1.3.1)
|
10
|
+
activesupport (= 6.1.3.1)
|
11
|
+
activerecord (6.1.3.1)
|
12
|
+
activemodel (= 6.1.3.1)
|
13
|
+
activesupport (= 6.1.3.1)
|
14
|
+
activesupport (6.1.3.1)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>=
|
17
|
-
minitest (
|
18
|
-
tzinfo (~>
|
19
|
-
zeitwerk (~> 2.
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
20
20
|
coderay (1.1.2)
|
21
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.8)
|
22
22
|
database_cleaner (1.7.0)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
i18n (1.
|
24
|
+
i18n (1.8.10)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
26
|
method_source (0.9.2)
|
27
|
-
minitest (5.
|
28
|
-
pg (
|
27
|
+
minitest (5.14.4)
|
28
|
+
pg (1.2.3)
|
29
29
|
pry (0.12.2)
|
30
30
|
coderay (~> 1.1.0)
|
31
31
|
method_source (~> 0.9.0)
|
@@ -43,19 +43,18 @@ GEM
|
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
44
|
rspec-support (~> 3.8.0)
|
45
45
|
rspec-support (3.8.2)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
zeitwerk (2.1.10)
|
46
|
+
tzinfo (2.0.4)
|
47
|
+
concurrent-ruby (~> 1.0)
|
48
|
+
zeitwerk (2.4.2)
|
50
49
|
|
51
50
|
PLATFORMS
|
52
51
|
ruby
|
53
52
|
|
54
53
|
DEPENDENCIES
|
55
|
-
activerecord (~> 6.
|
54
|
+
activerecord (~> 6.1.0)
|
56
55
|
database_cleaner
|
57
56
|
gemika!
|
58
|
-
pg
|
57
|
+
pg
|
59
58
|
pry
|
60
59
|
rake
|
61
60
|
rspec (~> 3.5)
|
@@ -64,4 +63,4 @@ RUBY VERSION
|
|
64
63
|
ruby 2.2.4p230
|
65
64
|
|
66
65
|
BUNDLED WITH
|
67
|
-
|
66
|
+
2.2.15
|
@@ -1,11 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Ruby
|
4
|
-
ruby '>=
|
4
|
+
ruby '>= 2.2'
|
5
5
|
|
6
6
|
# Runtime dependencies
|
7
|
-
gem 'activerecord', '~>
|
8
|
-
gem 'rspec', '~>3.
|
7
|
+
gem 'activerecord', '~> 7.0.0'
|
8
|
+
gem 'rspec', '~>3.5'
|
9
9
|
gem 'pg'
|
10
10
|
|
11
11
|
# Development dependencies
|
@@ -15,5 +15,3 @@ gem 'pry'
|
|
15
15
|
|
16
16
|
# Gem under test
|
17
17
|
gem 'gemika', :path => '.'
|
18
|
-
|
19
|
-
ruby '>= 1.9.3'
|
data/Gemfile.7.0.pg.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gemika (0.7.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (7.0.0)
|
10
|
+
activesupport (= 7.0.0)
|
11
|
+
activerecord (7.0.0)
|
12
|
+
activemodel (= 7.0.0)
|
13
|
+
activesupport (= 7.0.0)
|
14
|
+
activesupport (7.0.0)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
coderay (1.1.2)
|
20
|
+
concurrent-ruby (1.1.9)
|
21
|
+
database_cleaner (1.7.0)
|
22
|
+
diff-lcs (1.3)
|
23
|
+
i18n (1.8.11)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
method_source (0.9.2)
|
26
|
+
minitest (5.15.0)
|
27
|
+
pg (1.2.3)
|
28
|
+
pry (0.12.2)
|
29
|
+
coderay (~> 1.1.0)
|
30
|
+
method_source (~> 0.9.0)
|
31
|
+
rake (12.3.3)
|
32
|
+
rspec (3.8.0)
|
33
|
+
rspec-core (~> 3.8.0)
|
34
|
+
rspec-expectations (~> 3.8.0)
|
35
|
+
rspec-mocks (~> 3.8.0)
|
36
|
+
rspec-core (3.8.2)
|
37
|
+
rspec-support (~> 3.8.0)
|
38
|
+
rspec-expectations (3.8.4)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.8.0)
|
41
|
+
rspec-mocks (3.8.1)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.8.0)
|
44
|
+
rspec-support (3.8.2)
|
45
|
+
tzinfo (2.0.4)
|
46
|
+
concurrent-ruby (~> 1.0)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
ruby
|
50
|
+
|
51
|
+
DEPENDENCIES
|
52
|
+
activerecord (~> 7.0.0)
|
53
|
+
database_cleaner
|
54
|
+
gemika!
|
55
|
+
pg
|
56
|
+
pry
|
57
|
+
rake
|
58
|
+
rspec (~> 3.5)
|
59
|
+
|
60
|
+
RUBY VERSION
|
61
|
+
ruby 2.2.4p230
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Gemika
|
1
|
+
# Gemika [![Tests](https://github.com/makandra/gemika/workflows/Tests/badge.svg)](https://github.com/makandra/gemika/actions)
|
2
2
|
|
3
3
|
## Test a Ruby gem against multiple versions of everything
|
4
4
|
|
@@ -16,8 +16,9 @@ Here's what Gemika can give your test's development setup (all features are opt-
|
|
16
16
|
- Compute a matrix of all possible dependency permutations (Ruby, runtime gems, database type). Manually exclude incompatible dependency permutations (e.g. Rails 5.0 does not work with Ruby 2.1).
|
17
17
|
- Let developers enter their local credentials for MySQL and PostgreSQL in a `database.yml` file.
|
18
18
|
- Define default Ruby version, gem dependencies and database for developers who don't care about every possible permutation for everyday work.
|
19
|
-
- Help configure a [Travis CI](https://travis-ci.org/) build that tests every dependency permutation after each `git push`.
|
20
|
-
- Share your Ruby / gem dependeny / database permutation between local development and Travis CI.
|
19
|
+
- Help configure a [Travis CI](https://travis-ci.org/) or Github Actions build that tests every dependency permutation after each `git push`.
|
20
|
+
- Share your Ruby / gem dependeny / database permutation between local development and Travis CI / Github Actions.
|
21
|
+
- Migrate your Travis CI config to a Github Actions config.
|
21
22
|
- Define an [ActiveRecord database migration](http://api.rubyonrails.org/classes/ActiveRecord/Migration.html) that sets up your test database.
|
22
23
|
- Automatically drop and re-create your test database before each run of your test suite.
|
23
24
|
- Work around breaking changes in RSpec, Ruby and other gems
|
@@ -27,9 +28,9 @@ Here's what Gemika can give your test's development setup (all features are opt-
|
|
27
28
|
|
28
29
|
Gemika currently supports the following dependency versions:
|
29
30
|
|
30
|
-
- Ruby:
|
31
|
+
- Ruby: 2.3, 2.6, 3.0
|
31
32
|
- RSpec: Versions 1, 2, 3
|
32
|
-
- ActiveRecord: Versions
|
33
|
+
- ActiveRecord: Versions 3.2, 4.2, 5.2, 6.1, 7.0
|
33
34
|
- Databases: PostgreSQL (with `pg` gem), MySQL or MariaDB (with `mysql2` gem), or sqlite3 (with `sqlite3` gem)
|
34
35
|
|
35
36
|
Gemika also makes some assumption about your Gem:
|
@@ -65,6 +66,7 @@ spec/support/database.rb # Database schema for test database
|
|
65
66
|
spec/support/database.yml # Database credentials for local development (not checked in)
|
66
67
|
spec/support/database.sample.yml # Sample database credentials for new developers
|
67
68
|
spec/support/database.travis.yml # Database credentials for Travis CI
|
69
|
+
spec/support/database.github.yml # Alternatively: Database credentials for Github Actions
|
68
70
|
spec/my_gem/my_class_spec.rb # Tests for your gem
|
69
71
|
```
|
70
72
|
|
@@ -152,7 +154,7 @@ source 'https://rubygems.org'
|
|
152
154
|
|
153
155
|
# Runtime dependencies
|
154
156
|
gem 'rails', '~>3.2.22'
|
155
|
-
gem 'mysql2', '= 0.
|
157
|
+
gem 'mysql2', '= 0.4.10'
|
156
158
|
|
157
159
|
# Development dependencies
|
158
160
|
gem 'rspec', '~> 3.4'
|
@@ -216,6 +218,9 @@ gemfile:
|
|
216
218
|
Don't mind the `rvm` key if you're using a different version manager locally (like rbenv). Things will still work.
|
217
219
|
|
218
220
|
|
221
|
+
Alternatively, create a Github Actions file like [this](/.github/workflows/test.yml).
|
222
|
+
|
223
|
+
|
219
224
|
#### Excluding incompatible matrix rows
|
220
225
|
|
221
226
|
There might be incompatible combinations of gemfiles and Rubies, e.g. Rails 5.0 does not work with Ruby 2.1 or lower. In this case, add an `matrix`/`exclude` key to your `.travis.yml`:
|
@@ -229,6 +234,32 @@ matrix:
|
|
229
234
|
rvm: 2.1.8
|
230
235
|
```
|
231
236
|
|
237
|
+
For `.github/workflows/test.yml`, it looks similar:
|
238
|
+
|
239
|
+
```yaml
|
240
|
+
jobs:
|
241
|
+
my_job:
|
242
|
+
strategy:
|
243
|
+
matrix:
|
244
|
+
exclude:
|
245
|
+
- gemfile: Gemfile.5.0.mysql2
|
246
|
+
ruby: 2.1.8
|
247
|
+
- gemfile: Gemfile.5.0.pg
|
248
|
+
ruby: 2.1.8
|
249
|
+
```
|
250
|
+
|
251
|
+
|
252
|
+
Alternatively, you can instead explicitly list all Ruby / Gemfile combinations with
|
253
|
+
|
254
|
+
```
|
255
|
+
matrix:
|
256
|
+
include:
|
257
|
+
- gemfile: Gemfile.5.0.mysql2
|
258
|
+
rvm: 2.3.8
|
259
|
+
- gemfile: Gemfile.5.2.mysql2
|
260
|
+
rvm: 2.3.8
|
261
|
+
```
|
262
|
+
|
232
263
|
### Generate lockfiles
|
233
264
|
|
234
265
|
Generate lockfiles for each bundle by running:
|
@@ -332,6 +363,25 @@ Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each {|f| require f}
|
|
332
363
|
Now you have a great place for code snippets that need to run before specs (factories, VCR configuration, etc.).
|
333
364
|
|
334
365
|
|
366
|
+
To have your database work with Github Actions, add a database file `spec/support/database.github.yml`.
|
367
|
+
|
368
|
+
```
|
369
|
+
mysql:
|
370
|
+
database: test
|
371
|
+
username: root
|
372
|
+
password: password
|
373
|
+
host: 127.0.0.1
|
374
|
+
port: 3306
|
375
|
+
|
376
|
+
postgresql:
|
377
|
+
database: test
|
378
|
+
host: localhost
|
379
|
+
username: postgres
|
380
|
+
password: postgres
|
381
|
+
port: 5432
|
382
|
+
```
|
383
|
+
|
384
|
+
|
335
385
|
#### Test database schema
|
336
386
|
|
337
387
|
If your gem is talking to the database, you probably need to create some example tables.
|
@@ -388,6 +438,25 @@ Gemika::RSpec.configure_clean_database_before_example
|
|
388
438
|
Note that you also need `require 'gemika'` in your `spec_helper.rb`.
|
389
439
|
|
390
440
|
|
441
|
+
#### Migrate from Travis CI to Github Actions
|
442
|
+
|
443
|
+
To help in your migrations, you can ask Gemika to generate a Github Actions config from an existing `.travis-ci.yml`.
|
444
|
+
|
445
|
+
To do this, call
|
446
|
+
|
447
|
+
```
|
448
|
+
bundle exec rake gemika:generate_github_actions_workflow
|
449
|
+
```
|
450
|
+
|
451
|
+
Copy the resulting file to `.github/workflows/test.yml`.
|
452
|
+
|
453
|
+
Make sure you have a `spec/support/database.github.yml` if you use databases. See above how this is supposed to look like.
|
454
|
+
|
455
|
+
You may have to fix a few things manually though. For example, Github Actions will only allow certain Ruby versions (but show you a list of supported versions when it fails).
|
456
|
+
|
457
|
+
Also, when you run on a Ubuntu 20.04 container, you might have issues with the mysql2 gem. See [this guide](https://makandracards.com/makandra/486428-installing-old-versions-of-mysql2-on-ubuntu-20-04+) for a potential solution.
|
458
|
+
|
459
|
+
|
391
460
|
### Try it out
|
392
461
|
|
393
462
|
Check if you can install development dependencies for each row in the test matrix:
|
@@ -626,9 +695,10 @@ Here are some hints when you try to make changes to Gemika itself:
|
|
626
695
|
|
627
696
|
There are tests in `spec`. We only accept PRs with tests. To run tests:
|
628
697
|
|
629
|
-
- Install Ruby 2.
|
698
|
+
- Install Ruby 2.6.4
|
630
699
|
- Create a local test database `gemika_test` in both MySQL and PostgreSQL
|
631
700
|
- Copy `spec/support/database.sample.yml` to `spec/support/database.yml` and enter your local credentials for the test databases
|
701
|
+
- Create the databases specified in `database.yml`
|
632
702
|
- Install development dependencies using `bundle install`
|
633
703
|
- Run tests using `bundle exec rspec`
|
634
704
|
|
data/lib/gemika/database.rb
CHANGED
@@ -36,7 +36,7 @@ module Gemika
|
|
36
36
|
#
|
37
37
|
def connect
|
38
38
|
unless @connected
|
39
|
-
ActiveRecord::Base.establish_connection(adapter_config)
|
39
|
+
ActiveRecord::Base.establish_connection(**adapter_config)
|
40
40
|
@connected = true
|
41
41
|
end
|
42
42
|
end
|
@@ -108,7 +108,7 @@ module Gemika
|
|
108
108
|
else
|
109
109
|
raise UnknownAdapter, "Unknown database type. Either 'pg', 'mysql2', or 'sqlite3' gem should be in your current bundle."
|
110
110
|
end
|
111
|
-
default_config.merge(user_config)
|
111
|
+
default_config.merge(user_config).symbolize_keys
|
112
112
|
end
|
113
113
|
|
114
114
|
private
|
data/lib/gemika/env.rb
CHANGED
@@ -35,7 +35,15 @@ module Gemika
|
|
35
35
|
# process, regardless of what's in ENV temporarily
|
36
36
|
@gemfile_changed = true
|
37
37
|
@process_gemfile = ENV['BUNDLE_GEMFILE']
|
38
|
-
|
38
|
+
|
39
|
+
# .with_clean_env is deprecated since Bundler ~> 2.
|
40
|
+
bundler_method = if Gemika::Env.gem?('bundler', '< 2')
|
41
|
+
:with_clean_env
|
42
|
+
else
|
43
|
+
:with_unbundled_env
|
44
|
+
end
|
45
|
+
|
46
|
+
Bundler.send(bundler_method) do
|
39
47
|
ENV['BUNDLE_GEMFILE'] = path
|
40
48
|
block.call(*args)
|
41
49
|
end
|