Skip to content
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

Update Dart to 3.3.4 + fix deprecated #454

Open
wants to merge 6 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
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,42 @@ jobs:
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}


dart_grpc_bench:
runs-on: ubuntu-latest
needs:
- set-image-name
- changed
if: fromJSON(needs.changed.outputs.base) || contains(needs.changed.outputs.files, 'dart_grpc_bench/')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build dart_grpc_bench
run: ./build.sh dart_grpc_bench
env:
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}

- name: Benchmark dart_grpc_bench
run: ./bench.sh dart_grpc_bench
env:
GRPC_BENCHMARK_DURATION: 30s
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}

- if: github.ref == 'refs/heads/master'
name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- if: github.ref == 'refs/heads/master'
name: If on master push image to GHCR
run: docker push $GRPC_IMAGE_NAME:dart_grpc_bench-complex_proto
env:
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}


dotnet_grpc_bench:
runs-on: ubuntu-latest
needs:
Expand Down
File renamed without changes.
62 changes: 35 additions & 27 deletions dart_grpc_onhold/Dockerfile → dart_grpc_bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
FROM dart:2.19.4 AS build

WORKDIR /app
COPY dart_grpc_bench/pubspec.yaml /app/pubspec.yaml
COPY proto /app/proto

RUN dart pub get
COPY dart_grpc_bench /app
# Ensure packages are still up-to-date if anything has changed
RUN dart pub get --offline
RUN apt update && apt install -y protobuf-compiler
RUN dart pub global activate protoc_plugin
RUN mkdir -p lib/src/generated
RUN protoc --plugin=protoc-gen-dart=$HOME/.pub-cache/bin/protoc-gen-dart --proto_path=/app/proto/helloworld --dart_out=grpc:lib/src/generated -Iproto /app/proto/helloworld/helloworld.proto

RUN dart compile exe bin/server.dart -o bin/server

# ENTRYPOINT [ "/usr/bin/dart", "/app/bin/server.dart" ]

# Build minimal serving image from AOT-compiled `/server` and required system
# libraries and configuration files stored in `/runtime/` from the build stage.
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/

# Start server.
EXPOSE 50051
FROM dart:3.3.4 AS build

# Resolve app dependencies.
WORKDIR /app
COPY dart_grpc_bench/pubspec.yaml /app/pubspec.yaml
COPY proto /app/proto
RUN dart pub get

# Copy app source code
COPY dart_grpc_bench /app

# Ensure packages are still up-to-date if anything has changed
RUN dart pub get --offline

# Setup protobuf compiler
RUN apt update && apt install -y protobuf-compiler
RUN dart pub global activate protoc_plugin

# Generate protobuf files
RUN mkdir -p lib/src/generated
RUN protoc --plugin=protoc-gen-dart=$HOME/.pub-cache/bin/protoc-gen-dart --proto_path=/app/proto/helloworld --dart_out=grpc:lib/src/generated -Iproto /app/proto/helloworld/helloworld.proto

# AOT compile the binary
RUN dart compile exe bin/server.dart -o bin/server

# ENTRYPOINT [ "/usr/bin/dart", "/app/bin/server.dart" ]

# Build minimal serving image from AOT-compiled `/server` and required system
# libraries and configuration files stored in `/runtime/` from the build stage.
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/

# Start server.
EXPOSE 50051
CMD ["/app/bin/server"]
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import 'dart:io';
import 'dart:isolate';

import 'package:grpc/grpc.dart';

import 'package:helloworld/src/generated/helloworld.pb.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

class GreeterService extends GreeterServiceBase {
Expand All @@ -46,7 +44,7 @@ Future<void> main(List<String> args) async {
}

void _startServer([List? args]) async {
final server = Server([GreeterService()]);
final server = Server.create(services: [GreeterService()]);
await server.serve(
address: InternetAddress.anyIPv4, port: 50051, shared: true);
}
22 changes: 15 additions & 7 deletions dart_grpc_onhold/pubspec.lock → dart_grpc_bench/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.10.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -61,10 +69,10 @@ packages:
dependency: "direct main"
description:
name: grpc
sha256: a73c16e4f6a4a819be892bb2c73cc1d0b00e36095f69b0738cc91a733e3d27ba
sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.4"
http:
dependency: transitive
description:
Expand All @@ -77,10 +85,10 @@ packages:
dependency: transitive
description:
name: http2
sha256: "58805ebc6513eed3b98ee0a455a8357e61d187bf2e0fdc1e53120770f78de258"
sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.3.0"
http_parser:
dependency: transitive
description:
Expand Down Expand Up @@ -125,10 +133,10 @@ packages:
dependency: "direct main"
description:
name: protobuf
sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08"
sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "3.1.0"
source_span:
dependency: transitive
description:
Expand Down Expand Up @@ -162,4 +170,4 @@ packages:
source: hosted
version: "1.3.1"
sdks:
dart: ">=2.19.0 <4.0.0"
dart: ">=3.3.4 <4.0.0"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: helloworld

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: ^3.3.4

dependencies:
async: ^2.10.0
grpc: ^3.1.0
protobuf: ^2.1.0
grpc: ^3.2.4
protobuf: ^3.1.0
Loading