Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Improve the Github Action for testing various combinations of ruby/faraday/active[support|model] #3

Open
wants to merge 10 commits into
base: seb-faraday-2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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