Skip to content
Merged
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
19 changes: 12 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
env:
DOCKER_RUBY_VERSION: ${{ matrix.ruby }}
BUNDLE_GEMFILE: gems/rails.gemfile
Expand All @@ -21,21 +21,26 @@ jobs:
echo "LIBRARY_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: ${{ (env.LIBRARY_VERSION == '1' && !contains(fromJson('["3.4"]'), matrix.ruby)) ||
(env.LIBRARY_VERSION == '2' && !contains(fromJson('["2.6", "2.7", "3.0"]'), matrix.ruby)) }}
if: ${{ (env.LIBRARY_VERSION == '1' && !startsWith(matrix.ruby, '3.4') && !startsWith(matrix.ruby, '4.')) || (env.LIBRARY_VERSION == '2' && !startsWith(matrix.ruby, '2.6') && !startsWith(matrix.ruby, '2.7') && !startsWith(matrix.ruby, '3.0')) }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run RSpec
run: |
if [[ "$LIBRARY_VERSION" == "1" && ("${{ matrix.ruby }}" == "3.4" ) ]]; then
echo "Skipping Ruby ${{ matrix.ruby }} for Library v1.x"
RUBY="${{ matrix.ruby }}"

# Library v1: block Ruby >= 3.4 (3.4, 4.x, 5.x, ...)
if [[ "$LIBRARY_VERSION" == "1" && ( "$RUBY" == 3.4* || "$RUBY" == 4.* || "$RUBY" == 5.* ) ]]; then
echo "Skipping Ruby $RUBY for Library v1.x (>= 3.4 unsupported)"
exit 0
fi
if [[ "$LIBRARY_VERSION" == "2" && ( "${{ matrix.ruby }}" == "2.6" || "${{ matrix.ruby }}" == "2.7" || "${{ matrix.ruby }}" == "3.0" ) ]]; then
echo "Skipping Ruby ${{ matrix.ruby }} for Library v2.x"

# Library v2: block specific old Rubies
if [[ "$LIBRARY_VERSION" == "2" && ( "$RUBY" == 2.6* || "$RUBY" == 2.7* || "$RUBY" == 3.0* ) ]]; then
echo "Skipping Ruby $RUBY for Library v2.x"
exit 0
fi

bundle exec rake test

rubocop:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bundle exec rake test file=/path/to/spec/_spec.rb

To run test(s) against a specific Ruby version:
```ruby
DOCKER_RUBY_VERSION=3.4 bundle exec rake test
DOCKER_RUBY_VERSION=4.0 bundle exec rake test
```

## Local
Expand Down