Skip to content

Commit 661ae48

Browse files
authored
Merge pull request #415 from Memoriam-tv/master
Improve Github Action for testing various combinations of ruby/faraday/active[support|model]
2 parents 0499153 + e96c5e1 commit 661ae48

23 files changed

Lines changed: 368 additions & 89 deletions

.github/workflows/ruby.yml

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
test:
21-
runs-on: ubuntu-22.04
20+
test_ruby_version:
21+
runs-on: ubuntu-latest
22+
name: ruby-${{ matrix.ruby }}, ${{ matrix.gemfile }}
2223
strategy:
2324
fail-fast: false
2425
matrix:
@@ -27,14 +28,99 @@ jobs:
2728
- "3.1"
2829
- "3.2"
2930
- "3.3"
31+
- "3.4"
32+
gemfile:
33+
- "faraday_1.x"
34+
- "faraday_2.x"
35+
env:
36+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
3037
steps:
3138
- uses: actions/checkout@v4
3239
- name: Set up Ruby
3340
uses: ruby/setup-ruby@v1
3441
with:
3542
ruby-version: ${{ matrix.ruby }}
3643
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44+
- name: Configure bundler
45+
run: |
46+
bundle config path vendor/bundle
47+
- name: Create bundler lockfile
48+
run: |
49+
bundle lock
50+
- uses: actions/cache@v3
51+
with:
52+
# NOTE: Bundler expands the path relative to the gemfile, not the
53+
# current directory.
54+
path: ./gemfiles/vendor/bundle
55+
key: bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles( 'gemfiles/*.lock' ) }}
56+
restore-keys: |
57+
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-
58+
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-
59+
- name: Install gems
60+
run: |
61+
bundle install --jobs 4
3762
- name: Run tests
63+
run: bundle exec rake
64+
65+
test_active_support:
66+
needs: test_ruby_version
67+
runs-on: ubuntu-latest
68+
name: ruby-${{ matrix.ruby }}, ${{ matrix.gemfile }}, ${{ matrix.faraday }}
69+
strategy:
70+
fail-fast: false
71+
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
72+
matrix:
73+
ruby:
74+
- "3.0"
75+
- "3.1"
76+
- "3.2"
77+
- "3.3"
78+
- "3.4"
79+
faraday:
80+
- "faraday_1.x"
81+
- "faraday_2.x"
82+
gemfile:
83+
- "activesupport_6.0"
84+
- "activesupport_6.1"
85+
- "activesupport_7.0"
86+
- "activesupport_7.1"
87+
- "activesupport_7.2"
88+
- "activesupport_8.0"
89+
exclude:
90+
- ruby: "3.0"
91+
gemfile: "activesupport_7.2"
92+
- ruby: "3.0"
93+
gemfile: "activesupport_8.0"
94+
- ruby: "3.1"
95+
gemfile: "activesupport_8.0"
96+
97+
env:
98+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}_${{ matrix.faraday }}.gemfile
99+
steps:
100+
- uses: actions/checkout@v4
101+
- name: Set up Ruby
102+
uses: ruby/setup-ruby@v1
103+
with:
104+
ruby-version: ${{ matrix.ruby }}
105+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
106+
- name: Configure bundler
107+
run: |
108+
bundle config path vendor/bundle
109+
- name: Create bundler lockfile
38110
run: |
39-
bundle exec appraisal install
40-
bundle exec appraisal rake test
111+
bundle lock
112+
- uses: actions/cache@v3
113+
with:
114+
# NOTE: Bundler expands the path relative to the gemfile, not the
115+
# current directory.
116+
path: ./gemfiles/vendor/bundle
117+
key: bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ matrix.faraday }}-${{ hashFiles( 'gemfiles/*.lock' ) }}
118+
restore-keys: |
119+
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ matrix.faraday }}
120+
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-${{ matrix.gemfile }}-
121+
bundled-gems-${{ runner.os }}-ruby-${{ matrix.ruby }}-
122+
- name: Install gems
123+
run: |
124+
bundle install --jobs 4
125+
- name: Run tests
126+
run: bundle exec rake

