Skip to content

Support Rack 3 #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions .github/workflows/tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Suite
name: CI

on:
push:
Expand All @@ -16,10 +16,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Ruby 2.7
- name: Set up Ruby 3.4
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4

- name: Install Docker and Docker Compose
run: |
Expand All @@ -35,4 +35,8 @@ jobs:
run: gem install rake rspec

- name: Run tests
run: rake
run: |
rake compile_protos_ruby
rake compile_js_client
rake compile_node_client
rake run_specs_in_docker
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ coverage

node_modules
.bundle
.yarn*

# Workspace
.idea
mise.toml
6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require: rubocop-rspec
plugins: rubocop-rspec
inherit_from: .rubocop_todo.yml

AllCops:
Expand Down Expand Up @@ -61,5 +61,5 @@ RSpec/ExampleLength:
Max: 15
RSpec/NestedGroups:
Max: 5
RSpec/FilePath:
Enabled: false
# RSpec/FilePath:
# Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.8
3.4.2
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM ruby:2.7.8
FROM ruby:3.4.2

# Install dependency packages
RUN apt-get update && apt-get install -y \
chromium \
curl \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
Expand All @@ -26,13 +23,18 @@ RUN apt-get update && apt-get install -y \
libxrandr2 \
libxss1 \
libxtst6 \
nodejs \
xdg-utils

# Install Yarn
ENV PATH=/root/.yarn/bin:$PATH
RUN touch ~/.bashrc && \
curl -o- -L https://yarnpkg.com/install.sh | sh
# Install Node, Yarn
RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh \
&& bash nodesource_setup.sh \
&& apt-get install -y nodejs \
&& npm i -g corepack \
&& corepack enable \
&& corepack prepare yarn \
&& yarn set version berry \
&& yarn config set --home enableTelemetry 0


# Setup project home directory
RUN mkdir /app
Expand All @@ -42,8 +44,7 @@ WORKDIR /app
COPY .ruby-version grpc-web.gemspec Gemfile Gemfile.lock /app/
COPY lib/grpc_web/version.rb /app/lib/grpc_web/

