diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 615ca20..f78cc60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,31 +10,33 @@ on: jobs: test: - name: "GraphQL-Ruby ${{ matrix.graphql }} on Ruby ${{ matrix.ruby }} Redis v${{ matrix.redis_version }}" + name: "GraphQL-Ruby ${{ matrix.graphql }} AnyCable ${{ matrix.anycable }} on Ruby ${{ matrix.ruby }} 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.3" + graphql: '~> 2.3' + anycable: '~> 1.5' + redis_version: latest + - ruby: "3.2" + graphql: '~> 2.2.0' + anycable: '~> 1.4.0' + redis_version: '7.2' - ruby: "3.1" graphql: '~> 2.0.0' - anycable_rails: '~> 1.3' - redis_version: latest - - ruby: "3.0" - graphql: '~> 1.13.0' - anycable_rails: '~> 1.2.0' - redis_version: 5.0.4 - - ruby: 2.7 - graphql: '~> 1.12.0' - 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 }} - 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 }} @@ -43,21 +45,13 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + ports: + - 6379:6379 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 diff --git a/Gemfile b/Gemfile index e74ef60..2ac00bc 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/spec/integrations/rails_spec.rb b/spec/integrations/rails_spec.rb index d4559bc..8f277bc 100644 --- a/spec/integrations/rails_spec.rb +++ b/spec/integrations/rails_spec.rb @@ -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"