Appraisals

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,96 @@
1-
appraise 'activesupport-6.0' do
1+
appraise 'activesupport-6.0-faraday-1.x' do
22
gem 'activesupport', '~> 6.0.0'
3+
gem 'activemodel', '~> 6.0.0'
4+
gem 'faraday', '~> 1.10'
5+
gem 'faraday-gzip', '~> 1.0'
6+
gem 'concurrent-ruby', '1.3.4'
37
end
48

5-
appraise 'activesupport-6.1' do
9+
appraise 'activesupport-6.1-faraday-1.x' do
610
gem 'activesupport', '~> 6.1.0'
11+
gem 'activemodel', '~> 6.1.0'
12+
gem 'faraday', '~> 1.10'
13+
gem 'faraday-gzip', '~> 1.0'
14+
gem 'concurrent-ruby', '1.3.4'
715
end
816

9-
appraise 'activesupport-7.0' do
17+
appraise 'activesupport-7.0-faraday-1.x' do
1018
gem 'activesupport', '~> 7.0.0'
19+
gem 'activemodel', '~> 7.0.0'
20+
gem 'faraday', '~> 1.10'
21+
gem 'faraday-gzip', '~> 1.0'
22+
gem 'concurrent-ruby', '1.3.4'
1123
end
1224

13-
appraise 'activesupport-7.1' do
25+
appraise 'activesupport-7.1-faraday-1.x' do
1426
gem 'activesupport', '~> 7.1.0'
27+
gem 'activemodel', '~> 7.1.0'
28+
gem 'faraday', '~> 1.10'
29+
gem 'faraday-gzip', '~> 1.0'
1530
end
1631

17-
appraise 'faraday-1.x' do
32+
appraise 'activesupport-7.2-faraday-1.x' do
33+
gem 'activesupport', '~> 7.2.0'
34+
gem 'activemodel', '~> 7.2.0'
1835
gem 'faraday', '~> 1.10'
1936
gem 'faraday-gzip', '~> 1.0'
2037
end
2138

22-
appraise 'faraday-2.x' do
39+
appraise 'activesupport-8.0-faraday-1.x' do
40+
gem 'activesupport', '~> 8.0.0'
41+
gem 'activemodel', '~> 8.0.0'
42+
gem 'faraday', '~> 1.10'
43+
gem 'faraday-gzip', '~> 1.0'
44+
end
45+
46+
appraise 'activesupport-6.0-faraday-2.x' do
47+
gem 'activesupport', '~> 6.0.0'
48+
gem 'activemodel', '~> 6.0.0'
49+
gem 'faraday', '~> 2.0'
50+
gem 'faraday-gzip', '~> 2.0'
51+
end
52+
53+
appraise 'activesupport-6.1-faraday-2.x' do
54+
gem 'activesupport', '~> 6.1.0'
55+
gem 'activemodel', '~> 6.1.0'
56+
gem 'faraday', '~> 2.0'
57+
gem 'faraday-gzip', '~> 2.0'
58+
end
59+
60+
appraise 'activesupport-7.0-faraday-2.x' do
61+
gem 'activesupport', '~> 7.0.0'
62+
gem 'activemodel', '~> 7.0.0'
63+
gem 'faraday', '~> 2.0'
64+
gem 'faraday-gzip', '~> 2.0'
65+
end
66+
67+
appraise 'activesupport-7.1-faraday-2.x' do
68+
gem 'activesupport', '~> 7.1.0'
69+
gem 'activemodel', '~> 7.1.0'
70+
gem 'faraday', '~> 2.0'
71+
gem 'faraday-gzip', '~> 2.0'
72+
end
73+
74+
appraise 'activesupport-7.2-faraday-2.x' do
75+
gem 'activesupport', '~> 7.2.0'
76+
gem 'activemodel', '~> 7.2.0'
77+
gem 'faraday', '~> 2.0'
78+
gem 'faraday-gzip', '~> 2.0'
79+
end
80+
81+
appraise 'activesupport-8.0-faraday-2.x' do
82+
gem 'activesupport', '~> 8.0.0'
83+
gem 'activemodel', '~> 8.0.0'
2384
gem 'faraday', '~> 2.0'
2485
gem 'faraday-gzip', '~> 2.0'
2586
end
87+
88+
appraise 'faraday-1.x' do
89+
gem 'faraday', '~> 1.10' # depends on Ruby (>= 2.4)
90+
gem 'faraday-gzip', '~> 1.0' # depends on Ruby (< 4, >= 2.6)
91+
end
92+
93+
appraise 'faraday-2.x' do
94+
gem 'faraday', '~> 2.0' # depends on Ruby (>= 2.6)
95+
gem 'faraday-gzip', '~> 2.0' # depends on Ruby (< 4, >= 2.6)
96+
end

