gemika 0.8.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +11 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.5.2.mysql2.lock +1 -1
- data/Gemfile.5.2.pg.lock +1 -1
- data/Gemfile.5.2.sqlite3.lock +1 -1
- data/Gemfile.6.1.pg +5 -0
- data/Gemfile.6.1.pg.lock +7 -1
- data/Gemfile.7.0.pg +4 -0
- data/Gemfile.7.0.pg.lock +5 -1
- data/Gemfile.8.0.pg +17 -0
- data/Gemfile.8.0.pg.lock +87 -0
- data/README.md +70 -209
- data/lib/gemika/database.rb +1 -5
- data/lib/gemika/env.rb +0 -7
- data/lib/gemika/matrix/github_actions_config.rb +2 -0
- data/lib/gemika/matrix.rb +11 -43
- data/lib/gemika/tasks.rb +0 -1
- data/lib/gemika/version.rb +1 -1
- data/spec/fixtures/github_actions_yml/gemfile_without_gemika.yml +1 -1
- data/spec/gemika/matrix_spec.rb +0 -79
- metadata +5 -17
- data/lib/gemika/github_actions_generator.rb +0 -150
- data/lib/gemika/matrix/travis_config.rb +0 -42
- data/lib/gemika/tasks/gemika.rb +0 -14
- data/spec/fixtures/migrate/expected_github_actions.yml +0 -129
- data/spec/fixtures/migrate/travis.yml +0 -66
- data/spec/fixtures/travis_yml/Gemfile_without_gemika +0 -1
- data/spec/fixtures/travis_yml/excludes.yml +0 -12
- data/spec/fixtures/travis_yml/gemfile_without_gemika.yml +0 -5
- data/spec/fixtures/travis_yml/includes.yml +0 -12
- data/spec/fixtures/travis_yml/missing_gemfile.yml +0 -5
- data/spec/fixtures/travis_yml/two_by_two.yml +0 -7
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemika
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-06-16 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: Helpers for testing Ruby gems
|
14
13
|
email: henning.koch@makandra.de
|
@@ -33,6 +32,8 @@ files:
|
|
33
32
|
- Gemfile.6.1.pg.lock
|
34
33
|
- Gemfile.7.0.pg
|
35
34
|
- Gemfile.7.0.pg.lock
|
35
|
+
- Gemfile.8.0.pg
|
36
|
+
- Gemfile.8.0.pg.lock
|
36
37
|
- LICENSE
|
37
38
|
- README.md
|
38
39
|
- Rakefile
|
@@ -43,13 +44,10 @@ files:
|
|
43
44
|
- lib/gemika/database.rb
|
44
45
|
- lib/gemika/env.rb
|
45
46
|
- lib/gemika/errors.rb
|
46
|
-
- lib/gemika/github_actions_generator.rb
|
47
47
|
- lib/gemika/matrix.rb
|
48
48
|
- lib/gemika/matrix/github_actions_config.rb
|
49
|
-
- lib/gemika/matrix/travis_config.rb
|
50
49
|
- lib/gemika/rspec.rb
|
51
50
|
- lib/gemika/tasks.rb
|
52
|
-
- lib/gemika/tasks/gemika.rb
|
53
51
|
- lib/gemika/tasks/matrix.rb
|
54
52
|
- lib/gemika/tasks/rspec.rb
|
55
53
|
- lib/gemika/version.rb
|
@@ -63,14 +61,6 @@ files:
|
|
63
61
|
- spec/fixtures/github_actions_yml/missing_gemfile.yml
|
64
62
|
- spec/fixtures/github_actions_yml/multiple_jobs.yml
|
65
63
|
- spec/fixtures/github_actions_yml/two_by_two.yml
|
66
|
-
- spec/fixtures/migrate/expected_github_actions.yml
|
67
|
-
- spec/fixtures/migrate/travis.yml
|
68
|
-
- spec/fixtures/travis_yml/Gemfile_without_gemika
|
69
|
-
- spec/fixtures/travis_yml/excludes.yml
|
70
|
-
- spec/fixtures/travis_yml/gemfile_without_gemika.yml
|
71
|
-
- spec/fixtures/travis_yml/includes.yml
|
72
|
-
- spec/fixtures/travis_yml/missing_gemfile.yml
|
73
|
-
- spec/fixtures/travis_yml/two_by_two.yml
|
74
64
|
- spec/gemika/database_spec.rb
|
75
65
|
- spec/gemika/env_spec.rb
|
76
66
|
- spec/gemika/matrix/row_spec.rb
|
@@ -89,7 +79,6 @@ metadata:
|
|
89
79
|
bug_tracker_uri: https://github.com/makandra/gemika/issues
|
90
80
|
changelog_uri: https://github.com/makandra/gemika/blob/master/CHANGELOG.md
|
91
81
|
rubygems_mfa_required: 'true'
|
92
|
-
post_install_message:
|
93
82
|
rdoc_options: []
|
94
83
|
require_paths:
|
95
84
|
- lib
|
@@ -104,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
93
|
- !ruby/object:Gem::Version
|
105
94
|
version: '0'
|
106
95
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
108
|
-
signing_key:
|
96
|
+
rubygems_version: 3.6.2
|
109
97
|
specification_version: 4
|
110
98
|
summary: Helpers for testing Ruby gems
|
111
99
|
test_files: []
|
@@ -1,150 +0,0 @@
|
|
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
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Gemika
|
2
|
-
class Matrix
|
3
|
-
|
4
|
-
##
|
5
|
-
# Load `.travis.yml` files.
|
6
|
-
#
|
7
|
-
# @!visibility private
|
8
|
-
#
|
9
|
-
class TravisConfig
|
10
|
-
class << self
|
11
|
-
|
12
|
-
def load_rows(options)
|
13
|
-
path = options.fetch(:path, '.travis.yml')
|
14
|
-
travis_yml = YAML.load_file(path)
|
15
|
-
rubies = travis_yml.fetch('rvm', [])
|
16
|
-
gemfiles = travis_yml.fetch('gemfile', [])
|
17
|
-
matrix_options = travis_yml.fetch('matrix', {})
|
18
|
-
includes = matrix_options.fetch('include', [])
|
19
|
-
excludes = matrix_options.fetch('exclude', [])
|
20
|
-
|
21
|
-
rows = []
|
22
|
-
rubies.each do |ruby|
|
23
|
-
gemfiles.each do |gemfile|
|
24
|
-
row = { 'rvm' => ruby, 'gemfile' => gemfile }
|
25
|
-
rows << row unless excludes.include?(row)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
rows = rows + includes
|
30
|
-
rows = rows.map { |row| convert_row(row) }
|
31
|
-
rows
|
32
|
-
end
|
33
|
-
|
34
|
-
def convert_row(travis_row)
|
35
|
-
Row.new(:ruby => travis_row['rvm'], :gemfile => travis_row['gemfile'])
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
data/lib/gemika/tasks/gemika.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'gemika/env'
|
2
|
-
require 'gemika/matrix'
|
3
|
-
|
4
|
-
##
|
5
|
-
# Rake tasks to run commands for each compatible row in the test matrix.
|
6
|
-
#
|
7
|
-
namespace :gemika do
|
8
|
-
|
9
|
-
desc "Generate a github action workflow from a .travis.yml"
|
10
|
-
task :generate_github_actions_workflow do
|
11
|
-
puts Gemika::Matrix.generate_github_actions_workflow.to_yaml
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
name: Tests
|
2
|
-
'on':
|
3
|
-
push:
|
4
|
-
branches:
|
5
|
-
- master
|
6
|
-
pull_request:
|
7
|
-
branches:
|
8
|
-
- master
|
9
|
-
jobs:
|
10
|
-
test_mysql:
|
11
|
-
runs-on: ubuntu-20.04
|
12
|
-
services:
|
13
|
-
mysql:
|
14
|
-
image: mysql:5.6
|
15
|
-
env:
|
16
|
-
MYSQL_ROOT_PASSWORD: password
|
17
|
-
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout
|
18
|
-
5s --health-retries 5
|
19
|
-
ports:
|
20
|
-
- 3306:3306
|
21
|
-
strategy:
|
22
|
-
fail-fast: false
|
23
|
-
matrix:
|
24
|
-
include:
|
25
|
-
- ruby: 1.8.7
|
26
|
-
gemfile: Gemfile.2.3.mysql2
|
27
|
-
- ruby: 1.8.7
|
28
|
-
gemfile: Gemfile.3.2.mysql2
|
29
|
-
- ruby: 2.1.8
|
30
|
-
gemfile: Gemfile.3.2.mysql2
|
31
|
-
- ruby: 2.2.4
|
32
|
-
gemfile: Gemfile.3.2.mysql2
|
33
|
-
- ruby: 2.1.8
|
34
|
-
gemfile: Gemfile.4.2.mysql2
|
35
|
-
- ruby: 2.2.4
|
36
|
-
gemfile: Gemfile.4.2.mysql2
|
37
|
-
- ruby: 2.3.1
|
38
|
-
gemfile: Gemfile.4.2.mysql2
|
39
|
-
- ruby: 2.2.4
|
40
|
-
gemfile: Gemfile.5.2.mysql2
|
41
|
-
- ruby: 2.3.1
|
42
|
-
gemfile: Gemfile.5.2.mysql2
|
43
|
-
env:
|
44
|
-
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
45
|
-
steps:
|
46
|
-
- uses: actions/checkout@v2
|
47
|
-
- name: Install ruby
|
48
|
-
uses: ruby/setup-ruby@v1
|
49
|
-
with:
|
50
|
-
ruby-version: "${{ matrix.ruby }}"
|
51
|
-
- name: Setup database
|
52
|
-
run: |
|
53
|
-
sudo apt-get install -y mysql-client libmariadbclient-dev
|
54
|
-
mysql -e 'create database IF NOT EXISTS test;' -u root --password=password -P 3306 -h 127.0.0.1
|
55
|
-
- name: Bundle
|
56
|
-
run: |
|
57
|
-
gem install bundler:2.3.1
|
58
|
-
bundle install --no-deployment
|
59
|
-
- name: Run tests
|
60
|
-
run: bundle exec rspec
|
61
|
-
test_pg:
|
62
|
-
runs-on: ubuntu-20.04
|
63
|
-
services:
|
64
|
-
postgres:
|
65
|
-
image: postgres
|
66
|
-
env:
|
67
|
-
POSTGRES_PASSWORD: postgres
|
68
|
-
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
69
|
-
--health-retries 5"
|
70
|
-
ports:
|
71
|
-
- 5432:5432
|
72
|
-
strategy:
|
73
|
-
fail-fast: false
|
74
|
-
matrix:
|
75
|
-
include:
|
76
|
-
- ruby: 2.1.8
|
77
|
-
gemfile: Gemfile.4.2.pg
|
78
|
-
- ruby: 2.2.4
|
79
|
-
gemfile: Gemfile.4.2.pg
|
80
|
-
- ruby: 2.3.1
|
81
|
-
gemfile: Gemfile.4.2.pg
|
82
|
-
- ruby: 2.2.4
|
83
|
-
gemfile: Gemfile.5.2.pg
|
84
|
-
- ruby: 2.3.1
|
85
|
-
gemfile: Gemfile.5.2.pg
|
86
|
-
- ruby: 2.6.4
|
87
|
-
gemfile: Gemfile.6.1.pg
|
88
|
-
env:
|
89
|
-
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
90
|
-
steps:
|
91
|
-
- uses: actions/checkout@v2
|
92
|
-
- name: Install ruby
|
93
|
-
uses: ruby/setup-ruby@v1
|
94
|
-
with:
|
95
|
-
ruby-version: "${{ matrix.ruby }}"
|
96
|
-
- name: Setup database
|
97
|
-
run: |
|
98
|
-
sudo apt-get install -y postgresql-client
|
99
|
-
PGPASSWORD=postgres psql -c 'create database test;' -U postgres -p 5432 -h localhost
|
100
|
-
- name: Bundle
|
101
|
-
run: |
|
102
|
-
gem install bundler:2.3.1
|
103
|
-
bundle install --no-deployment
|
104
|
-
- name: Run tests
|
105
|
-
run: bundle exec rspec
|
106
|
-
test_sqlite:
|
107
|
-
runs-on: ubuntu-20.04
|
108
|
-
strategy:
|
109
|
-
fail-fast: false
|
110
|
-
matrix:
|
111
|
-
include:
|
112
|
-
- ruby: 2.2.4
|
113
|
-
gemfile: Gemfile.5.2.sqlite3
|
114
|
-
- ruby: 2.3.1
|
115
|
-
gemfile: Gemfile.5.2.sqlite3
|
116
|
-
env:
|
117
|
-
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
118
|
-
steps:
|
119
|
-
- uses: actions/checkout@v2
|
120
|
-
- name: Install ruby
|
121
|
-
uses: ruby/setup-ruby@v1
|
122
|
-
with:
|
123
|
-
ruby-version: "${{ matrix.ruby }}"
|
124
|
-
- name: Bundle
|
125
|
-
run: |
|
126
|
-
gem install bundler:2.3.1
|
127
|
-
bundle install --no-deployment
|
128
|
-
- name: Run tests
|
129
|
-
run: bundle exec rspec
|
@@ -1,66 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
dist: trusty
|
4
|
-
|
5
|
-
services:
|
6
|
-
- postgresql
|
7
|
-
|
8
|
-
matrix:
|
9
|
-
include:
|
10
|
-
# Rails 2.3
|
11
|
-
- gemfile: Gemfile.2.3.mysql2
|
12
|
-
rvm: 1.8.7
|
13
|
-
# Rails 3.2
|
14
|
-
- gemfile: Gemfile.3.2.mysql2
|
15
|
-
rvm: 1.8.7
|
16
|
-
- gemfile: Gemfile.3.2.mysql2
|
17
|
-
rvm: 2.1.8
|
18
|
-
- gemfile: Gemfile.3.2.mysql2
|
19
|
-
rvm: 2.2.4
|
20
|
-
# Rails 4.2
|
21
|
-
- gemfile: Gemfile.4.2.mysql2
|
22
|
-
rvm: 2.1.8
|
23
|
-
- gemfile: Gemfile.4.2.pg
|
24
|
-
rvm: 2.1.8
|
25
|
-
- gemfile: Gemfile.4.2.mysql2
|
26
|
-
rvm: 2.2.4
|
27
|
-
- gemfile: Gemfile.4.2.pg
|
28
|
-
rvm: 2.2.4
|
29
|
-
- gemfile: Gemfile.4.2.mysql2
|
30
|
-
rvm: 2.3.1
|
31
|
-
- gemfile: Gemfile.4.2.pg
|
32
|
-
rvm: 2.3.1
|
33
|
-
# Rails 5.2
|
34
|
-
- gemfile: Gemfile.5.2.mysql2
|
35
|
-
rvm: 2.2.4
|
36
|
-
- gemfile: Gemfile.5.2.pg
|
37
|
-
rvm: 2.2.4
|
38
|
-
- gemfile: Gemfile.5.2.sqlite3
|
39
|
-
rvm: 2.2.4
|
40
|
-
- gemfile: Gemfile.5.2.mysql2
|
41
|
-
rvm: 2.3.1
|
42
|
-
- gemfile: Gemfile.5.2.pg
|
43
|
-
rvm: 2.3.1
|
44
|
-
- gemfile: Gemfile.5.2.sqlite3
|
45
|
-
rvm: 2.3.1
|
46
|
-
# Rails 6.0
|
47
|
-
- gemfile: Gemfile.6.1.pg
|
48
|
-
rvm: 2.6.4
|
49
|
-
|
50
|
-
install:
|
51
|
-
# Replace default Travis CI bundler script with a version that doesn't
|
52
|
-
# explode when lockfile doesn't match recently bumped version
|
53
|
-
- bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
54
|
-
|
55
|
-
before_script:
|
56
|
-
- psql -c 'create database gemika_test;' -U postgres
|
57
|
-
- mysql -e 'create database IF NOT EXISTS gemika_test;'
|
58
|
-
|
59
|
-
script: bundle exec rake current_rspec
|
60
|
-
|
61
|
-
sudo: false
|
62
|
-
|
63
|
-
cache: bundler
|
64
|
-
|
65
|
-
addons:
|
66
|
-
postgresql: 9.3
|
@@ -1 +0,0 @@
|
|
1
|
-
gem 'some-gem'
|