Skip to content

Commit

Permalink
feat: drop grpc-web for .NET 4.62 build. (#543)
Browse files Browse the repository at this point in the history
Since we bumped the minimum .NET Framework build version from 4.61 to
4.62, we gained access to an Http/2 handler for .NET
Framework. Because 4.61 did not have an Http/2 handler, we had to
resort to gRPC-Web. Now we only need gRPC-Web for the Unity build.

In order to exercise the gRPC-Web build, we add that to the testing
matrix.
  • Loading branch information
malandis authored Mar 6, 2024
1 parent e1e1727 commit 2825ab8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ jobs:
build_csharp:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
target-framework: [net6.0]
grpc-web: [false, true]
include:
- os: ubuntu-latest
target-framework: net6.0
- os: windows-latest
target-framework: net6.0
target-framework: net462
grpc-web: false
- os: windows-latest
target-framework: net462
grpc-web: true
runs-on: ${{ matrix.os }}
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
Expand Down Expand Up @@ -47,7 +50,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: dotnet build
run: dotnet build ${{ matrix.grpc-web && '-p:DefineConstants=USE_GRPC_WEB' || '' }}

- name: Unit Test
run: dotnet test --logger "console;verbosity=detailed" -f ${{ matrix.target-framework }} tests/Unit/Momento.Sdk.Tests
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/on-push-to-main-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ jobs:
build_csharp:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
target-framework: [net6.0]
grpc-web: [false, true]
include:
- os: ubuntu-latest
target-framework: net6.0
- os: windows-latest
target-framework: net462
grpc-web: false
- os: windows-latest
target-framework: net462
grpc-web: true
runs-on: ${{ matrix.os }}
env:
TEST_AUTH_TOKEN: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
Expand All @@ -32,7 +37,7 @@ jobs:
dotnet-version: "6.0.x"

- name: Build
run: dotnet build
run: dotnet build ${{ matrix.grpc-web && '-p:DefineConstants=USE_GRPC_WEB' || '' }}

- name: Unit Test
run: dotnet test -f ${{ matrix.target-framework }} tests/Unit/Momento.Sdk.Tests
Expand Down
9 changes: 1 addition & 8 deletions src/Momento.Sdk/Momento.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
<RepositoryUrl>https://github.com/momentohq/client-sdk-dotnet</RepositoryUrl>
</PropertyGroup>

<!-- Because .NET Framework doesn't support HTTP/2, we use gRPC-Web over HTTP/1.1.
Dependency resolution: .NET Framework binaries or libraries >= v4.62 that link
to Momento.Sdk will link to the .NET Framework 4.62 build. -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net462' ">
<DefineConstants>USE_GRPC_WEB</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Remove="System.Threading.Channels" />
<None Remove="Internal\Middleware\" />
Expand Down Expand Up @@ -66,7 +59,7 @@
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" $(DefineConstants.Contains('USE_GRPC_WEB')) ">
<!-- Because .NET Framework does not support HTTP/2, we fall back to gRPC-Web over HTTP/1.1 -->
<!-- Currently the Unity build needs gRPC-Web -->
<PackageReference Include="Grpc.Net.Client.Web" Version="2.52.0" />
</ItemGroup>
<ProjectExtensions>
Expand Down

0 comments on commit 2825ab8

Please sign in to comment.