gemika 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +122 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile.3.2.mysql2 +1 -1
  5. data/Gemfile.3.2.mysql2.lock +9 -3
  6. data/Gemfile.4.2.mysql2 +1 -1
  7. data/Gemfile.4.2.mysql2.lock +3 -3
  8. data/Gemfile.4.2.pg.lock +1 -1
  9. data/Gemfile.5.2.mysql2 +1 -1
  10. data/Gemfile.5.2.mysql2.lock +3 -3
  11. data/Gemfile.5.2.pg.lock +1 -1
  12. data/Gemfile.5.2.sqlite3.lock +1 -1
  13. data/Gemfile.6.0.pg.lock +1 -1
  14. data/README.md +73 -4
  15. data/lib/gemika/errors.rb +2 -0
  16. data/lib/gemika/github_actions_generator.rb +150 -0
  17. data/lib/gemika/matrix.rb +38 -37
  18. data/lib/gemika/matrix/github_actions_config.rb +61 -0
  19. data/lib/gemika/matrix/travis_config.rb +42 -0
  20. data/lib/gemika/tasks.rb +1 -0
  21. data/lib/gemika/tasks/gemika.rb +14 -0
  22. data/lib/gemika/tasks/matrix.rb +4 -4
  23. data/lib/gemika/version.rb +1 -1
  24. data/spec/fixtures/github_actions_yml/Gemfile_without_gemika +1 -0
  25. data/spec/fixtures/github_actions_yml/excludes.yml +13 -0
  26. data/spec/fixtures/github_actions_yml/gemfile_without_gemika.yml +8 -0
  27. data/spec/fixtures/github_actions_yml/includes.yml +20 -0
  28. data/spec/fixtures/github_actions_yml/invalid.yml +8 -0
  29. data/spec/fixtures/github_actions_yml/missing_gemfile.yml +8 -0
  30. data/spec/fixtures/github_actions_yml/multiple_jobs.yml +16 -0
  31. data/spec/fixtures/github_actions_yml/two_by_two.yml +10 -0
  32. data/spec/fixtures/migrate/expected_github_actions.yml +129 -0
  33. data/{.travis.yml → spec/fixtures/migrate/travis.yml} +0 -0
  34. data/spec/gemika/matrix_spec.rb +100 -0
  35. data/spec/support/database.github.yml +13 -0
  36. metadata +18 -6
  37. data/Gemfile.2.3.mysql2 +0 -18
  38. data/Gemfile.2.3.mysql2.lock +0 -42
  39. data/spec/support/database.travis.yml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fedb3aee63ae355ed896b97cf22727672fb183d6e2b9b65c763218b70d6e870d
4
- data.tar.gz: 3255a3af654ad5e6b1da0f72de06df6ec329fb245b115171d2c0d616f682e8b7
3
+ metadata.gz: 701bc10b573451892d0ced9b83f58b61abf15c326f81c6db6e7b88b03bddf172
4
+ data.tar.gz: 928992d9c46eaa7bb770a94157a7c0c31bd1e25977b2f04b8146c9e6e8cc56e5
5
5
  SHA512:
