gemika 0.3.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +114 -0
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +85 -0
  5. data/{gemfiles/Gemfile.3.2.mysql2 → Gemfile.3.2.mysql2} +4 -3
  6. data/{gemfiles/Gemfile.3.2.mysql2.lock → Gemfile.3.2.mysql2.lock} +19 -5
  7. data/{gemfiles/Gemfile.4.2.mysql2 → Gemfile.4.2.mysql2} +3 -2
  8. data/{gemfiles/Gemfile.4.2.mysql2.lock → Gemfile.4.2.mysql2.lock} +11 -5
  9. data/{gemfiles/Gemfile.4.2.pg → Gemfile.4.2.pg} +2 -1
  10. data/{gemfiles/Gemfile.4.2.pg.lock → Gemfile.4.2.pg.lock} +9 -3
  11. data/{gemfiles/Gemfile.5.0.mysql2 → Gemfile.5.2.mysql2} +4 -3
  12. data/{gemfiles/Gemfile.5.0.mysql2.lock → Gemfile.5.2.mysql2.lock} +28 -21
  13. data/{gemfiles/Gemfile.5.0.pg → Gemfile.5.2.pg} +3 -2
  14. data/{gemfiles/Gemfile.5.0.pg.lock → Gemfile.5.2.pg.lock} +26 -19
  15. data/{gemfiles/Gemfile.5.0.sqlite3 → Gemfile.5.2.sqlite3} +3 -2
  16. data/{gemfiles/Gemfile.5.0.sqlite3.lock → Gemfile.5.2.sqlite3.lock} +20 -14
  17. data/Gemfile.6.1.pg +17 -0
  18. data/Gemfile.6.1.pg.lock +66 -0
  19. data/README.md +117 -49
  20. data/gemika.gemspec +2 -2
  21. data/lib/gemika/database.rb +10 -4
  22. data/lib/gemika/env.rb +6 -0
  23. data/lib/gemika/errors.rb +2 -0
  24. data/lib/gemika/github_actions_generator.rb +150 -0
  25. data/lib/gemika/matrix.rb +38 -33
  26. data/lib/gemika/matrix/github_actions_config.rb +61 -0
  27. data/lib/gemika/matrix/travis_config.rb +42 -0
  28. data/lib/gemika/tasks.rb +1 -0
  29. data/lib/gemika/tasks/gemika.rb +14 -0
  30. data/lib/gemika/tasks/matrix.rb +4 -4
  31. data/lib/gemika/version.rb +1 -1
  32. data/spec/fixtures/github_actions_yml/Gemfile_without_gemika +1 -0
  33. data/spec/fixtures/github_actions_yml/excludes.yml +13 -0
  34. data/spec/fixtures/github_actions_yml/gemfile_without_gemika.yml +8 -0
  35. data/spec/fixtures/github_actions_yml/includes.yml +20 -0
  36. data/spec/fixtures/github_actions_yml/invalid.yml +8 -0
  37. data/spec/fixtures/github_actions_yml/missing_gemfile.yml +8 -0
  38. data/spec/fixtures/github_actions_yml/multiple_jobs.yml +16 -0
  39. data/spec/fixtures/github_actions_yml/two_by_two.yml +10 -0
  40. data/spec/fixtures/migrate/expected_github_actions.yml +129 -0
  41. data/spec/fixtures/migrate/travis.yml +66 -0
  42. data/spec/fixtures/travis_yml/includes.yml +12 -0
  43. data/spec/gemika/matrix_spec.rb +116 -0
  44. data/spec/spec_helper.rb +1 -0
  45. data/spec/support/database.github.yml +13 -0
  46. metadata +35 -20
  47. data/.travis.yml +0 -62
  48. data/gemfiles/Gemfile.2.3.mysql2 +0 -17
  49. data/gemfiles/Gemfile.2.3.mysql2.lock +0 -34
  50. data/spec/support/database.travis.yml +0 -9
@@ -4,13 +4,14 @@ source 'https://rubygems.org'
4
4
  ruby '>= 2.2'
