Skip to content

Commit

Permalink
* use actioncable-next
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Sep 30, 2024
1 parent 1fc2b38 commit efeb4e3
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 41 deletions.
62 changes: 35 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- master
- master
pull_request:
workflow_dispatch:

Expand All @@ -16,6 +16,7 @@ jobs:
BUNDLE_RETRY: 3
CI: true
RAILS_VERSION: ${{ matrix.rails_version }}
NEXT_ACTION_CABLE: ${{ matrix.next }}
services:
redis:
image: redis:7.0-alpine
Expand All @@ -26,27 +27,30 @@ jobs:
matrix:
server: ["puma", "anycable"]
scenario: ["echo", "broadcast"]
rails_version: ["dev", "7"]
rails_version: ["~> 7.0", "~> 8.0.0.beta1"]
next: ["0", "1"]
include:
- server: "iodine"
rails_version: "dev"
rails_version: "~> 8.0.0.beta1"
scenario: "broadcast"
next: "1"
- server: "falcon"
rails_version: "dev"
rails_version: "~> 8.0.0.beta1"
scenario: "broadcast"
next: "1"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Run server
run: |
bundle exec bento --${{ matrix.server }} &
bin/wait_tcp 8080
- name: Run WS director scenario
run: |
SCENARIO=${{ matrix.scenario }} make wsdirector
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Run server
run: |
bundle exec bento --${{ matrix.server }} &
bin/wait_tcp 8080
- name: Run WS director scenario
run: |
SCENARIO=${{ matrix.scenario }} make wsdirector
conformance:
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }}
Expand All @@ -56,6 +60,7 @@ jobs:
BUNDLE_RETRY: 3
CI: true
RAILS_VERSION: ${{ matrix.rails_version }}
NEXT_ACTION_CABLE: ${{ matrix.next }}
services:
redis:
image: redis:7.0-alpine
Expand All @@ -65,18 +70,21 @@ jobs:
fail-fast: false
matrix:
server: ["puma", "anycable"]
rails_version: ["dev", "7"]
rails_version: ["~> 7.0", "~> 8.0.0.beta1"]
next: ["0", "1"]
include:
- server: "iodine"
rails_version: "dev"
rails_version: "~> 8.0.0.beta1"
next: "1"
- server: "falcon"
rails_version: "dev"
rails_version: "~> 8.0.0.beta1"
next: "1"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Run conformance tests via AnyT
run: |
make anyt-${{ matrix.server }}
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Run conformance tests via AnyT
run: |
make anyt-${{ matrix.server }}
1 change: 0 additions & 1 deletion .rails-revision

This file was deleted.

25 changes: 14 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
source "https://rubygems.org"

rails_path = File.file?(File.join(__dir__, ".rails-path")) ? File.read(File.join(__dir__, ".rails-path")).strip : File.join(__dir__, "../rails")
no_local = ENV["LOCAL_GEMS"] == "0"

# Use local Rails copy if available
if ENV["RAILS_VERSION"] == "7"
gem "rails", "~> 7.0"
elsif File.directory?(rails_path)
# Do not load to the load path if disabled
unless ENV["NEXT_ACTION_CABLE"] == "0"
if !no_local && File.directory?(File.join(__dir__, "..", "actioncable-next"))
gem "actioncable-next", path: "../actioncable-next", require: false
else
gem "actioncable-next", require: false
end
end

if !no_local && File.directory?(rails_path)
gem "rails", path: rails_path
# Use Rails from a git repo
elsif File.file?(File.join(__dir__, ".rails-revision"))
git, branch = *File.read(File.join(__dir__, ".rails-revision")).strip.split("#", 2)
gem "rails", git:, branch:
else
gem "rails", "~> 8.0"
gem "rails", ENV.fetch("RAILS_VERSION", "~> 7.0")
end

# Baseline setup: Puma + Redis pub/sub
Expand All @@ -33,9 +40,7 @@ gem "grpc" unless ENV["ANYCABLE_GRPC_IMPL"] == "grpc_kit"

anycable_dir_path = File.file?(File.join(__dir__, ".anycable-path")) ? File.read(File.join(__dir__, ".anycable-path")).strip : File.join(__dir__, "..")

if ENV["RAILS_VERSION"] == "7"
gem "anycable-core", require: false
elsif File.file?(File.join(anycable_dir_path, "anycable/anycable-core.gemspec"))
if !no_local && File.file?(File.join(anycable_dir_path, "anycable/anycable-core.gemspec"))
gem "anycable-core",require: false, path: File.join(anycable_dir_path, "anycable")
elsif File.file?(File.join(__dir__, ".anycable-revision"))
git, branch = *File.read(File.join(__dir__, ".anycable-revision")).strip.split("#", 2)
Expand All @@ -44,9 +49,7 @@ else
gem "anycable-core", require: false
end

if ENV["RAILS_VERSION"] == "7"
gem "anycable-rails", require: false
elsif File.file?(File.join(anycable_dir_path, "anycable-rails/anycable-rails.gemspec"))
if !no_local && File.file?(File.join(anycable_dir_path, "anycable-rails/anycable-rails.gemspec"))
gem "anycable-rails", require: false, path: File.join(anycable_dir_path, "anycable-rails")
elsif File.file?(File.join(__dir__, ".anycable-rails-revision"))
git, branch = *File.read(File.join(__dir__, ".anycable-rails-revision")).strip.split("#", 2)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Action Cable 8 playground
# Action Cable Next playground

This is a support project for the Action Server adapterization happening here: [rails/rails#50979][the-pr].

Expand Down
4 changes: 3 additions & 1 deletion bento
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ end.parse!

require_relative "lib/application"

$stdout.puts "⚡️ Running Action Cable #{Rails::VERSION::STRING} via #{$benchmark_server}"
desc = defined?(ActionCableNext) ? "Action Cable Next #{ActionCableNext::VERSION} on Rails #{Rails::VERSION::STRING}" : "Action Cable #{Rails::VERSION::STRING}"

$stdout.puts "⚡️ Running #{desc} via #{$benchmark_server}"

BenchmarkServer.run!

0 comments on commit efeb4e3

Please sign in to comment.