6
- metadata.gz: a48af295157b11a8db5d0732852fd1d22e0d11e75e3fd86abb74eca8ed15ef5c75cf17ef402c292fab258c4dc9f5b9080e2307905b0340fdb810f380aebdb920
7
- data.tar.gz: 1426cb831889286355ab5e297f794dfa0f9b75ec387aed8d8dc68d3e7fc443e7074486a29f8ec1898a22748a26e77b5509a283d54a9ddc9c8c51e3240c3b78be
6
+ metadata.gz: 00bb0cdd5ff56a7ee5a06bf67e89ac0a165b0517e0eda952d1f72f979fc6382559f14bcc13292a43eb1d1f2c024e381cba9484f2b11bc29f458d917d90b94217
7
+ data.tar.gz: 0f22df4164b5b72c452a445cd80f11013dd0aef557d431a7b2972c55dc0534461d077284b127e350d3ab79eccbc1c64c14e2e94980781a2e85bf9dffea20118e
@@ -0,0 +1,122 @@
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.2.10
27
+ gemfile: Gemfile.3.2.mysql2
28
+ - ruby: 2.3.8
29
+ gemfile: Gemfile.4.2.mysql2
30
+ - ruby: 2.2.10
31
+ gemfile: Gemfile.4.2.mysql2
32
+ - ruby: 2.3.8
33
+ gemfile: Gemfile.4.2.mysql2
34
+ - ruby: 2.2.10
35
+ gemfile: Gemfile.5.2.mysql2
36
+ - ruby: 2.3.8
37
+ gemfile: Gemfile.5.2.mysql2
38
+ env:
39
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
40
+ steps:
41
+ - uses: actions/checkout@v2
42
+ - name: Install ruby
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: "${{ matrix.ruby }}"
46
+ - name: Setup database
47
+ run: |
48
+ sudo apt-get install -y mysql-client libmariadbclient-dev
49
+ mysql -e 'create database IF NOT EXISTS test;' -u root --password=password -P 3306 -h 127.0.0.1
50
+ - name: Bundle
51
+ run: |
52
+ gem install bundler:1.17.3
53
+ bundle install --no-deployment
54
+ - name: Run tests
55
+ run: bundle exec rspec
56
+ test_pg:
57
+ runs-on: ubuntu-20.04
58
+ services:
59
+ postgres:
60
+ image: postgres
61
+ env:
62
+ POSTGRES_PASSWORD: postgres
63
+ options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
64
+ --health-retries 5"
65
+ ports:
66
+ - 5432:5432
67
+ strategy:
68
+ fail-fast: false
69
+ matrix:
70
+ include:
71
+ - ruby: 2.2.10
72
+ gemfile: Gemfile.4.2.pg
73
+ - ruby: 2.3.8
74
+ gemfile: Gemfile.4.2.pg
75
+ - ruby: 2.2.10
76
+ gemfile: Gemfile.5.2.pg
77
+ - ruby: 2.3.8
78
+ gemfile: Gemfile.5.2.pg
79
+ - ruby: 2.6.4
80
+ gemfile: Gemfile.6.0.pg
81
+ env:
82
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
83
+ steps:
84
+ - uses: actions/checkout@v2
85
+ - name: Install ruby
86
+ uses: ruby/setup-ruby@v1
87
+ with:
88
+ ruby-version: "${{ matrix.ruby }}"
89
+ - name: Setup database
90
+ run: |
91
+ sudo apt-get install -y postgresql-client
92
+ PGPASSWORD=postgres psql -c 'create database test;' -U postgres -p 5432 -h localhost
93
+ - name: Bundle
94
+ run: |
95
+ gem install bundler:1.17.3
96
+ bundle install --no-deployment
97
+ - name: Run tests
98
+ run: bundle exec rspec
99
+ test_sqlite:
100
+ runs-on: ubuntu-20.04
101
+ strategy:
102
+ fail-fast: false
103
+ matrix:
104
+ include:
105
+ - ruby: 2.2.10
106
+ gemfile: Gemfile.5.2.sqlite3
107
+ - ruby: 2.3.8
108
+ gemfile: Gemfile.5.2.sqlite3
109
+ env:
110
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
111
+ steps:
112
+ - uses: actions/checkout@v2
113
+ - name: Install ruby
114
+ uses: ruby/setup-ruby@v1
115
+ with:
116
+ ruby-version: "${{ matrix.ruby }}"
117
+ - name: Bundle
118
+ run: |
119
+ gem install bundler:1.17.3
120
+ bundle install --no-deployment
121
+ - name: Run tests
122
+ run: bundle exec rspec
@@ -1 +1 @@
1
- 2.2.4
1
+ 2.2.10
@@ -6,7 +6,7 @@ ruby '< 2.3'
6
6
  # Runtime dependencies
7
7
  gem 'activerecord', '=3.2.22'
8
8
  gem 'rspec', '~> 3.4'
9
- gem 'mysql2', '= 0.3.17'
9
+ gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts'
10
10
  gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
11
11
 
12
12
  # Development dependencies
