Skip to content

Commit d99c89a

Browse files
committed
ci: test against Faraday 1.x and 2.x
Add a gemfile matrix axis so CI proves dual compatibility on both Faraday majors against the same Elasticsearch versions. The faraday_2 lane pulls faraday-retry (the :retry middleware that left core) for the retry coverage.
1 parent 1851459 commit d99c89a

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ jobs:
1212
strategy:
1313
matrix:
1414
ruby-version: ['3.2']
15+
gemfile: ['faraday_1', 'faraday_2']
1516
ES_VERSION: ['8.18.0']
1617
include:
1718
- ES_VERSION: '8.18.0'
1819
ES_DOWNLOAD_URL: >-
1920
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.18.0-linux-x86_64.tar.gz
21+
env:
22+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
2023
steps:
2124
- uses: ruby/setup-ruby@v1
2225
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/vendor/cache/*.gem
77
/coverage
88
Gemfile.lock
9+
gemfiles/*.lock
910
*.gem
1011
tags
1112
.byebug_history

gemfiles/faraday_1.gemfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
# Tests elastomer-client against Faraday 1.x.
4+
#
5+
# faraday-gzip works on both Faraday 1.x and 2.x and provides the :gzip request middleware
6+
# used for response decompression (replacing the deprecated faraday_middleware).
7+
source "https://rubygems.org"
8+
9+
gem "faraday", "~> 1.10"
10+
11+
gemspec path: ".."
12+
13+
group :development do
14+
gem "activesupport", ">= 7.0"
15+
gem "bundler", "~> 2.0"
16+
gem "debug", "~> 1.7"
17+
gem "minitest", "~> 5.17"
18+
gem "minitest-focus", "~> 1.3"
19+
gem "rake"
20+
gem "rubocop", "~> 1.63.0"
21+
gem "rubocop-github", "~> 0.20.0"
22+
gem "rubocop-minitest", "~> 0.35.0"
23+
gem "rubocop-performance", "~> 1.21.0"
24+
gem "rubocop-rake", "~> 0.6.0"
25+
gem "simplecov", require: false
26+
gem "webmock", "~> 3.5"
27+
end

gemfiles/faraday_2.gemfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
# Tests elastomer-client against Faraday 2.x.
4+
#
5+
# This is the configuration the monolith targets after the Faraday 2 upgrade. faraday-gzip
6+
# provides the :gzip request middleware (response decompression) on Faraday 2.x.
7+
source "https://rubygems.org"
8+
9+
gem "faraday", "~> 2.0"
10+
11+
gemspec path: ".."
12+
13+
group :development do
14+
gem "activesupport", ">= 7.0"
15+
gem "bundler", "~> 2.0"
16+
gem "debug", "~> 1.7"
17+
# On Faraday 2.x the :retry middleware lives in the faraday-retry gem (it is in core on
18+
# 1.x). Consumers opt into retries via a connection block; the suite covers that path.
19+
gem "faraday-retry", require: "faraday/retry"
20+
gem "minitest", "~> 5.17"
21+
gem "minitest-focus", "~> 1.3"
22+
gem "rake"
23+
gem "rubocop", "~> 1.63.0"
24+
gem "rubocop-github", "~> 0.20.0"
25+
gem "rubocop-minitest", "~> 0.35.0"
26+
gem "rubocop-performance", "~> 1.21.0"
27+
gem "rubocop-rake", "~> 0.6.0"
28+
gem "simplecov", require: false
29+
gem "webmock", "~> 3.5"
30+
end

0 commit comments

Comments
 (0)