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
35 changes: 25 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: CI

on:
'on':
pull_request:
branches:
- "**"
Expand All @@ -20,10 +21,12 @@ jobs:
elixir-version: 1.15.x
- name: Retrieve dependencies cache
uses: actions/cache@v3
id: mix-cache # id to use in retrieve action
id: mix-cache # id to use in retrieve action
with:
path: deps
key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: >-
v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
run: mix deps.get 1>/dev/null
- name: Check format
Expand All @@ -35,6 +38,9 @@ jobs:
matrix:
otp: [24.x, 25.x, 26.1.x]
elixir: [1.15.x]
include:
- otp: 28.x
elixir: 1.19.x

needs: check_format
steps:
Expand All @@ -45,10 +51,12 @@ jobs:
elixir-version: ${{matrix.elixir}}
- name: Retrieve dependencies cache
uses: actions/cache@v3
id: mix-cache # id to use in retrieve action
id: mix-cache # id to use in retrieve action
with:
path: deps
key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: >-
v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
run: mix setup 1>/dev/null
- name: Run Tests
Expand All @@ -66,10 +74,12 @@ jobs:
elixir-version: 1.15.x
- name: Retrieve dependencies cache
uses: actions/cache@v3
id: mix-cache # id to use in retrieve action
id: mix-cache # id to use in retrieve action
with:
path: deps
key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: >-
v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
run: mix deps.get 1>/dev/null
working-directory: ./interop
Expand All @@ -86,6 +96,9 @@ jobs:
matrix:
otp: [24.x, 25.x, 26.1.x]
elixir: [1.15.x]
include:
- otp: 28.x
elixir: 1.19.x

steps:
- uses: actions/checkout@v3
Expand All @@ -95,13 +108,15 @@ jobs:
elixir-version: ${{ matrix.elixir }}
- name: Retrieve dependencies cache
uses: actions/cache@v3
id: mix-cache # id to use in retrieve action
id: mix-cache # id to use in retrieve action
with:
path: deps
key: v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: >-
v1-${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
run: mix deps.get 1>/dev/null
working-directory: ./interop
- name: Run interop tests
run: mix run script/run.exs
working-directory: ./interop
working-directory: ./interop
11 changes: 11 additions & 0 deletions grpc_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.0.0-rc.1 (2025-12-02)

### Enhancements

* Major restructuring: separated into distinct grpc_core, grpc_server, and grpc_client packages
* Refactor GRPC client setup - start supervisor in application (#483)

### Bug fixes

* Fix Connection state created by build_direct_state (#480)

## v0.11.5 (2025-11-14)

### Enhancements
Expand Down
15 changes: 11 additions & 4 deletions grpc_client/lib/grpc/client/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,14 @@ defmodule GRPC.Client.Connection do
|> Enum.uniq()
end

defp build_balanced_state(base_state, addresses, config, lb_policy_opt, norm_opts, adapter) do
defp build_balanced_state(
%__MODULE__{} = base_state,
addresses,
config,
lb_policy_opt,
norm_opts,
adapter
) do
lb_policy =
cond do
is_map(config) and Map.has_key?(config, :load_balancing_policy) ->
Expand Down Expand Up @@ -415,7 +422,7 @@ defmodule GRPC.Client.Connection do
end
end

defp build_direct_state(base_state, norm_target, norm_opts, adapter) do
defp build_direct_state(%__MODULE__{} = base_state, norm_target, norm_opts, adapter) do
{host, port} = split_host_port(norm_target)
vc = base_state.virtual_channel

Expand All @@ -433,7 +440,7 @@ defmodule GRPC.Client.Connection do
end
end

defp build_real_channels(addresses, virtual_channel, norm_opts, adapter) do
defp build_real_channels(addresses, %Channel{} = virtual_channel, norm_opts, adapter) do
Map.new(addresses, fn %{port: port, address: host} ->
case connect_real_channel(
%Channel{virtual_channel | host: host, port: port},
Expand Down Expand Up @@ -501,7 +508,7 @@ defmodule GRPC.Client.Connection do
|> adapter.connect(opts[:adapter_opts])
end

defp connect_real_channel(vc, host, port, opts, adapter) do
defp connect_real_channel(%Channel{} = vc, host, port, opts, adapter) do
%Channel{vc | host: host, port: port}
|> adapter.connect(opts[:adapter_opts])
end
Expand Down
10 changes: 10 additions & 0 deletions grpc_server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v1.0.0-rc.1 (2025-12-02)

### Enhancements

* Major restructuring: separated into distinct grpc_core, grpc_server, and grpc_client packages

### Bug fixes

* Fix Stream map_error send_response handling (#487)

## v0.11.5 (2025-11-14)

### Enhancements
Expand Down
12 changes: 6 additions & 6 deletions grpc_server/lib/grpc/protoc/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ defmodule GRPC.Protoc.CLI do
|> Enum.reduce(ctx, &parse_param/2)
end

defp parse_param("plugins=" <> plugins, ctx) do
defp parse_param("plugins=" <> plugins, %Context{} = ctx) do
%Context{ctx | plugins: String.split(plugins, "+")}
end

defp parse_param("gen_descriptors=" <> value, ctx) do
defp parse_param("gen_descriptors=" <> value, %Context{} = ctx) do
case value do
"true" ->
%Context{ctx | gen_descriptors?: true}
Expand All @@ -97,19 +97,19 @@ defmodule GRPC.Protoc.CLI do
end
end

defp parse_param("package_prefix=" <> package, ctx) do
defp parse_param("package_prefix=" <> package, %Context{} = ctx) do
if package == "" do
raise "package_prefix can't be empty"
else
%Context{ctx | package_prefix: package}
end
end

defp parse_param("transform_module=" <> module, ctx) do
defp parse_param("transform_module=" <> module, %Context{} = ctx) do
%Context{ctx | transform_module: Module.concat([module])}
end

defp parse_param("one_file_per_module=" <> value, ctx) do
defp parse_param("one_file_per_module=" <> value, %Context{} = ctx) do
case value do
"true" ->
%Context{ctx | one_file_per_module?: true}
Expand All @@ -129,7 +129,7 @@ defmodule GRPC.Protoc.CLI do
# end
# end

defp parse_param(_unknown, ctx) do
defp parse_param(_unknown, %Context{} = ctx) do
ctx
end

Expand Down
5 changes: 4 additions & 1 deletion grpc_server/lib/grpc/protoc/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ defmodule GRPC.Protoc.Generator do
end
end

defp generate_module_definitions(ctx, %Google.Protobuf.FileDescriptorProto{} = desc) do
defp generate_module_definitions(
%Context{} = ctx,
%Google.Protobuf.FileDescriptorProto{} = desc
) do
ctx =
%Context{
ctx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ defmodule ExceptionServer do

@impl true
def handle_cast(:case_boom, state) do
a = fn -> :ok end

case a.() do
:error -> :boom
end
raise CaseClauseError, term: :ok

{:noreply, state}
end
Expand Down
5 changes: 2 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ defmodule GRPC.GRPCRoot do

defp deps do
[
{:grpc_server, path: "grpc_server"},
{:grpc_server, path: "grpc_server"}
]
end

defp aliases do
[
setup: cmd("deps.get"),
Expand All @@ -42,5 +42,4 @@ defmodule GRPC.GRPCRoot do
end
end
end

end
Loading