Gemfile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
gem 'rake'
6-
7-
gem "activesupport", ">= 4.0.13"
8-
gem 'addressable', '~> 2.2'
9-
10-
gem "codeclimate-test-reporter", group: :test, require: nil
11-
12-
group :development, :test do
13-
gem 'byebug', '~> 10.0', platforms: [:mri_20, :mri_21, :mri_22]
5+
group :test do
6+
gem "codeclimate-test-reporter", require: nil
147
end

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,24 @@ Contributions are welcome! Please fork this repo and send a pull request. Your p
700700
Ideally, the PR has 2 commits - the first showing the failed test and the second with the fix - although this is not
701701
required. The commits will be squashed into master once accepted.
702702
703+
### Set up development locally
704+
705+
- With a decent ruby version:
706+
```shell
707+
bundle install
708+
appraisal install
709+
```
710+
711+
- Run all tests for that ruby version:
712+
```shell
713+
appraisal rake
714+
```
715+
716+
- For more info on appraisal:
717+
```shell
718+
appraisal help
719+
```
720+
703721
## Changelog
704722
705723
See [changelog](https://github.com/JsonApiClient/json_api_client/blob/master/CHANGELOG.md)

gemfiles/activesupport_6.0.gemfile

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activesupport", "~> 6.0.0"
6+
gem "activemodel", "~> 6.0.0"
7+
gem "faraday", "~> 1.10"
8+
gem "faraday-gzip", "~> 1.0"
9+
gem "concurrent-ruby", "1.3.4"
10+
11+
group :test do
12+
gem "codeclimate-test-reporter", require: nil
13+
end
14+
15+
gemspec path: "../"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activesupport", "~> 6.0.0"
6+
gem "activemodel", "~> 6.0.0"
7+
gem "faraday", "~> 2.0"
8+
gem "faraday-gzip", "~> 2.0"
9+
10+
group :test do
11+
gem "codeclimate-test-reporter", require: nil
12+
end
13+
14+
gemspec path: "../"

gemfiles/activesupport_6.1.gemfile

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activesupport", "~> 6.1.0"
6+
gem "activemodel", "~> 6.1.0"
7+
gem "faraday", "~> 1.10"
8+
gem "faraday-gzip", "~> 1.0"
9+
gem "concurrent-ruby", "1.3.4"
10+
11+
group :test do
12+
gem "codeclimate-test-reporter", require: nil
13+
end
14+
15+
gemspec path: "../"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "activesupport", "~> 6.1.0"
6+
gem "activemodel", "~> 6.1.0"
7+
gem "faraday", "~> 2.0"
8+
gem "faraday-gzip", "~> 2.0"
9+
10+
group :test do
11+
gem "codeclimate-test-reporter", require: nil
12+
end
13+
14+
gemspec path: "../"

0 commit comments

Comments
 (0)