Skip to content

Commit

Permalink
Merge pull request #1 from Memoriam-tv/chore/faraday_2
Browse files Browse the repository at this point in the history
⬆️ support for faraday 2
  • Loading branch information
LeipeLeon authored Dec 19, 2023
2 parents afeb8f8 + 0626a36 commit b50fa0a
Show file tree
Hide file tree
Showing 26 changed files with 294 additions and 186 deletions.
108 changes: 88 additions & 20 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,106 @@ permissions:
contents: read

jobs:
test:
runs-on: ubuntu-22.04
test_ruby_version:
runs-on: ubuntu-latest
name: ruby-${{ matrix.ruby }}, ${{ matrix.gemfile }}
strategy:
fail-fast: false
matrix:
ruby: [2.3, 2.4, 2.5, 2.6, 2.7]
rails: ["4.1", "4.2", "5.0", "5.2.3", "6.0"]
ruby:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
gemfile:
- "faraday_1.x"
- "faraday_2.x"
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Configure bundler
run: |
bundle config path vendor/bundle
- name: Create bundler lockfile
run: |
bundle lock
- uses: actions/cache@v3
with:
# NOTE: Bundler expands the path relative to the gemfile, not the
# current directory.
path: ./gemfiles/vendor/bundle
key: bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles( 'gemfiles/*.lock' ) }}
restore-keys: |
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-
- name: Install gems
run: |
bundle install --jobs 4
- name: Run tests
run: bundle exec rake

test_active_support:
needs: test_ruby_version
runs-on: ubuntu-latest
name: ruby-${{ matrix.ruby }}, ${{ matrix.gemfile }}, ${{ matrix.faraday }}
strategy:
fail-fast: false
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
matrix:
ruby:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
faraday:
- "faraday_1.x"
- "faraday_2.x"
gemfile:
- "activesupport_6.0"
- "activesupport_6.1"
- "activesupport_7.0"
- "activesupport_7.1"
exclude:
- ruby: "2.4"
rails: "4.1"
- ruby: "2.4"
rails: "4.2"
- ruby: "2.4"
rails: "6.0"
- ruby: "2.5"
rails: "4.1"
- ruby: "2.5"
rails: "4.2"
- ruby: "2.6"
rails: "4.1"
gemfile: "activesupport_7.0"
- ruby: "2.6"
rails: "4.2"
- ruby: "2.7"
rails: "4.1"
- ruby: "2.7"
rails: "4.2"
gemfile: "activesupport_7.1"

env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}_${{ matrix.faraday }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Configure bundler
run: |
bundle config path vendor/bundle
- name: Create bundler lockfile
run: |
bundle lock
- uses: actions/cache@v3
with:
# NOTE: Bundler expands the path relative to the gemfile, not the
# current directory.
path: ./gemfiles/vendor/bundle
key: bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ matrix.faraday }}-${{ hashFiles( 'gemfiles/*.lock' ) }}
restore-keys: |
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ matrix.faraday }}
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-
- name: Install gems
run: |
bundle install --jobs 4
- name: Run tests
run: bundle exec rake
67 changes: 56 additions & 11 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,20 +1,65 @@
appraise '3.2' do
gem 'activesupport', '~> 3.2.22'
gem 'minitest', '~> 5'
appraise 'activesupport-6.0-faraday-1.x' do
gem 'activesupport', '~> 6.0.0'
gem 'activemodel', '~> 6.0.0'
gem 'faraday', '~> 1.10'
gem 'faraday-gzip', '~> 1.0'
end

appraise '4.0' do
gem 'activesupport', '~> 4.0.13'
appraise 'activesupport-6.1-faraday-1.x' do
gem 'activesupport', '~> 6.1.0'
gem 'activemodel', '~> 6.1.0'
gem 'faraday', '~> 1.10'
gem 'faraday-gzip', '~> 1.0'
end

appraise '4.1' do
gem 'activesupport', '~> 4.1.14'
appraise 'activesupport-7.0-faraday-1.x' do
gem 'activesupport', '~> 7.0.0'
gem 'activemodel', '~> 7.0.0'
gem 'faraday', '~> 1.10'
gem 'faraday-gzip', '~> 1.0'
end