RUN gem install bundler -v 2.4.22 \
&& bundle config --global frozen 1 \
&& bundle install -j4 --retry 3 \
RUN gem install bundler \
&& bundle update -j4 --retry 3 \
# Remove unneeded files (cached *.gem, *.o, *.c)
&& rm -rf /usr/local/bundle/cache/*.gem
18 changes: 18 additions & 0 deletions Dockerfile.protoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM namely/protoc-all:latest

RUN apt-get update && apt-get -y install \
unzip

RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh \
&& bash nodesource_setup.sh \
&& apt-get -y install nodejs \
&& npm i -g npm \
&& npm i -g ts-protoc-gen --force

RUN PROTOC_ZIP=protoc-28.0-linux-x86_64.zip \
&& curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v28.0/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
&& rm -f $PROTOC_ZIP

ENTRYPOINT []
117 changes: 70 additions & 47 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ PATH
remote: .
specs:
grpc-web (1.2.1)
google-protobuf (~> 3.13.0)
grpc (~> 1.0)
rack (>= 1.6.0, < 3.0)
base64
google-protobuf
grpc
rack (>= 3, <= 4)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
apparition (0.6.0)
capybara (~> 3.13, < 4)
websocket-driver (>= 0.6.5)
ast (2.4.3)
base64 (0.2.0)
bigdecimal (3.1.9)
byebug (11.1.3)
capybara (3.39.2)
byebug (12.0.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -33,44 +31,54 @@ GEM
rexml
diff-lcs (1.6.1)
docile (1.4.1)
google-protobuf (3.13.0)
google-protobuf (3.13.0-universal-darwin)
google-protobuf (3.13.0-x86_64-linux)
googleapis-common-protos-types (1.0.5)
google-protobuf (~> 3.11)
grpc (1.34.0)
google-protobuf (~> 3.13)
google-protobuf (4.30.2-aarch64-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.30.2-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.30.2-x86_64-linux)
bigdecimal
rake (>= 13)
googleapis-common-protos-types (1.19.0)
google-protobuf (>= 3.18, < 5.a)
grpc (1.71.0-aarch64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.34.0-universal-darwin)
google-protobuf (~> 3.13)
grpc (1.71.0-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.34.0-x86_64-linux)
google-protobuf (~> 3.13)
grpc (1.71.0-x86_64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
hashdiff (1.1.2)
jaro_winkler (1.5.6)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.7.0)
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
nokogiri (1.15.7-aarch64-linux)
nokogiri (1.18.7-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.15.7-arm64-darwin)
nokogiri (1.18.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.7-x86_64-linux)
nokogiri (1.18.7-x86_64-linux-gnu)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.7.4)
parallel (1.27.0)
parser (3.3.8.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
prism (1.4.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.1.1)
pry-byebug (3.11.0)
byebug (~> 12.0)
pry (>= 0.13, < 0.16)
public_suffix (6.0.1)
racc (1.8.1)
rack (2.2.13)
rack (3.1.13)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-test (2.2.0)
Expand All @@ -92,31 +100,45 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
rubocop (1.75.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.41.0)
rubocop (>= 0.68.1)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.44.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-rspec (3.6.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
rubyzip (2.4.1)
selenium-webdriver (4.31.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
unicode-display_width (1.6.1)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
websocket (1.2.11)
xpath (3.2.0)
nokogiri (~> 1.8)

Expand All @@ -126,16 +148,17 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
apparition
capybara
grpc-web!
pry-byebug
rack-cors
rake
rspec (~> 3.3)
rubocop (~> 0.79.0)
rspec
rubocop
rubocop-rspec
selenium-webdriver
simplecov
webmock

BUNDLED WITH
2.4.22
2.6.7
38 changes: 16 additions & 22 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ CLEAN.include('spec/pb-ts/*.ts')
CLEAN.include('spec/js-client/main.js')
CLEAN.include('spec/node-client/dist/*')

NAMELY_DOCKER_IMAGE = 'namely/protoc-all:1.31_2'

module RakeHelpers
def self.compile_protos_js_cmd(mode, output_dir)
[
Expand All @@ -37,9 +35,9 @@ end

task :compile_protos_ruby do
sh [
'docker run',
"-v \"#{File.expand_path('spec', __dir__)}:/defs\"",
NAMELY_DOCKER_IMAGE,
'docker compose down &&',
'docker compose build &&',
'docker compose run --remove-orphans --entrypoint entrypoint.sh protoc',
'-d /defs/pb-src',
'-o /defs/pb-ruby',
'-l ruby',
Expand All @@ -49,12 +47,11 @@ end
task :compile_protos_ts do
defs_dir = File.expand_path('spec', __dir__)
proto_files = Dir[File.join(defs_dir, 'pb-src/**/*.proto')]
proto_input_files = proto_files.map { |f| f.gsub(defs_dir, '/defs') }
proto_input_files = proto_files.map { it.gsub(defs_dir, '/defs') }
sh [
'docker run',
"-v \"#{defs_dir}:/defs\"",
'--entrypoint protoc',
NAMELY_DOCKER_IMAGE,
'docker compose down &&',
'docker compose build &&',
'docker compose run --remove-orphans --entrypoint protoc protoc',
'--plugin=protoc-gen-ts=/usr/bin/protoc-gen-ts',
'--js_out=import_style=commonjs,binary:/defs/pb-ts',
'--ts_out=service=grpc-web:/defs/pb-ts',
Expand All @@ -66,29 +63,26 @@ end
task compile_js_client: [:compile_protos_js] do
compile_js_cmd = '"cd spec/js-client-src; yarn install; yarn run webpack"'
sh [
'docker-compose down',
'docker-compose build',
"docker-compose run --use-aliases ruby #{compile_js_cmd}",
'docker-compose down',
'docker compose down',
'docker compose build',
"docker compose run --use-aliases --remove-orphans ruby #{compile_js_cmd}",
].join(' && ')
end

task compile_node_client: [:compile_protos_ts] do
compile_node_cmd = '"cd spec/node-client; yarn install; yarn build"'
sh [
'docker-compose down',
'docker-compose build',
"docker-compose run --use-aliases ruby #{compile_node_cmd}",
'docker-compose down',
'docker compose down',
'docker compose build',
"docker compose run --use-aliases --remove-orphans ruby #{compile_node_cmd}",
].join(' && ')
end

task :run_specs_in_docker do
sh [
'docker-compose down',
'docker-compose build',
'docker-compose run --use-aliases ruby rspec',
'docker-compose down',
'docker compose down',
'docker compose build',
'docker compose run --use-aliases --remove-orphans ruby rspec',
].join(' && ')
end

Expand Down
Loading
Loading