diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 2a58171..3938d0d 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -17,8 +17,9 @@ 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: @@ -27,6 +28,12 @@ jobs: - "3.1" - "3.2" - "3.3" + - "3.4" + gemfile: + - "faraday_1.x" + - "faraday_2.x" + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile steps: - uses: actions/checkout@v4 - name: Set up Ruby @@ -34,7 +41,86 @@ jobs: 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: + - "3.0" + - "3.1" + - "3.2" + - "3.3" + - "3.4" + faraday: + - "faraday_1.x" + - "faraday_2.x" + gemfile: + - "activesupport_6.0" + - "activesupport_6.1" + - "activesupport_7.0" + - "activesupport_7.1" + - "activesupport_7.2" + - "activesupport_8.0" + exclude: + - ruby: "3.0" + gemfile: "activesupport_7.2" + - ruby: "3.0" + gemfile: "activesupport_8.0" + - ruby: "3.1" + gemfile: "activesupport_8.0" + + 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 exec appraisal install - bundle exec appraisal rake test + 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 diff --git a/Appraisals b/Appraisals index d945edc..2761ffe 100644 --- a/Appraisals +++ b/Appraisals @@ -1,25 +1,96 @@ -appraise 'activesupport-6.0' do +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' + gem 'concurrent-ruby', '1.3.4' end -appraise 'activesupport-6.1' do +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' + gem 'concurrent-ruby', '1.3.4' end -appraise 'activesupport-7.0' do +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' + gem 'concurrent-ruby', '1.3.4' end -appraise 'activesupport-7.1' do +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 'faraday-1.x' do +appraise 'activesupport-7.2-faraday-1.x' do + gem 'activesupport', '~> 7.2.0' + gem 'activemodel', '~> 7.2.0' gem 'faraday', '~> 1.10' gem 'faraday-gzip', '~> 1.0' end -appraise 'faraday-2.x' do +appraise 'activesupport-8.0-faraday-1.x' do + gem 'activesupport', '~> 8.0.0' + gem 'activemodel', '~> 8.0.0' + gem 'faraday', '~> 1.10' + gem 'faraday-gzip', '~> 1.0' +end + +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 'activesupport-7.2-faraday-2.x' do + gem 'activesupport', '~> 7.2.0' + gem 'activemodel', '~> 7.2.0' + gem 'faraday', '~> 2.0' + gem 'faraday-gzip', '~> 2.0' +end + +appraise 'activesupport-8.0-faraday-2.x' do + gem 'activesupport', '~> 8.0.0' + gem 'activemodel', '~> 8.0.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 diff --git a/Gemfile b/Gemfile index c432377..32ed6a1 100644 --- a/Gemfile +++ b/Gemfile @@ -2,13 +2,6 @@ source "https://rubygems.org" gemspec -gem 'rake' - -gem "activesupport", ">= 4.0.13" -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 diff --git a/README.md b/README.md index cb60758..e8f243b 100644 --- a/README.md +++ b/README.md @@ -700,6 +700,24 @@ Contributions are welcome! Please fork this repo and send a pull request. Your p Ideally, the PR has 2 commits - the first showing the failed test and the second with the fix - although this is not required. The commits will be squashed into master once accepted. +### Set up development locally + +- With a decent ruby version: + ```shell + bundle install + appraisal install + ``` + +- Run all tests for that ruby version: + ```shell + appraisal rake + ``` + +- For more info on appraisal: + ```shell + appraisal help + ``` + ## Changelog See [changelog](https://github.com/JsonApiClient/json_api_client/blob/master/CHANGELOG.md) diff --git a/gemfiles/activesupport_6.0.gemfile b/gemfiles/activesupport_6.0.gemfile deleted file mode 100644 index 57a778e..0000000 --- a/gemfiles/activesupport_6.0.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake" -gem "activesupport", "~> 6.0.0" -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] -end - -gemspec path: "../" diff --git a/gemfiles/activesupport_6.0_faraday_1.x.gemfile b/gemfiles/activesupport_6.0_faraday_1.x.gemfile new file mode 100644 index 0000000..73bc938 --- /dev/null +++ b/gemfiles/activesupport_6.0_faraday_1.x.gemfile @@ -0,0 +1,15 @@ +# 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" +gem "concurrent-ruby", "1.3.4" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_6.0_faraday_2.x.gemfile b/gemfiles/activesupport_6.0_faraday_2.x.gemfile new file mode 100644 index 0000000..65bdcb6 --- /dev/null +++ b/gemfiles/activesupport_6.0_faraday_2.x.gemfile @@ -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: "../" diff --git a/gemfiles/activesupport_6.1.gemfile b/gemfiles/activesupport_6.1.gemfile deleted file mode 100644 index 460b752..0000000 --- a/gemfiles/activesupport_6.1.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake" -gem "activesupport", "~> 6.1.0" -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] -end - -gemspec path: "../" diff --git a/gemfiles/activesupport_6.1_faraday_1.x.gemfile b/gemfiles/activesupport_6.1_faraday_1.x.gemfile new file mode 100644 index 0000000..8adacae --- /dev/null +++ b/gemfiles/activesupport_6.1_faraday_1.x.gemfile @@ -0,0 +1,15 @@ +# 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" +gem "concurrent-ruby", "1.3.4" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_6.1_faraday_2.x.gemfile b/gemfiles/activesupport_6.1_faraday_2.x.gemfile new file mode 100644 index 0000000..8617834 --- /dev/null +++ b/gemfiles/activesupport_6.1_faraday_2.x.gemfile @@ -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", "~> 2.0" +gem "faraday-gzip", "~> 2.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.0.gemfile b/gemfiles/activesupport_7.0.gemfile deleted file mode 100644 index 5d577ad..0000000 --- a/gemfiles/activesupport_7.0.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake" -gem "activesupport", "~> 7.0.0" -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] -end - -gemspec path: "../" diff --git a/gemfiles/activesupport_7.0_faraday_1.x.gemfile b/gemfiles/activesupport_7.0_faraday_1.x.gemfile new file mode 100644 index 0000000..8eed30b --- /dev/null +++ b/gemfiles/activesupport_7.0_faraday_1.x.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.0.0" +gem "activemodel", "~> 7.0.0" +gem "faraday", "~> 1.10" +gem "faraday-gzip", "~> 1.0" +gem "concurrent-ruby", "1.3.4" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.0_faraday_2.x.gemfile b/gemfiles/activesupport_7.0_faraday_2.x.gemfile new file mode 100644 index 0000000..e78b86a --- /dev/null +++ b/gemfiles/activesupport_7.0_faraday_2.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.0.0" +gem "activemodel", "~> 7.0.0" +gem "faraday", "~> 2.0" +gem "faraday-gzip", "~> 2.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.1.gemfile b/gemfiles/activesupport_7.1.gemfile deleted file mode 100644 index 5347aea..0000000 --- a/gemfiles/activesupport_7.1.gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake" -gem "activesupport", "~> 7.1.0" -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] -end - -gemspec path: "../" diff --git a/gemfiles/activesupport_7.1_faraday_1.x.gemfile b/gemfiles/activesupport_7.1_faraday_1.x.gemfile new file mode 100644 index 0000000..75a4613 --- /dev/null +++ b/gemfiles/activesupport_7.1_faraday_1.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.1.0" +gem "activemodel", "~> 7.1.0" +gem "faraday", "~> 1.10" +gem "faraday-gzip", "~> 1.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.1_faraday_2.x.gemfile b/gemfiles/activesupport_7.1_faraday_2.x.gemfile new file mode 100644 index 0000000..5f5d5a8 --- /dev/null +++ b/gemfiles/activesupport_7.1_faraday_2.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.1.0" +gem "activemodel", "~> 7.1.0" +gem "faraday", "~> 2.0" +gem "faraday-gzip", "~> 2.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.2_faraday_1.x.gemfile b/gemfiles/activesupport_7.2_faraday_1.x.gemfile new file mode 100644 index 0000000..5da9e41 --- /dev/null +++ b/gemfiles/activesupport_7.2_faraday_1.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.2.0" +gem "activemodel", "~> 7.2.0" +gem "faraday", "~> 1.10" +gem "faraday-gzip", "~> 1.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_7.2_faraday_2.x.gemfile b/gemfiles/activesupport_7.2_faraday_2.x.gemfile new file mode 100644 index 0000000..04bcc14 --- /dev/null +++ b/gemfiles/activesupport_7.2_faraday_2.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 7.2.0" +gem "activemodel", "~> 7.2.0" +gem "faraday", "~> 2.0" +gem "faraday-gzip", "~> 2.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_8.0_faraday_1.x.gemfile b/gemfiles/activesupport_8.0_faraday_1.x.gemfile new file mode 100644 index 0000000..dcfd3af --- /dev/null +++ b/gemfiles/activesupport_8.0_faraday_1.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 8.0.0" +gem "activemodel", "~> 8.0.0" +gem "faraday", "~> 1.10" +gem "faraday-gzip", "~> 1.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/activesupport_8.0_faraday_2.x.gemfile b/gemfiles/activesupport_8.0_faraday_2.x.gemfile new file mode 100644 index 0000000..7303571 --- /dev/null +++ b/gemfiles/activesupport_8.0_faraday_2.x.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activesupport", "~> 8.0.0" +gem "activemodel", "~> 8.0.0" +gem "faraday", "~> 2.0" +gem "faraday-gzip", "~> 2.0" + +group :test do + gem "codeclimate-test-reporter", require: nil +end + +gemspec path: "../" diff --git a/gemfiles/faraday_1.x.gemfile b/gemfiles/faraday_1.x.gemfile index f6c65ac..70d4dfe 100644 --- a/gemfiles/faraday_1.x.gemfile +++ b/gemfiles/faraday_1.x.gemfile @@ -2,15 +2,11 @@ source "https://rubygems.org" -gem "rake" -gem "activesupport", ">= 4.0.13" -gem "addressable", "~> 2.2" -gem "codeclimate-test-reporter", group: :test, require: nil gem "faraday", "~> 1.10" gem "faraday-gzip", "~> 1.0" -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 gemspec path: "../" diff --git a/gemfiles/faraday_2.x.gemfile b/gemfiles/faraday_2.x.gemfile index d857de4..00bc12d 100644 --- a/gemfiles/faraday_2.x.gemfile +++ b/gemfiles/faraday_2.x.gemfile @@ -2,15 +2,11 @@ source "https://rubygems.org" -gem "rake" -gem "activesupport", ">= 4.0.13" -gem "addressable", "~> 2.2" -gem "codeclimate-test-reporter", group: :test, require: nil gem "faraday", "~> 2.0" gem "faraday-gzip", "~> 2.0" -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 gemspec path: "../" diff --git a/json_api_client.gemspec b/json_api_client.gemspec index 3c04832..4acc1f1 100644 --- a/json_api_client.gemspec +++ b/json_api_client.gemspec @@ -12,15 +12,19 @@ Gem::Specification.new do |s| s.summary = 'Build client libraries compliant with specification defined by jsonapi.org' s.add_dependency "activesupport", '>= 6.0.0' - s.add_dependency "faraday", '>= 1.10', '< 3.0' - s.add_dependency "faraday-gzip", '>= 1.0', '< 3.0' s.add_dependency "addressable", '~> 2.2' s.add_dependency "activemodel", '>= 6.0.0' + + s.add_dependency "faraday", '>= 1.10', '< 3.0' + s.add_dependency "faraday-gzip", '>= 1.0', '< 3.0' + s.add_dependency "rack", '>= 0.2' s.add_development_dependency "webmock", '~> 3.5.1' s.add_development_dependency "mocha" s.add_development_dependency "appraisal" + s.add_development_dependency "base64" + s.add_development_dependency "mutex_m" s.license = "MIT"