5
5
 
6
6
  # Runtime dependencies
7
- gem 'activerecord', '~>5.0.0'
7
+ gem 'activerecord', '~>5.2.0'
8
8
  gem 'rspec', '~>3.5'
9
9
  gem 'pg', '~>0.18.4'
10
10
 
11
11
  # Development dependencies
12
12
  gem 'rake'
13
13
  gem 'database_cleaner'
14
+ gem 'pry'
14
15
 
15
16
  # Gem under test
16
- gem 'gemika', :path => '..'
17
+ gem 'gemika', :path => '.'
@@ -1,29 +1,35 @@
1
1
  PATH
2
- remote: ..
2
+ remote: .
3
3
  specs:
4
- gemika (0.3.3)
4
+ gemika (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (5.0.0.1)
10
- activesupport (= 5.0.0.1)
11
- activerecord (5.0.0.1)
12
- activemodel (= 5.0.0.1)
13
- activesupport (= 5.0.0.1)
14
- arel (~> 7.0)
15
- activesupport (5.0.0.1)
9
+ activemodel (5.2.3)
10
+ activesupport (= 5.2.3)
11
+ activerecord (5.2.3)
12
+ activemodel (= 5.2.3)
13
+ activesupport (= 5.2.3)
14
+ arel (>= 9.0)
15
+ activesupport (5.2.3)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (~> 0.7)
17
+ i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
- arel (7.1.2)
21
- concurrent-ruby (1.0.2)
22
- database_cleaner (1.5.3)
20
+ arel (9.0.0)
21
+ coderay (1.1.2)
22
+ concurrent-ruby (1.1.5)
23
+ database_cleaner (1.7.0)
23
24
  diff-lcs (1.2.5)
24
- i18n (0.7.0)
25
- minitest (5.9.0)
25
+ i18n (1.5.1)
26
+ concurrent-ruby (~> 1.0)
27
+ method_source (0.9.2)
28
+ minitest (5.11.3)
26
29
  pg (0.18.4)
30
+ pry (0.12.2)
31
+ coderay (~> 1.1.0)
32
+ method_source (~> 0.9.0)
27
33
  rake (11.3.0)
28
34
  rspec (3.5.0)
29
35
  rspec-core (~> 3.5.0)
@@ -38,18 +44,19 @@ GEM
38
44
  diff-lcs (>= 1.2.0, < 2.0)
39
45
  rspec-support (~> 3.5.0)
40
46
  rspec-support (3.5.0)
41
- thread_safe (0.3.5)
42
- tzinfo (1.2.2)
47
+ thread_safe (0.3.6)
48
+ tzinfo (1.2.5)
43
49
  thread_safe (~> 0.1)
44
50
 
45
51
  PLATFORMS
46
52
  ruby
47
53
 
48
54
  DEPENDENCIES
49
- activerecord (~> 5.0.0)
55
+ activerecord (~> 5.2.0)
50
56
  database_cleaner
51
57
  gemika!
52
58
  pg (~> 0.18.4)
59
+ pry
53
60
  rake
54
61
  rspec (~> 3.5)
55
62
 
@@ -57,4 +64,4 @@ RUBY VERSION
57
64
  ruby 2.2.4p230
58
65
 
59
66
  BUNDLED WITH
60
- 1.16.1
67
+ 2.2.15
@@ -4,13 +4,14 @@ source 'https://rubygems.org'
4
4
  ruby '>= 2.2'
5
5
 
6
6
  # Runtime dependencies
7
- gem 'activerecord', '~>5.0.0'
7
+ gem 'activerecord', '~>5.2.0'
8
8
  gem 'rspec', '~>3.5'
9
9
  gem 'sqlite3'
10
10
 
11
11
  # Development dependencies
12
12
  gem 'rake'
13
13
  gem 'database_cleaner'
14
+ gem 'pry'
14
15
 
15
16
  # Gem under test
16
- gem 'gemika', :path => '..'
17
+ gem 'gemika', :path => '.'
@@ -1,29 +1,34 @@
1
1
  PATH
2
- remote: ..
2
+ remote: .
3
3
  specs:
4
- gemika (0.3.3)
4
+ gemika (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (5.0.7)
10
- activesupport (= 5.0.7)
11
- activerecord (5.0.7)
12
- activemodel (= 5.0.7)
13
- activesupport (= 5.0.7)
14
- arel (~> 7.0)
15
- activesupport (5.0.7)
9
+ activemodel (5.2.3)
10
+ activesupport (= 5.2.3)
11
+ activerecord (5.2.3)
12
+ activemodel (= 5.2.3)
13
+ activesupport (= 5.2.3)
14
+ arel (>= 9.0)
15
+ activesupport (5.2.3)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
- arel (7.1.4)
21
- concurrent-ruby (1.0.5)
20
+ arel (9.0.0)
21
+ coderay (1.1.2)
22
+ concurrent-ruby (1.1.5)
22
23
  database_cleaner (1.7.0)
23
24
  diff-lcs (1.3)
24
- i18n (1.0.1)
25
+ i18n (1.5.1)
25
26
  concurrent-ruby (~> 1.0)
27
+ method_source (0.9.2)
26
28
  minitest (5.11.3)
29
+ pry (0.12.2)
30
+ coderay (~> 1.1.0)
31
+ method_source (~> 0.9.0)
27
32
  rake (12.3.1)
28
33
  rspec (3.7.0)
29
34
  rspec-core (~> 3.7.0)
@@ -47,9 +52,10 @@ PLATFORMS
47
52
  ruby
48
53
 
49
54
  DEPENDENCIES
50
- activerecord (~> 5.0.0)
55
+ activerecord (~> 5.2.0)
51
56
  database_cleaner
52
57
  gemika!
58
+ pry
53
59
  rake
54
60
  rspec (~> 3.5)
55
61
  sqlite3
@@ -58,4 +64,4 @@ RUBY VERSION
58
64
  ruby 2.2.4p230
59
65
 
60
66
  BUNDLED WITH
61
- 1.16.1
67
+ 2.2.15
data/Gemfile.6.1.pg ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Ruby
4
+ ruby '>= 2.2'
5
+
6
+ # Runtime dependencies
7
+ gem 'activerecord', '~>6.1.0'
8
+ gem 'rspec', '~>3.5'
9
+ gem 'pg'
10
+
11
+ # Development dependencies
12
+ gem 'rake'
13
+ gem 'database_cleaner'
14
+ gem 'pry'
15
+
16
+ # Gem under test
17
+ gem 'gemika', :path => '.'
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gemika (0.6.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
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
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ zeitwerk (~> 2.3)
20
+ coderay (1.1.2)
21
+ concurrent-ruby (1.1.8)
22
+ database_cleaner (1.7.0)
23
+ diff-lcs (1.3)
24
+ i18n (1.8.10)
25
+ concurrent-ruby (~> 1.0)
26
+ method_source (0.9.2)
27
+ minitest (5.14.4)
28
+ pg (1.2.3)
29
+ pry (0.12.2)
30
+ coderay (~> 1.1.0)
31
+ method_source (~> 0.9.0)
32
+ rake (12.3.3)
33
+ rspec (3.8.0)
34
+ rspec-core (~> 3.8.0)
35
+ rspec-expectations (~> 3.8.0)
36
+ rspec-mocks (~> 3.8.0)
37
+ rspec-core (3.8.2)
38
+ rspec-support (~> 3.8.0)
39
+ rspec-expectations (3.8.4)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-mocks (3.8.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-support (3.8.2)
46
+ tzinfo (2.0.4)
47
+ concurrent-ruby (~> 1.0)
48
+ zeitwerk (2.4.2)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ activerecord (~> 6.1.0)
55
+ database_cleaner
56
+ gemika!
57
+ pg
58
+ pry
59
+ rake
60
+ rspec (~> 3.5)
61
+
62
+ RUBY VERSION
63
+ ruby 2.2.4p230
64
+
65
+ BUNDLED WITH
66
+ 2.2.15
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Gemika [![Build Status](https://travis-ci.org/makandra/gemika.svg?branch=master)](https://travis-ci.org/makandra/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: 1.8.7, 2.1, 2.2, 2.3
31
+ - Ruby: 2.3, 2.6, 3.0
31
32
  - RSpec: Versions 1, 2, 3
32
- - ActiveRecord: Versions 2.3, 3.2, 4.2, 5.0
33
+ - ActiveRecord: Versions 3.2, 4.2, 5.2, 6.1
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:
@@ -43,14 +44,14 @@ Gemika also makes some assumption about your Gem:
43
44
  Below you can see the directory of a gem with a completed Gemika testing setup. The next section describes how to get there:
44
45
 
45
46
  ```shell
46
- gemfiles/Gemfile.set1 # First dependency set. Should include development dependencies and gemika.
47
- gemfiles/Gemfile.set1.lock # Generated by `rake matrix:install`
48
- gemfiles/Gemfile.set2 # Second dependency set. Should include development dependencies and gemika.
49
- gemfiles/Gemfile.set2.lock # Generated by `rake matrix:install`
50
- gemfiles/Gemfile.set3 # Third dependency set. Should include development dependencies and gemika.
51
- gemfiles/Gemfile.set3.lock # Generated by `rake matrix:install`
52
- Gemfile -> gemfiles/Gemfile.set2 # Symlink to default Gemfile for development
53
- Gemfile.lock -> gemfiles/Gemfile.set2.lock # Symlink to default Gemfile.lock for development
47
+ Gemfile.set1 # First dependency set. Should include development dependencies and gemika.
48
+ Gemfile.set1.lock # Generated by `rake matrix:install`
49
+ Gemfile.set2 # Second dependency set. Should include development dependencies and gemika.
50
+ Gemfile.set2.lock # Generated by `rake matrix:install`
51
+ Gemfile.set3 # Third dependency set. Should include development dependencies and gemika.
52
+ Gemfile.set3.lock # Generated by `rake matrix:install`
53
+ Gemfile -> Gemfile.set2 # Symlink to default Gemfile for development
54
+ Gemfile.lock -> Gemfile.set2.lock # Symlink to default Gemfile.lock for development
54
55
  .ruby-version # Default Ruby version for development
55
56
  .gitignore # Should ignore spec/support/database.yml
56
57
  .travis.yml # Configures all tested Ruby / gemfile combinations, for both local development and Travis CI
@@ -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
 
@@ -136,28 +138,23 @@ task :default => 'matrix:spec'
136
138
  ### Define multiple dependency sets
137
139
 
138
140
  We are now creating one `Gemfile` for each set of gems and database type you'd like to test again.
141
+ Your gemfiles should be placed directly in your project's root directory.
139
142
 
140
- First, create a directory for the gemfiles:
141
-
142
- ```shell
143
- mkdir gemfiles
144
- ```
145
-
146
- For each dependency set, create a `Gemfile` in the `gemfiles` directory that contains:
143
+ For each dependency set, create a `Gemfile` in the project root directory that contains:
147
144
 
148
145
  1. The runtime dependencies you'd like to test against (e.g. Rails 5)
149
- 2. The development dependencies for that set (e.g. `rspec`) in a version that is compatible with these runtime gependencies.
146
+ 2. The development dependencies for that set (e.g. `rspec`) in a version that is compatible with these runtime dependencies.
150
147
  3. The `gemika` gem
151
- 4. Your own gem from path `..`
152
-
153
- For instance, if one dependency set is Rails 3.2 with a MySQL database, we would create `gemfiles/Gemfile.4.2.mysql2` with these contents:
148
+ 4. Your own gem from path `.`
149
+
150
+ For instance, if one dependency set is Rails 3.2 with a MySQL database, we would create `./Gemfile.4.2.mysql2` with these contents:
154
151
 
155
152
  ```ruby
156
153
  source 'https://rubygems.org'
157
154
 
158
155
  # Runtime dependencies
159
156
  gem 'rails', '~>3.2.22'
160
- gem 'mysql2', '= 0.3.17'
157
+ gem 'mysql2', '= 0.4.10'
161
158
 
162
159
  # Development dependencies
163
160
  gem 'rspec', '~> 3.4'
@@ -166,10 +163,10 @@ gem 'byebug'
166
163
  gem 'gemika'
167
164
 
168
165
  # Gem under test
169
- gem 'my_gem', :path => '..'
166
+ gem 'my_gem', :path => '.'
170
167
  ```
171
168
 
172
- If a second dependency is Rails 5.0 with a PostgreSQL database, we would create `gemfiles/Gemfile.5.0.pg` with these contents:
169
+ If a second dependency is Rails 5.0 with a PostgreSQL database, we would create `./Gemfile.5.0.pg` with these contents:
173
170
 
174
171
  ```ruby
175
172
  source 'https://rubygems.org'
@@ -185,14 +182,14 @@ gem 'byebug'
185
182
  gem 'gemika'
186
183
 
187
184
  # Gem under test
188
- gem 'my_gem', :path => '..'
185
+ gem 'my_gem', :path => '.'
189
186
  ```
190
187
 
191
- In this example, your `gemfiles` directory should now look like this:
188
+ In this example, your project directory should now also contain:
192
189
 
193
190
  ```
194
- gemfiles/Gemfile.4.2.mysql2
195
- gemfiles/Gemfile.5.0.pg
191
+ Gemfile.4.2.mysql2
192
+ Gemfile.5.0.pg
196
193
  ```
197
194
 
198
195
 
@@ -200,7 +197,7 @@ gemfiles/Gemfile.5.0.pg
200
197
 
201
198
  We will now define a test matrix that contains all permutations of gemfiles and tested Ruby versions.
202
199
 
203
- We store the matrix in a `.travis.yml` file, **even if the project is not using Travis CI**. This allows us to configure the matrix once and us it for both local developent and Travis CI builds.
200
+ We store the matrix in a `.travis.yml` file, **even if the project is not using Travis CI**. This allows us to configure the matrix once and us it for both local development and Travis CI builds.
204
201
 
205
202
  Create a `.travis.yml` that lists all gemfiles and Ruby versions you'd like to test against:
206
203
 
@@ -211,16 +208,19 @@ rvm:
211
208
  - 2.3.1
212
209
 
213
210
  gemfile:
214
- - gemfiles/Gemfile.3.2.mysql2
215
- - gemfiles/Gemfile.4.2.mysql2
216
- - gemfiles/Gemfile.4.2.pg
217
- - gemfiles/Gemfile.5.0.mysql2
218
- - gemfiles/Gemfile.5.0.pg
211
+ - Gemfile.3.2.mysql2
212
+ - Gemfile.4.2.mysql2
213
+ - Gemfile.4.2.pg
214
+ - Gemfile.5.0.mysql2
215
+ - Gemfile.5.0.pg
219
216
  ```
220
217
 
221
218
  Don't mind the `rvm` key if you're using a different version manager locally (like rbenv). Things will still work.
222
219
 
223
220
 
221
+ Alternatively, create a Github Actions file like [this](/.github/workflows/test.yml).
222
+
223
+
224
224
  #### Excluding incompatible matrix rows
225
225
 
226
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`:
@@ -228,12 +228,38 @@ There might be incompatible combinations of gemfiles and Rubies, e.g. Rails 5.0
228
228
  ```yaml
229
229
  matrix:
230
230
  exclude:
231
- - gemfile: gemfiles/Gemfile.5.0.mysql2
231
+ - gemfile: Gemfile.5.0.mysql2
232
232
  rvm: 2.1.8
233
- - gemfile: gemfiles/Gemfile.5.0.pg
233
+ - gemfile: Gemfile.5.0.pg
234
234
  rvm: 2.1.8
235
235
  ```
236
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
+
237
263
  ### Generate lockfiles
238
264
 
239
265
  Generate lockfiles for each bundle by running:
@@ -242,13 +268,13 @@ Generate lockfiles for each bundle by running:
242
268
  rake matrix:install
243
269
  ```
244
270
 
245
- In this example, your `gemfiles` directory should now contain a lockfile for each gemfile:
271
+ In this example, your project directory should now contain a lockfile for each gemfile:
246
272
 
247
273
  ```
248
- gemfiles/Gemfile.4.2.mysql2
249
- gemfiles/Gemfile.4.2.mysql2.lock
250
- gemfiles/Gemfile.5.0.pg
251
- gemfiles/Gemfile.5.0.pg.lock
274
+ Gemfile.4.2.mysql2
275
+ Gemfile.4.2.mysql2.lock
276
+ Gemfile.5.0.pg
277
+ Gemfile.5.0.pg.lock
252
278
  ```
253
279
 
254
280
  Gemfiles and lockfiles should be committed to your repo.
@@ -269,8 +295,8 @@ Create a `.ruby-version` file with the default Ruby version:
269
295
  Choose a default dependency set and symlink both gemfile and lockfile to your project root:
270
296
 
271
297
  ```
272
- ln -s gemfiles/Gemfile.4.2.mysql2 Gemfile
273
- ln -s gemfiles/Gemfile.4.2.mysql2.lock Gemfile.lock
298
+ ln -s Gemfile.4.2.mysql2 Gemfile
299
+ ln -s Gemfile.4.2.mysql2.lock Gemfile.lock
274
300
  ```
275
301
 
276
302
  Commit both `.ruby-version` and symlinks to your repo.
@@ -295,6 +321,9 @@ postgresql:
295
321
  database: minidusen_test
296
322
  user:
297
323
  password:
324
+
325
+ sqlite:
326
+ database: ":memory:"
298
327
  ```
299
328
 
300
329
  We don't want to commit our local credentials, so add a line to your `.gitignore`:
@@ -334,6 +363,25 @@ Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each {|f| require f}
334
363
  Now you have a great place for code snippets that need to run before specs (factories, VCR configuration, etc.).
335
364
 
336
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
+
337
385
  #### Test database schema
338
386
 
339
387
  If your gem is talking to the database, you probably need to create some example tables.
@@ -390,6 +438,25 @@ Gemika::RSpec.configure_clean_database_before_example
390
438
  Note that you also need `require 'gemika'` in your `spec_helper.rb`.
391
439
 
392
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
+
393
460
  ### Try it out
394
461
 
395
462
  Check if you can install development dependencies for each row in the test matrix:
@@ -431,8 +498,8 @@ rake matrix:spec
431
498
  Note that if your current Ruby version is *very* far away from your [default Ruby](#default-ruby-and-default-gemfile) in `.ruby-version`, you might need to run `rake` with a gemfile that has compatible dependencies:
432
499
 
433
500
  ```shell
434
- BUNDLE_GEMFILE=gemfiles/Gemfile.2.3 bundle exec rake matrix:install
435
- BUNDLE_GEMFILE=gemfiles/Gemfile.2.3 bundle exec rake matrix:spec
501
+ BUNDLE_GEMFILE=Gemfile.2.3 bundle exec rake matrix:install
502
+ BUNDLE_GEMFILE=Gemfile.2.3 bundle exec rake matrix:spec
436
503
  ```
437
504
 
438
505
  We recommend to setup Travis CI to check the entire test matrix after each push, including all Rubies. This way developers can stay on the [default Ruby and gemfile](#default-ruby-and-default-gemfile) most of the time while Travis CI checks make sure that nothing broken gets merged.
@@ -628,9 +695,10 @@ Here are some hints when you try to make changes to Gemika itself:
628
695
 
629
696
  There are tests in `spec`. We only accept PRs with tests. To run tests:
630
697
 
631
- - Install Ruby 2.2.4
698
+ - Install Ruby 2.6.4
632
699
  - Create a local test database `gemika_test` in both MySQL and PostgreSQL
633
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`
634
702
  - Install development dependencies using `bundle install`
635
703
  - Run tests using `bundle exec rspec`
636
704