Skip to content

Commit 94e3070

Browse files
authored
Update CI matrix and Gemfile for multi-version grape testing (#76)
* Update CI matrix and Gemfile for multi-version grape testing - Expand test matrix in .github/workflows/test.yml to include various ruby and grape version combinations (1.8.0, 2.0.0, 2.1.3, 2.2.0, HEAD). - Update Ruby setup to utilize new matrix entries. - Add conditional gem specification for grape in Gemfile based on GRAPE_VERSION environment variable. * Remove lint dependency from test job in CI workflow * Update CHANGELOG for multi-version grape testing contribution * Update CI workflow and Gemfile for multi-version support of grape and related gems * Update test workflow and Gemfile for dynamic grape-entity version handling * Fix rubocop offencess * Update test workflow to include grape-swagger versions for Ruby 3.0 and grape 1.8.0 * Update test workflow to remove grape 1.8.0 and adjust Ruby version matrix * Update test workflow to exclude specific grape_swagger and grape version combinations * Refactor test workflow and Gemfile for improved dynamic version handling of grape, grape-swagger, and grape-entity * Simplify CI matrix to key version combinations - Test grape, grape-swagger, and grape-entity with one stable and one development version each. - Reduce total combinations to improve speed and maintainability without sacrificing essential coverage. * Fix variable name typos in Gemfile for grape, grape-swagger, and grape-entity versions * Refactor Gemfile
1 parent 0c1af79 commit 94e3070

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,28 @@ jobs:
2323
run: bundle exec rubocop
2424

2525
test:
26-
env:
27-
GRAPE_ENTITY: 1.0.0
28-
29-
runs-on: ubuntu-latest
26+
name: test (ruby=${{ matrix.ruby }}, grape=${{ matrix.grape }}, grape-swagger=${{ matrix.grape_swagger}}, grape_entity=${{ matrix.grape_entity }})
3027
strategy:
31-
fail-fast: false
3228
matrix:
33-
ruby-version: ['3.1', '3.2', '3.3']
29+
grape: [ '~> 2.0.0', 'head' ]
30+
grape_swagger: [ '~> 2.0.3', 'head' ]
31+
grape_entity: [ '~> 1.0.1', 'head' ]
32+
ruby: [ '3.1', '3.4', 'head' ]
33+
# Exclude combinations that are not supported.
34+
exclude:
35+
- { grape_swagger: '~> 2.0.3', grape: 'head' }
36+
runs-on: ubuntu-latest
37+
env:
38+
GRAPE_VERSION: ${{ matrix.grape }}
39+
GRAPE_SWAGGER_VERSION: ${{ matrix.grape_swagger }}
40+
GRAPE_ENTITY_VERSION: ${{ matrix.grape_entity }}
3441

3542
steps:
3643
- uses: actions/checkout@v4
3744
- name: Set up Ruby
3845
uses: ruby/setup-ruby@v1
3946
with:
40-
ruby-version: ${{ matrix.ruby-version }}
47+
ruby-version: ${{ matrix.ruby }}
4148
bundler-cache: true
4249
- name: Run tests
4350
run: bundle exec rake spec

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#### Features
44

55
* Your contribution here.
6+
* [#76](https://github.com/ruby-grape/grape-swagger-entity/pull/76): Update ci matrix and gemfile for multi-version grape testing - [@numbata](https://github.com/numbata).
67

78
#### Fixes
89

Gemfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ source 'https://rubygems.org'
55
# Specify your gem's dependencies in grape-swagger-entity.gemspec
66
gemspec
77

8+
grape_version = ENV.fetch('GRAPE_VERSION', '< 3.0')
9+
grape_swagger_version = ENV.fetch('GRAPE_SWAGGER_VERSION', '< 3.0')
10+
grape_entity_version = ENV.fetch('GRAPE_ENTITY_VERSION', '< 2.0')
11+
12+
grape_spec = grape_version.casecmp('HEAD').zero? ? { git: 'https://github.com/ruby-grape/grape' } : grape_version
13+
grape_swagger_spec = if grape_swagger_version.casecmp('HEAD').zero?
14+
{ git: 'https://github.com/ruby-grape/grape-swagger.git' }
15+
else
16+
grape_swagger_version
17+
end
18+
grape_entity_spec = if grape_entity_version.casecmp('HEAD').zero?
19+
{ git: 'https://github.com/ruby-grape/grape-entity.git' }
20+
else
21+
grape_entity_version
22+
end
23+
24+
gem 'grape', grape_spec
25+
gem 'grape-swagger', grape_swagger_spec
26+
827
group :development, :test do
928
gem 'bundler'
1029
gem 'pry', platforms: [:mri]
@@ -20,10 +39,8 @@ group :development, :test do
2039
gem 'rubocop-rspec'
2140
end
2241

23-
gem 'grape-swagger', git: 'https://github.com/ruby-grape/grape-swagger.git'
24-
2542
group :test do
26-
gem 'grape-entity', ENV.fetch('GRAPE_ENTITY', '1.0.0')
43+
gem 'grape-entity', grape_entity_spec
2744
gem 'ruby-grape-danger', '~> 0.2.1', require: false
2845
gem 'simplecov', require: false
2946
end

0 commit comments

Comments
 (0)