Skip to content

Commit

Permalink
Update CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed May 7, 2024
1 parent d13d788 commit c2a49ae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
61 changes: 26 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,36 @@ on:

jobs:
test:
name: "GraphQL-Ruby ${{ matrix.graphql }} on Ruby ${{ matrix.ruby }} (use_client_id: ${{ matrix.client_id }}) Redis v${{ matrix.redis_version }}"
name: "GraphQL-Ruby ${{ matrix.graphql }} AnyCable ${{ matrix.anycable }} on Ruby ${{ matrix.ruby }} (use_client_id: ${{ matrix.client_id }}) Redis ${{ matrix.redis_version }}"
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ruby: "3.1"
graphql: '~> 2.0.0'
- ruby: "3.3"
graphql: '~> 2.3'
client_id: 'false'
anycable_rails: '~> 1.3'
anycable: '~> 1.5'
redis_version: latest
- ruby: "3.0"
graphql: '~> 1.13.0'
- ruby: "3.2"
graphql: '~> 2.2.0'
client_id: 'false'
anycable: '~> 1.4.0'
redis_version: '7.2'
- ruby: "3.1"
graphql: '~> 2.0.0'
client_id: 'false'
anycable_rails: '~> 1.2.0'
redis_version: 5.0.4
- ruby: 2.7
graphql: '~> 1.12.0'
client_id: 'true'
anycable_rails: '~> 1.1.0'
redis_version: 4.0.14
container:
image: ruby:${{ matrix.ruby }}
env:
CI: true
GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
ANYCABLE_RAILS_VERSION: ${{ matrix.anycable_rails }}
GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID: ${{ matrix.client_id }}
REDIS_URL: redis://redis:6379
anycable: '~> 1.3.0'
redis_version: '6.2'
env:
CI: true
GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
ANYCABLE_VERSION: ${{ matrix.anycable }}
ANYCABLE_RAILS_VERSION: ${{ matrix.anycable }}
GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID: ${{ matrix.client_id }}
REDIS_URL: redis://localhost:6379
services:
redis:
image: redis:${{ matrix.redis_version }}
Expand All @@ -48,20 +49,10 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
path: vendor/bundle
key: bundle-${{ matrix.ruby }}-${{ matrix.graphql }}-${{ matrix.anycable }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
bundle-${{ matrix.ruby }}-${{ matrix.graphql }}-${{ matrix.anycable }}-
bundle-${{ matrix.ruby }}-
- name: Upgrade Bundler to 2.0 (for older Rubies)
run: gem install bundler -v '~> 2.0'
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install
bundle update
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run RSpec
run: bundle exec rspec
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in graphql-anycable.gemspec
gemspec

gem "graphql", ENV.fetch("GRAPHQL_RUBY_VERSION", "~> 1.12")
gem "anycable", ENV.fetch("ANYCABLE_VERSION", "~> 1.0")
gem "anycable-rails", ENV.fetch("ANYCABLE_RAILS_VERSION", "~> 1.3")
gem "graphql", ENV.fetch("GRAPHQL_RUBY_VERSION", "~> 2.3")
gem "anycable", ENV.fetch("ANYCABLE_VERSION", "~> 1.5")
gem "anycable-rails", ENV.fetch("ANYCABLE_RAILS_VERSION", "~> 1.5")

group :development, :test do
gem "pry"
Expand Down
7 changes: 5 additions & 2 deletions spec/integrations/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ def self.root
require "anycable-rails"

# Load server to trigger load hooks
require "action_cable/server"
require "action_cable/server/base"
begin
require "action_cable/server/base"
rescue LoadError
require "action_cable/server"
end
# Only for anycable-rails <1.3.0
unless defined?(::AnyCable::Rails::Connection)
require "anycable/rails/channel_state"
Expand Down

0 comments on commit c2a49ae

Please sign in to comment.