appraise '4.2' do
gem 'activesupport', '~> 4.2.5.1'
appraise 'activesupport-7.1-faraday-1.x' do
gem 'activesupport', '~> 7.1.0'
gem 'activemodel', '~> 7.1.0'
gem 'faraday', '~> 1.10'
gem 'faraday-gzip', '~> 1.0'
end

appraise '5.0' do
gem 'activesupport', '~> 5.0.0'
appraise 'activesupport-6.0-faraday-2.x' do
gem 'activesupport', '~> 6.0.0'
gem 'activemodel', '~> 6.0.0'
gem 'faraday', '~> 2.0'
gem 'faraday-gzip', '~> 2.0'
end

appraise 'activesupport-6.1-faraday-2.x' do
gem 'activesupport', '~> 6.1.0'
gem 'activemodel', '~> 6.1.0'
gem 'faraday', '~> 2.0'
gem 'faraday-gzip', '~> 2.0'
end

appraise 'activesupport-7.0-faraday-2.x' do
gem 'activesupport', '~> 7.0.0'
gem 'activemodel', '~> 7.0.0'
gem 'faraday', '~> 2.0'
gem 'faraday-gzip', '~> 2.0'
end

appraise 'activesupport-7.1-faraday-2.x' do
gem 'activesupport', '~> 7.1.0'
gem 'activemodel', '~> 7.1.0'
gem 'faraday', '~> 2.0'
gem 'faraday-gzip', '~> 2.0'
end

appraise 'faraday-1.x' do
gem 'faraday', '~> 1.10' # depends on Ruby (>= 2.4)
gem 'faraday-gzip', '~> 1.0' # depends on Ruby (< 4, >= 2.6)
end

appraise 'faraday-2.x' do
gem 'faraday', '~> 2.0' # depends on Ruby (>= 2.6)
gem 'faraday-gzip', '~> 2.0' # depends on Ruby (< 4, >= 2.6)
end
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- [#402](https://github.com/JsonApiClient/json_api_client/pull/402) - Remove deprecated faraday_middleware and add faraday-gzip

## 1.22.0

- [#403](https://github.com/JsonApiClient/json_api_client/pull/403) - Feature: Use the association options to lookup relationship class
Expand Down
12 changes: 2 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ source "https://rubygems.org"

gemspec

gem 'rake'
gem 'appraisal'

gem "activesupport"
gem 'addressable', '~> 2.2'

gem "codeclimate-test-reporter", group: :test, require: nil

group :development, :test do
gem 'byebug', '~> 10.0', platforms: [:mri_20, :mri_21, :mri_22]
group :test do
gem "codeclimate-test-reporter", require: nil
end
16 changes: 0 additions & 16 deletions gemfiles/3.2.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/4.0.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/4.1.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/4.2.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/5.0.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/5.2.3.gemfile

This file was deleted.

15 changes: 0 additions & 15 deletions gemfiles/6.0.gemfile

This file was deleted.

14 changes: 14 additions & 0 deletions gemfiles/activesupport_6.0_faraday_1.x.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activesupport", "~> 6.0.0"
gem "activemodel", "~> 6.0.0"
gem "faraday", "~> 1.10"
gem "faraday-gzip", "~> 1.0"

group :test do
gem "codeclimate-test-reporter", require: nil
end

gemspec path: "../"
14 changes: 14 additions & 0 deletions gemfiles/activesupport_6.0_faraday_2.x.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activesupport", "~> 6.0.0"
gem "activemodel", "~> 6.0.0"
gem "faraday", "~> 2.0"
gem "faraday-gzip", "~> 2.0"

group :test do
gem "codeclimate-test-reporter", require: nil
end

gemspec path: "../"
14 changes: 14 additions & 0 deletions gemfiles/activesupport_6.1_faraday_1.x.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activesupport", "~> 6.1.0"
gem "activemodel", "~> 6.1.0"
gem "faraday", "~> 1.10"
gem "faraday-gzip", "~> 1.0"

group :test do
gem "codeclimate-test-reporter", require: nil
end

gemspec path: "../"
Loading

0 comments on commit b50fa0a

Please sign in to comment.