@@ -1,7 +1,14 @@
1
+ GIT
2
+ remote: https://github.com/makandra/mysql2
3
+ revision: c920d41e43c4722d4c065d2ea9d21494c560bd85
4
+ branch: 0.3.x-lts
5
+ specs:
6
+ mysql2 (0.3.21)
7
+
1
8
  PATH
2
9
  remote: .
3
10
  specs:
4
- gemika (0.4.1)
11
+ gemika (0.5.0)
5
12
 
6
13
  GEM
7
14
  remote: https://rubygems.org/
@@ -25,7 +32,6 @@ GEM
25
32
  i18n (0.6.11)
26
33
  method_source (0.9.2)
27
34
  multi_json (1.12.1)
28
- mysql2 (0.3.17)
29
35
  pry (0.9.12.6)
30
36
  coderay (~> 1.0)
31
37
  method_source (~> 0.8)
@@ -55,7 +61,7 @@ DEPENDENCIES
55
61
  database_cleaner (~> 1.0.0)
56
62
  gemika!
57
63
  i18n (= 0.6.11)
58
- mysql2 (= 0.3.17)
64
+ mysql2!
59
65
  pry
60
66
  rake (= 10.0.4)
61
67
  rspec (~> 3.4)
@@ -6,7 +6,7 @@ ruby '>= 1.9.3'
6
6
  # Runtime dependencies
7
7
  gem 'activerecord', '~>4.2.1'
8
8
  gem 'rspec', '~>3.4'
9
- gem 'mysql2', '~> 0.3.17'
9
+ gem 'mysql2', '~>0.4.10'
10
10
 
11
11
  # Development dependencies
12
12
  gem 'rake'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -28,7 +28,7 @@ GEM
28
28
  json (1.8.3)
29
29
  method_source (0.9.2)
30
30
  minitest (5.9.0)
31
- mysql2 (0.3.21)
31
+ mysql2 (0.4.10)
32
32
  pry (0.12.2)
33
33
  coderay (~> 1.1.0)
34
34
  method_source (~> 0.9.0)
@@ -57,7 +57,7 @@ DEPENDENCIES
57
57
  activerecord (~> 4.2.1)
58
58
  database_cleaner
59
59
  gemika!
60
- mysql2 (~> 0.3.17)
60
+ mysql2 (~> 0.4.10)
61
61
  pry
62
62
  rake
63
63
  rspec (~> 3.4)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,7 +6,7 @@ ruby '>= 2.2'
6
6
  # Runtime dependencies
7
7
  gem 'activerecord', '~>5.2.0'
8
8
  gem 'rspec', '~>3.5'
9
- gem 'mysql2', '~>0.4.4'
9
+ gem 'mysql2'
10
10
 
11
11
  # Development dependencies
12
12
  gem 'rake'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.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.4.4)
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 (~> 0.4.4)
58
+ mysql2
59
59
  pry
60
60
  rake
61
61
  rspec (~> 3.5)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemika (0.4.1)
