gemika 0.8.4 → 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 +3 -3
- data/CHANGELOG.md +7 -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.lock +1 -1
- data/Gemfile.7.0.pg.lock +1 -1
- data/Gemfile.8.0.pg.lock +1 -1
- data/README.md +68 -207
- 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 +2 -13
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796d4227872727c02bb7cc579adb88df195c79783c4b555831961b0c96f08fe6
|
4
|
+
data.tar.gz: cb3383d4bcc140c61c3f20f5a8b070a4ceff1dd054ee5d887601c15b452ff929
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb8f85eba5082ff1af1ca69a0b3be683fc7a89e364e16d4519f9fa7a72cf3b3f25a7d847d00cd3a19c0ebb4ca41e351a76932fa2195ed9ed6dd40dadc92b58eb
|
7
|
+
data.tar.gz: 1bcf62e10e96457a57f70507ac5092017e96d753aa4cb3d4b3ff24977ae19bc74737fddf84e9d4cf40919767f481c7c247944dc77b4a2a7bac8fb5b80ff495e9
|
data/.github/workflows/test.yml
CHANGED
@@ -9,7 +9,7 @@ on:
|
|
9
9
|
- master
|
10
10
|
jobs:
|
11
11
|
test_mysql:
|
12
|
-
runs-on: ubuntu-
|
12
|
+
runs-on: ubuntu-24.04
|
13
13
|
services:
|
14
14
|
mysql:
|
15
15
|
image: mysql:5.6
|
@@ -43,7 +43,7 @@ jobs:
|
|
43
43
|
- name: Run tests
|
44
44
|
run: bundle exec rspec
|
45
45
|
test_pg:
|
46
|
-
runs-on: ubuntu-
|
46
|
+
runs-on: ubuntu-24.04
|
47
47
|
services:
|
48
48
|
postgres:
|
49
49
|
image: postgres
|
@@ -97,7 +97,7 @@ jobs:
|
|
97
97
|
- name: Run tests
|
98
98
|
run: bundle exec rspec
|
99
99
|
test_sqlite:
|
100
|
-
runs-on: ubuntu-
|
100
|
+
runs-on: ubuntu-24.04
|
101
101
|
strategy:
|
102
102
|
fail-fast: false
|
103
103
|
matrix:
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
13
13
|
|
14
14
|
-
|
15
15
|
|
16
|
+
## 1.0.0 - 2025-06-16
|
17
|
+
|
18
|
+
### Breaking changes
|
19
|
+
|
20
|
+
- Removed support for Travis CI
|
21
|
+
- Removed migration from travis to github actions
|
22
|
+
|
16
23
|
## 0.8.4 - 2025-01-16
|
17
24
|
|
18
25
|
- Add support for Ruby 3.4
|
data/Gemfile.5.2.mysql2.lock
CHANGED
data/Gemfile.5.2.pg.lock
CHANGED
data/Gemfile.5.2.sqlite3.lock
CHANGED
data/Gemfile.6.1.pg.lock
CHANGED
data/Gemfile.7.0.pg.lock
CHANGED
data/Gemfile.8.0.pg.lock
CHANGED
data/README.md
CHANGED
@@ -16,9 +16,8 @@ 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
|
20
|
-
- Share your Ruby / gem dependeny / database permutation between local development and
|
21
|
-
- Migrate your Travis CI config to a Github Actions config.
|
19
|
+
- Help configure a Github Actions build that tests every dependency permutation after each `git push`.
|
20
|
+
- Share your Ruby / gem dependeny / database permutation between local development and Github Actions.
|
22
21
|
- Define an [ActiveRecord database migration](http://api.rubyonrails.org/classes/ActiveRecord/Migration.html) that sets up your test database.
|
23
22
|
- Automatically drop and re-create your test database before each run of your test suite.
|
24
23
|
- Work around breaking changes in RSpec, Ruby and other gems
|
@@ -52,9 +51,9 @@ Gemfile.set3 # Third dependency set. Should inclu
|
|
52
51
|
Gemfile.set3.lock # Generated by `rake matrix:install`
|
53
52
|
Gemfile -> Gemfile.set2 # Symlink to default Gemfile for development
|
54
53
|
Gemfile.lock -> Gemfile.set2.lock # Symlink to default Gemfile.lock for development
|
54
|
+
.github/workflows/test.yml # Configures all tested Ruby / gemfile combinations, for both local development and Github Actions
|
55
55
|
.ruby-version # Default Ruby version for development
|
56
56
|
.gitignore # Should ignore spec/support/database.yml
|
57
|
-
.travis.yml # Configures all tested Ruby / gemfile combinations, for both local development and Travis CI
|
58
57
|
my_gem.gemspec # Specification for your gem
|
59
58
|
Rakefile # Should require 'gemika/tasks'
|
60
59
|
README.md # README for your gem
|
@@ -65,8 +64,7 @@ spec/spec_helper.rb # Requires 'gemika' and all files in
|
|
65
64
|
spec/support/database.rb # Database schema for test database
|
66
65
|
spec/support/database.yml # Database credentials for local development (not checked in)
|
67
66
|
spec/support/database.sample.yml # Sample database credentials for new developers
|
68
|
-
spec/support/database.
|
69
|
-
spec/support/database.github.yml # Alternatively: Database credentials for Github Actions
|
67
|
+
spec/support/database.github.yml # Database credentials for Github Actions
|
70
68
|
spec/my_gem/my_class_spec.rb # Tests for your gem
|
71
69
|
```
|
72
70
|
|
@@ -87,24 +85,21 @@ lib/my_gem.rb # Main file to require for your gem
|
|
87
85
|
spec/my_gem_spec.rb # Tests for your gem
|
88
86
|
```
|
89
87
|
|
90
|
-
If you don't have a directory yet, you can [ask Bundler to create it for you](http://bundler.io/rubygems.html):
|
88
|
+
If you don't have a directory yet, you can [ask Bundler to create it for you](http://bundler.io/guides/rubygems.html):
|
91
89
|
|
92
90
|
```
|
93
91
|
bundle gem my_gem
|
94
92
|
```
|
95
93
|
|
96
|
-
This will create a new directory named `my_gem` with your new gem skeleton.
|
97
|
-
|
98
|
-
|
99
94
|
### Install Gemika
|
100
95
|
|
101
|
-
Switch to your favorite Ruby version
|
96
|
+
Switch to your favorite Ruby version, then install Gemika:
|
102
97
|
|
103
98
|
```shell
|
104
99
|
gem install gemika
|
105
100
|
```
|
106
101
|
|
107
|
-
Future contributors to your gem can install Gemika using the Gemfiles we will create
|
102
|
+
Future contributors to your gem can install Gemika using the Gemfiles we will create next.
|
108
103
|
|
109
104
|
|
110
105
|
### Rake tasks
|
@@ -137,23 +132,22 @@ task :default => 'matrix:spec'
|
|
137
132
|
|
138
133
|
### Define multiple dependency sets
|
139
134
|
|
140
|
-
|
141
|
-
Your gemfiles should be placed directly in your project's root directory.
|
135
|
+
For each combination of runtime and development dependencies (e.g. Rails + database), create a corresponding `Gemfile` in your project root.
|
142
136
|
|
143
|
-
|
137
|
+
Each `Gemfile` should include:
|
144
138
|
|
145
139
|
1. The runtime dependencies you'd like to test against (e.g. Rails 5)
|
146
140
|
2. The development dependencies for that set (e.g. `rspec`) in a version that is compatible with these runtime dependencies.
|
147
141
|
3. The `gemika` gem
|
148
|
-
4. Your
|
142
|
+
4. Your gem under test, from path `.`
|
149
143
|
|
150
|
-
For instance, if one dependency set is Rails
|
144
|
+
For instance, if one dependency set is Rails 4.2 with a MySQL database, we would create `./Gemfile.4.2.mysql2` with these contents:
|
151
145
|
|
152
146
|
```ruby
|
153
147
|
source 'https://rubygems.org'
|
154
148
|
|
155
149
|
# Runtime dependencies
|
156
|
-
gem 'rails', '~>
|
150
|
+
gem 'rails', '~>4.2.11'
|
157
151
|
gem 'mysql2', '= 0.4.10'
|
158
152
|
|
159
153
|
# Development dependencies
|
@@ -166,103 +160,77 @@ gem 'gemika'
|
|
166
160
|
gem 'my_gem', :path => '.'
|
167
161
|
```
|
168
162
|
|
169
|
-
|
170
|
-
|
171
|
-
```ruby
|
172
|
-
source 'https://rubygems.org'
|
173
|
-
|
174
|
-
# Runtime dependencies
|
175
|
-
gem 'rails', '~>5.0.0'
|
176
|
-
gem 'pg', '~>0.18.4'
|
177
|
-
|
178
|
-
# Development dependencies
|
179
|
-
gem 'rspec', '~>3.5'
|
180
|
-
gem 'rake'
|
181
|
-
gem 'byebug'
|
182
|
-
gem 'gemika'
|
183
|
-
|
184
|
-
# Gem under test
|
185
|
-
gem 'my_gem', :path => '.'
|
186
|
-
```
|
187
|
-
|
188
|
-
In this example, your project directory should now also contain:
|
189
|
-
|
190
|
-
```
|
191
|
-
Gemfile.4.2.mysql2
|
192
|
-
Gemfile.5.0.pg
|
193
|
-
```
|
194
|
-
|
163
|
+
Repeat for other combinations (e.g. Rails 5.0 + PostgreSQL)
|
195
164
|
|
196
|
-
### Define combinations of gemfiles and Ruby versions
|
197
165
|
|
198
|
-
|
166
|
+
### Define Ruby/Gemfile Test Matrix
|
199
167
|
|
200
|
-
|
168
|
+
Configure the test matrix in `.github/workflows/test.yml`, **even if you're not currently running tests on Github Actions**.
|
201
169
|
|
202
|
-
|
170
|
+
Use [GitHub's matrix strategy:](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow)
|
203
171
|
|
204
172
|
```yaml
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
```
|
229
|
-
|
230
|
-
|
231
|
-
- gemfile: Gemfile.5.0.mysql2
|
232
|
-
rvm: 2.1.8
|
233
|
-
- gemfile: Gemfile.5.0.pg
|
234
|
-
rvm: 2.1.8
|
235
|
-
```
|
236
|
-
|
237
|
-
For `.github/workflows/test.yml`, it looks similar:
|
173
|
+
jobs:
|
174
|
+
my_job:
|
175
|
+
strategy:
|
176
|
+
matrix:
|
177
|
+
ruby:
|
178
|
+
- 2.1.8
|
179
|
+
- 2.2.4
|
180
|
+
- 2.3.1
|
181
|
+
gemfile:
|
182
|
+
- Gemfile.3.2.mysql2
|
183
|
+
- Gemfile.4.2.mysql2
|
184
|
+
- Gemfile.4.2.pg
|
185
|
+
- Gemfile.5.0.mysql2
|
186
|
+
- Gemfile.5.0.pg
|
187
|
+
env:
|
188
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
189
|
+
steps:
|
190
|
+
- uses: actions/checkout@v4
|
191
|
+
- name: Install ruby
|
192
|
+
uses: ruby/setup-ruby@v1
|
193
|
+
with:
|
194
|
+
ruby-version: "${{ matrix.ruby }}"
|
195
|
+
- ...
|
196
|
+
```
|
197
|
+
|
198
|
+
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 `exclude` key to your matrix in `.github/workflows/test.yml`
|
238
199
|
|
239
200
|
```yaml
|
240
201
|
jobs:
|
241
202
|
my_job:
|
242
203
|
strategy:
|
243
204
|
matrix:
|
205
|
+
ruby:
|
206
|
+
- 2.1.8
|
207
|
+
- 2.3.1
|
208
|
+
gemfile:
|
209
|
+
- Gemfile.4.2.mysql2
|
210
|
+
- Gemfile.4.2.pg
|
211
|
+
- Gemfile.5.0.mysql2
|
212
|
+
- Gemfile.5.0.pg
|
244
213
|
exclude:
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
214
|
+
- gemfile: Gemfile.5.0.mysql2
|
215
|
+
ruby: 2.1.8
|
216
|
+
- gemfile: Gemfile.5.0.pg
|
217
|
+
ruby: 2.1.8
|
249
218
|
```
|
250
219
|
|
251
|
-
|
252
|
-
Alternatively, you can instead explicitly list all Ruby / Gemfile combinations with
|
220
|
+
Alternatively, you can explicitly list all Ruby / Gemfile combinations with
|
253
221
|
|
254
222
|
```
|
255
223
|
matrix:
|
256
224
|
include:
|
257
225
|
- gemfile: Gemfile.5.0.mysql2
|
258
|
-
|
226
|
+
ruby: 2.3.8
|
259
227
|
- gemfile: Gemfile.5.2.mysql2
|
260
|
-
|
228
|
+
ruby: 2.3.8
|
261
229
|
```
|
262
230
|
|
263
231
|
### Generate lockfiles
|
264
232
|
|
265
|
-
Generate lockfiles for each
|
233
|
+
Generate lockfiles for each Gemfile:
|
266
234
|
|
267
235
|
```shell
|
268
236
|
rake matrix:install
|
@@ -301,14 +269,11 @@ ln -s Gemfile.4.2.mysql2.lock Gemfile.lock
|
|
301
269
|
|
302
270
|
Commit both `.ruby-version` and symlinks to your repo.
|
303
271
|
|
304
|
-
|
305
|
-
|
272
|
+
### Configure Test databases
|
306
273
|
|
307
|
-
|
274
|
+
Create a local test database (e.g. `my_gem_test`) for MySQL/PostgreSQL/etc.
|
308
275
|
|
309
|
-
|
310
|
-
|
311
|
-
Now create a file `spec/support/database.yml` that contains your local database credentials:
|
276
|
+
Then add credentials to `spec/support/database.yml`:
|
312
277
|
|
313
278
|
```yaml
|
314
279
|
mysql:
|
@@ -438,25 +403,6 @@ Gemika::RSpec.configure_clean_database_before_example
|
|
438
403
|
Note that you also need `require 'gemika'` in your `spec_helper.rb`.
|
439
404
|
|
440
405
|
|
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
|
-
|
460
406
|
### Try it out
|
461
407
|
|
462
408
|
Check if you can install development dependencies for each row in the test matrix:
|
@@ -502,97 +448,12 @@ BUNDLE_GEMFILE=Gemfile.2.3 bundle exec rake matrix:install
|
|
502
448
|
BUNDLE_GEMFILE=Gemfile.2.3 bundle exec rake matrix:spec
|
503
449
|
```
|
504
450
|
|
505
|
-
We recommend to setup
|
506
|
-
|
507
|
-
|
508
|
-
## Activate Travis CI
|
509
|
-
|
510
|
-
We recommend to setup Travis CI to check the entire test matrix after each push. Travis CI will also show the build results on Github's pull request page, helping maintainers decide whether a PR is safe to merge.
|
511
|
-
|
512
|
-
If you plan to use Travis CI, also add a `spec/support/database.travis.yml` with [Travis' default database credentials](https://docs.travis-ci.com/user/database-setup/):
|
513
|
-
|
514
|
-
```yaml
|
515
|
-
mysql:
|
516
|
-
database: my_gem_test
|
517
|
-
username: travis
|
518
|
-
password:
|
519
|
-
|
520
|
-
postgresql:
|
521
|
-
database: my_gem_test
|
522
|
-
user: postgres
|
523
|
-
password:
|
524
|
-
```
|
525
|
-
|
526
|
-
Add options to `.travis.yml` to create databases before running tests:
|
527
|
-
|
528
|
-
```yaml
|
529
|
-
before_script:
|
530
|
-
- psql -c 'create database mygem_test;' -U postgres
|
531
|
-
- mysql -e 'create database IF NOT EXISTS mygem_test;'
|
532
|
-
```
|
533
|
-
|
534
|
-
Also add the other `.travis.yml` settings required for a Ruby project:
|
535
|
-
|
536
|
-
```yaml
|
537
|
-
language: ruby
|
538
|
-
|
539
|
-
sudo: false
|
540
|
-
|
541
|
-
cache: bundler
|
542
|
-
|
543
|
-
notifications:
|
544
|
-
email:
|
545
|
-
- notifications@test.com
|
546
|
-
|
547
|
-
install:
|
548
|
-
# Replace default Travis CI bundler script with a version that doesn't
|
549
|
-
# explode when lockfile doesn't match recently bumped version
|
550
|
-
- bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
551
|
-
|
552
|
-
script: bundle exec rake current_rspec
|
553
|
-
```
|
554
|
-
|
555
|
-
Adjust the `script` option if you're not using RSpec to test your code.
|
556
|
-
|
557
|
-
|
558
|
-
#### Activate Github integration
|
559
|
-
|
560
|
-
To activate Travis CI for your Github repo:
|
561
|
-
|
562
|
-
- Log into Github
|
563
|
-
- Open your gem's project page
|
564
|
-
- Open *Settings*
|
565
|
-
- Navigate to *Integrations & services*
|
566
|
-
- Open the *Add service* dropdown
|
567
|
-
- Select *Travis CI*
|
568
|
-
- Authenticate via OAuth
|
569
|
-
|
570
|
-
To check if the integration has worked, push a change and check if you can see your build matrix on the [Travis CI dashboard](https://travis-ci.org/).
|
571
|
-
|
572
|
-
#### Build badge
|
573
|
-
|
574
|
-
You might want to a build status badge to your `README.md` like this:
|
575
|
-
|
576
|
-
[](https://travis-ci.org/makandra/gemika)
|
577
|
-
|
578
|
-
You can add such a badge using this markdown:
|
579
|
-
|
580
|
-
```markdown
|
581
|
-
[](https://travis-ci.org/my_org/my_gem)
|
582
|
-
```
|
451
|
+
We recommend to setup Github Actions 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 the pipeline checks make sure that nothing broken gets merged.
|
583
452
|
|
584
|
-
#### Protect the `master` branch
|
585
453
|
|
586
|
-
|
454
|
+
## Activate Github Actions
|
587
455
|
|
588
|
-
|
589
|
-
- Navigate to *Branches*
|
590
|
-
- Below *Protected branches*, open the *Choose a branch...* dropdown
|
591
|
-
- Select `master`
|
592
|
-
- Check *Protect this branch*
|
593
|
-
- Check *Require status checks to pass before merging*
|
594
|
-
- Check the status check `continuous-integration/travis-ci`
|
595
|
-
- Press *Save changes*
|
456
|
+
We recommend to setup Github Actions to check the entire test matrix after each push. This will also show the test results on a pull request's page, helping maintainers decide whether a PR is safe to merge.
|
596
457
|
|
597
458
|
|
598
459
|
## Add development instructions to your README
|
@@ -610,12 +471,12 @@ There are tests in `spec`. We only accept PRs with tests. To run tests:
|
|
610
471
|
- Install development dependencies using `bundle install`
|
611
472
|
- Run tests using `bundle exec rspec`
|
612
473
|
|
613
|
-
We recommend to test large changes against multiple versions of Ruby and multiple dependency sets. Supported combinations are configured in `.
|
474
|
+
We recommend to test large changes against multiple versions of Ruby and multiple dependency sets. Supported combinations are configured in `.github/workflows/test.yml`. We provide some rake tasks to help with this:
|
614
475
|
|
615
476
|
- Install development dependencies using `bundle matrix:install`
|
616
477
|
- Run tests using `bundle matrix:spec`
|
617
478
|
|
618
|
-
Note that we have configured
|
479
|
+
Note that we have configured Github Actions to automatically run tests in all supported Ruby versions and dependency sets after each push. We will only merge pull requests after a green build.
|
619
480
|
```
|
620
481
|
|
621
482
|
Adjust the first part to match what you chose as your [default Ruby and default gemfile](#default-ruby-and-dependency-set).
|
@@ -651,10 +512,10 @@ Gemika::Env.ruby?('< 2')
|
|
651
512
|
Gemika::Env.ruby?('~> 2.1.0')
|
652
513
|
```
|
653
514
|
|
654
|
-
Check if the process is running as a
|
515
|
+
Check if the process is running as a Github Actions test
|
655
516
|
|
656
517
|
```ruby
|
657
|
-
Gemika::Env.
|
518
|
+
Gemika::Env.github?
|
658
519
|
```
|
659
520
|
|
660
521
|
### RSpec 1 vs. RSpec 2+
|
data/lib/gemika/database.rb
CHANGED
@@ -14,9 +14,7 @@ module Gemika
|
|
14
14
|
|
15
15
|
def initialize(options = {})
|
16
16
|
yaml_config_folder = options.fetch(:config_folder, 'spec/support')
|
17
|
-
yaml_config_filename = if Env.
|
18
|
-
'database.travis.yml'
|
19
|
-
elsif Env.github?
|
17
|
+
yaml_config_filename = if Env.github?
|
20
18
|
'database.github.yml'
|
21
19
|
else
|
22
20
|
'database.yml'
|
@@ -93,12 +91,10 @@ module Gemika
|
|
93
91
|
default_config['database'] = guess_database_name
|
94
92
|
if Env.gem?('pg')
|
95
93
|
default_config['adapter'] = 'postgresql'
|
96
|
-
default_config['username'] = 'postgres' if Env.travis?
|
97
94
|
default_config['password'] = ''
|
98
95
|
user_config = @yaml_config['postgresql'] || @yaml_config['postgres'] || @yaml_config['pg'] || {}
|
99
96
|
elsif Env.gem?('mysql2')
|
100
97
|
default_config['adapter'] = 'mysql2'
|
101
|
-
default_config['username'] = 'travis' if Env.travis?
|
102
98
|
default_config['encoding'] = 'utf8'
|
103
99
|
user_config = (@yaml_config['mysql'] || @yaml_config['mysql2']) || {}
|
104
100
|
elsif Env.gem?('sqlite3')
|
data/lib/gemika/env.rb
CHANGED
@@ -88,13 +88,6 @@ module Gemika
|
|
88
88
|
requirement_satisfied?(requirement, ruby)
|
89
89
|
end
|
90
90
|
|
91
|
-
##
|
92
|
-
# Returns whether this process is running within a TravisCI build.
|
93
|
-
#
|
94
|
-
def travis?
|
95
|
-
!!ENV['TRAVIS']
|
96
|
-
end
|
97
|
-
|
98
91
|
##
|
99
92
|
# Return whether this process is running within a Github Actions build.
|
100
93
|
def github?
|
@@ -11,6 +11,8 @@ module Gemika
|
|
11
11
|
|
12
12
|
def load_rows(options)
|
13
13
|
path = options.fetch(:path, '.github/workflows/test.yml')
|
14
|
+
raise MissingMatrixDefinition, "expected a #{path} file" unless File.exist?(path)
|
15
|
+
|
14
16
|
workflow_yml = YAML.load_file(path)
|
15
17
|
|
16
18
|
matrices = workflow_yml.fetch('jobs', {}).values.map do |job|
|
data/lib/gemika/matrix.rb
CHANGED
@@ -2,7 +2,6 @@ require 'open3'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'gemika/errors'
|
4
4
|
require 'gemika/env'
|
5
|
-
require 'gemika/matrix/travis_config'
|
6
5
|
require 'gemika/matrix/github_actions_config'
|
7
6
|
|
8
7
|
module Gemika
|
@@ -158,54 +157,23 @@ module Gemika
|
|
158
157
|
end
|
159
158
|
|
160
159
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
from_travis_yml(:path => travis_location)
|
172
|
-
elsif File.exist?(workflow_location)
|
173
|
-
from_github_actions_yml(:path => workflow_location)
|
174
|
-
else
|
175
|
-
raise MissingMatrixDefinition, "expected either a #{travis_location} or a #{workflow_location}"
|
160
|
+
class << self
|
161
|
+
##
|
162
|
+
# Builds a {Matrix} from the given Github Action workflow definition
|
163
|
+
#
|
164
|
+
# @param [Hash] options
|
165
|
+
# @option path [String] Path to the `.yml` file.
|
166
|
+
#
|
167
|
+
def from_github_actions_yml(options = {})
|
168
|
+
rows = GithubActionsConfig.load_rows(options)
|
169
|
+
new(options.merge(rows: rows))
|
176
170
|
end
|
177
|
-
end
|
178
|
-
|
179
|
-
##
|
180
|
-
# Builds a {Matrix} from the given `.travis.yml` file.
|
181
|
-
#
|
182
|
-
# @param [Hash] options
|
183
|
-
# @option options [String] Path to the `.travis.yml` file.
|
184
|
-
#
|
185
|
-
def self.from_travis_yml(options = {})
|
186
|
-
rows = TravisConfig.load_rows(options)
|
187
|
-
new(options.merge(:rows => rows))
|
188
|
-
end
|
189
171
|
|
190
|
-
|
191
|
-
# Builds a {Matrix} from the given Github Action workflow definition
|
192
|
-
#
|
193
|
-
# @param [Hash] options
|
194
|
-
# @option options [String] Path to the `.yml` file.
|
195
|
-
#
|
196
|
-
def self.from_github_actions_yml(options = {})
|
197
|
-
rows = GithubActionsConfig.load_rows(options)
|
198
|
-
new(options.merge(:rows => rows))
|
172
|
+
alias from_ci_config from_github_actions_yml
|
199
173
|
end
|
200
174
|
|
201
175
|
attr_reader :rows, :current_ruby
|
202
176
|
|
203
|
-
def self.generate_github_actions_workflow(options= {})
|
204
|
-
require 'gemika/github_actions_generator'
|
205
|
-
rows = TravisConfig.load_rows(options)
|
206
|
-
GithubActionsGenerator.new(bundler_version: Bundler::VERSION).generate(rows)
|
207
|
-
end
|
208
|
-
|
209
177
|
private
|
210
178
|
|
211
179
|
def puts(*args)
|
data/lib/gemika/tasks.rb
CHANGED
data/lib/gemika/version.rb
CHANGED
data/spec/gemika/matrix_spec.rb
CHANGED
@@ -103,62 +103,6 @@ EOF
|
|
103
103
|
|
104
104
|
end
|
105
105
|
|
106
|
-
describe '.from_travis_yml' do
|
107
|
-
|
108
|
-
it 'builds a matrix by combining Ruby versions and gemfiles from a Travis CI configuration file' do
|
109
|
-
path = 'spec/fixtures/travis_yml/two_by_two.yml'
|
110
|
-
matrix = Gemika::Matrix.from_travis_yml(:path => path, :validate => false)
|
111
|
-
matrix.rows.size.should == 4
|
112
|
-
matrix.rows[0].ruby.should == '2.1.8'
|
113
|
-
matrix.rows[0].gemfile.should == 'gemfiles/Gemfile1'
|
114
|
-
matrix.rows[1].ruby.should == '2.1.8'
|
115
|
-
matrix.rows[1].gemfile.should == 'gemfiles/Gemfile2'
|
116
|
-
matrix.rows[2].ruby.should == '2.3.1'
|
117
|
-
matrix.rows[2].gemfile.should == 'gemfiles/Gemfile1'
|
118
|
-
matrix.rows[3].ruby.should == '2.3.1'
|
119
|
-
matrix.rows[3].gemfile.should == 'gemfiles/Gemfile2'
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'allows to exclude rows from the matrix' do
|
123
|
-
path = 'spec/fixtures/travis_yml/excludes.yml'
|
124
|
-
matrix = Gemika::Matrix.from_travis_yml(:path => path, :validate => false)
|
125
|
-
matrix.rows.size.should == 3
|
126
|
-
matrix.rows[0].ruby.should == '2.1.8'
|
127
|
-
matrix.rows[0].gemfile.should == 'gemfiles/Gemfile2'
|
128
|
-
matrix.rows[1].ruby.should == '2.3.1'
|
129
|
-
matrix.rows[1].gemfile.should == 'gemfiles/Gemfile1'
|
130
|
-
matrix.rows[2].ruby.should == '2.3.1'
|
131
|
-
matrix.rows[2].gemfile.should == 'gemfiles/Gemfile2'
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'allows to include rows to the matrix' do
|
135
|
-
path = 'spec/fixtures/travis_yml/includes.yml'
|
136
|
-
matrix = Gemika::Matrix.from_travis_yml(:path => path, :validate => false)
|
137
|
-
matrix.rows.size.should == 5
|
138
|
-
matrix.rows[0].ruby.should == '2.1.8'
|
139
|
-
matrix.rows[0].gemfile.should == 'gemfiles/Gemfile1'
|
140
|
-
matrix.rows[1].ruby.should == '2.1.8'
|
141
|
-
matrix.rows[1].gemfile.should == 'gemfiles/Gemfile2'
|
142
|
-
matrix.rows[2].ruby.should == '2.3.1'
|
143
|
-
matrix.rows[2].gemfile.should == 'gemfiles/Gemfile1'
|
144
|
-
matrix.rows[3].ruby.should == '2.3.1'
|
145
|
-
matrix.rows[3].gemfile.should == 'gemfiles/Gemfile2'
|
146
|
-
matrix.rows[4].ruby.should == '2.6.3'
|
147
|
-
matrix.rows[4].gemfile.should == 'gemfiles/Gemfile3'
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'raises an error if a Gemfile does not exist' do
|
151
|
-
path = 'spec/fixtures/travis_yml/missing_gemfile.yml'
|
152
|
-
expect { Gemika::Matrix.from_travis_yml(:path => path) }.to raise_error(Gemika::MissingGemfile, /gemfile not found/i)
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'raises an error if a Gemfile does not depend on "gemika"' do
|
156
|
-
path = 'spec/fixtures/travis_yml/gemfile_without_gemika.yml'
|
157
|
-
expect { Gemika::Matrix.from_travis_yml(:path => path) }.to raise_error(Gemika::UnusableGemfile, /missing gemika dependency/i)
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
106
|
describe '.from_github_actions_yml' do
|
163
107
|
|
164
108
|
it 'builds a matrix by combining Ruby versions and gemfiles from a Github Actions workflow configuration file' do
|
@@ -230,33 +174,10 @@ EOF
|
|
230
174
|
expect { Gemika::Matrix.from_github_actions_yml(:path => path) }.to raise_error(Gemika::UnusableGemfile, /missing gemika dependency/i)
|
231
175
|
end
|
232
176
|
|
233
|
-
end
|
234
|
-
|
235
|
-
describe '.from_ci_config' do
|
236
|
-
it 'parses the .travis.yml if it exists' do
|
237
|
-
File.should_receive(:exist?).with('.travis.yml').and_return(true)
|
238
|
-
Gemika::Matrix.should_receive(:from_travis_yml).and_return('travis matrix')
|
239
|
-
Gemika::Matrix.from_ci_config.should == 'travis matrix'
|
240
|
-
end
|
241
|
-
|
242
|
-
it 'parses the .github/workflows/test.yml if it exists' do
|
243
|
-
File.should_receive(:exist?).with('.travis.yml').and_return(false)
|
244
|
-
File.should_receive(:exist?).with('.github/workflows/test.yml').and_return(true)
|
245
|
-
Gemika::Matrix.should_receive(:from_github_actions_yml).and_return('github matrix')
|
246
|
-
Gemika::Matrix.from_ci_config.should == 'github matrix'
|
247
|
-
end
|
248
|
-
|
249
177
|
it 'raises an error if no ci definition exists' do
|
250
|
-
File.should_receive(:exist?).with('.travis.yml').and_return(false)
|
251
178
|
File.should_receive(:exist?).with('.github/workflows/test.yml').and_return(false)
|
252
179
|
expect { Gemika::Matrix.from_ci_config }.to raise_error(Gemika::MissingMatrixDefinition)
|
253
180
|
end
|
254
181
|
end
|
255
182
|
|
256
|
-
describe '.generate_github_actions_workflow' do
|
257
|
-
github_actions_workflow = Gemika::Matrix.generate_github_actions_workflow(path: 'spec/fixtures/migrate/travis.yml')
|
258
|
-
expected_github_actions_workflow = YAML.load_file('spec/fixtures/migrate/expected_github_actions.yml')
|
259
|
-
github_actions_workflow.should == expected_github_actions_workflow
|
260
|
-
end
|
261
|
-
|
262
183
|
end
|
metadata
CHANGED
@@ -1,13 +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
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-06-16 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Helpers for testing Ruby gems
|
13
13
|
email: henning.koch@makandra.de
|
@@ -44,13 +44,10 @@ files:
|
|
44
44
|
- lib/gemika/database.rb
|
45
45
|
- lib/gemika/env.rb
|
46
46
|
- lib/gemika/errors.rb
|
47
|
-
- lib/gemika/github_actions_generator.rb
|
48
47
|
- lib/gemika/matrix.rb
|
49
48
|
- lib/gemika/matrix/github_actions_config.rb
|
50
|
-
- lib/gemika/matrix/travis_config.rb
|
51
49
|
- lib/gemika/rspec.rb
|
52
50
|
- lib/gemika/tasks.rb
|
53
|
-
- lib/gemika/tasks/gemika.rb
|
54
51
|
- lib/gemika/tasks/matrix.rb
|
55
52
|
- lib/gemika/tasks/rspec.rb
|
56
53
|
- lib/gemika/version.rb
|
@@ -64,14 +61,6 @@ files:
|
|
64
61
|
- spec/fixtures/github_actions_yml/missing_gemfile.yml
|
65
62
|
- spec/fixtures/github_actions_yml/multiple_jobs.yml
|
66
63
|
- spec/fixtures/github_actions_yml/two_by_two.yml
|
67
|
-
- spec/fixtures/migrate/expected_github_actions.yml
|
68
|
-
- spec/fixtures/migrate/travis.yml
|
69
|
-
- spec/fixtures/travis_yml/Gemfile_without_gemika
|
70
|
-
- spec/fixtures/travis_yml/excludes.yml
|
71
|
-
- spec/fixtures/travis_yml/gemfile_without_gemika.yml
|
72
|
-
- spec/fixtures/travis_yml/includes.yml
|
73
|
-
- spec/fixtures/travis_yml/missing_gemfile.yml
|
74
|
-
- spec/fixtures/travis_yml/two_by_two.yml
|
75
64
|
- spec/gemika/database_spec.rb
|
76
65
|
- spec/gemika/env_spec.rb
|
77
66
|
- spec/gemika/matrix/row_spec.rb
|
@@ -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'
|