4
+ gemika (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
@@ -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.3.17'
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:
@@ -6,4 +6,6 @@ module Gemika
6
6
  class UnsupportedRuby < Error; end
7
7
  class MatrixFailed < Error; end
8
8
  class RSpecFailed < Error; end
9
+ class MissingMatrixDefinition < Error; end
10
+ class InvalidMatrixDefinition < Error; end
9
11
  end
@@ -0,0 +1,150 @@
1
+ module Gemika
2
+ class GithubActionsGenerator
3
+ TYPES = {
4
+ test_sqlite: {
5
+ gemfile_filter: /\.sqlite/,
6
+ },
7
+ test_pg: {
8
+ gemfile_filter: /\.pg/,
9
+ database_setup: [
10
+ 'sudo apt-get install -y postgresql-client',
11
+ "PGPASSWORD=postgres psql -c 'create database test;' -U postgres -p 5432 -h localhost",
12
+ ],
13
+ services: {
14
+ 'postgres' => {
15
+ 'image' => 'postgres',
16
+ 'env' => {
17
+ 'POSTGRES_PASSWORD' => 'postgres'
18
+ },
19
+ 'options' => '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5',
20
+ 'ports' => ['5432:5432'],
21
+ },
22
+ },
23
+ },
24
+ test_mysql: {
25
+ gemfile_filter: /\.mysql/,
26
+ database_setup: [
27
+ 'sudo apt-get install -y mysql-client libmariadbclient-dev',
28
+ "mysql -e 'create database IF NOT EXISTS test;' -u root --password=password -P 3306 -h 127.0.0.1",
29
+ ],
30
+ services: {
31
+ 'mysql' => {
32
+ 'image' => 'mysql:5.6',
33
+ 'env' => {
34
+ 'MYSQL_ROOT_PASSWORD' => 'password',
35
+ },
36
+ 'options' => '--health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5',
37
+ 'ports' => ['3306:3306'],
38
+ },
39
+ },
40
+ },
41
+ test: {
42
+ gemfile_filter: //,
43
+ }
44
+ }
45
+
46
+ def initialize(bundler_version:)
47
+ @bundler_version = bundler_version
48
+ end
49
+
50
+ def generate(rows)
51
+ rows_by_type = split_rows_by_gemfile(rows)
52
+ jobs = {}
53
+ rows_by_type.each do |type, type_rows|
54
+ jobs[type.to_s] = job_by_type(type, type_rows)
55
+ end
56
+ full_config(jobs)
57
+ end
58
+
59
+ private
60
+
61
+ def split_rows_by_gemfile(rows)
62
+ rows.group_by do |row|
63
+ TYPES.detect do |type, type_definition|
64
+ row.gemfile =~ type_definition[:gemfile_filter]
65
+ end.first
66
+ end
67
+ end
68
+
69
+ def job_by_type(type, rows)
70
+ matrix = full_matrix(rows) || include_matrix(rows)
71
+ type_definition = TYPES[type]
72
+
73
+ steps = [{
74
+ 'uses' => 'actions/checkout@v2',
75
+ }, {
76
+ 'name' => 'Install ruby',
77
+ 'uses' => 'ruby/setup-ruby@v1',
78
+ 'with' => {'ruby-version' => '${{ matrix.ruby }}'},
79
+ }]
80
+
81
+ if (database_setup = type_definition[:database_setup])
82
+ steps << {
83
+ 'name' => 'Setup database',
84
+ 'run' => database_setup.join("\n") + "\n",
85
+ }
86
+ end
87
+
88
+ steps += [{
89
+ 'name' => 'Bundle',
90
+ 'run' => "gem install bundler:#{@bundler_version}\nbundle install --no-deployment\n",
91
+ }, {
92
+ 'name' => 'Run tests',
93
+ 'run' => 'bundle exec rspec',
94
+ }]
95
+
96
+ job = {}
97
+ job['runs-on'] = 'ubuntu-20.04'
98
+ if (services = type_definition[:services])
99
+ job['services'] = services
100
+ end
101
+ job['strategy'] = {
102
+ 'fail-fast' => false,
103
+ 'matrix' => matrix,
104
+ }
105
+ job['env'] = {
106
+ 'BUNDLE_GEMFILE' => '${{ matrix.gemfile }}',
107
+ }
108
+ job['steps'] = steps
109
+
110
+ job
111
+ end
112
+
113
+ def full_matrix(rows)
114
+ rubies = rows.map(&:ruby)
115
+ gemfiles = rows.map(&:gemfile)
116
+ if rubies.size * gemfiles.size == rows.size
117
+ {
118
+ 'ruby' => rubies,
119
+ 'gemfile' => gemfiles,
120
+ }
121
+ end
122
+ end
123
+
124
+ def include_matrix(rows)
125
+ {
126
+ 'include' => rows.map do |row|
127
+ {
128
+ 'ruby' => row.ruby,
129
+ 'gemfile' => row.gemfile,
130
+ }
131
+ end,
132
+ }
133
+ end
134
+
135
+ def full_config(jobs)
136
+ {
137
+ 'name' => 'Tests',
138
+ 'on' => {
139
+ 'push' => {
140
+ 'branches' => ['master'],
141
+ },
142
+ 'pull_request' => {
143
+ 'branches' => ['master'],
144
+ },
145
+ },
146
+ 'jobs' => jobs,
147
+ }
148
+ end
149
+ end
150
+ end