Skip to content

Commit

Permalink
Merge branch 'master' into fix-dart-bench
Browse files Browse the repository at this point in the history
  • Loading branch information
amka authored Sep 18, 2023
2 parents 017c6bf + e082bfa commit b1753b5
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 64 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,42 @@ jobs:
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}


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

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

- name: Benchmark haskell_grpc_haskell_bench
run: ./bench.sh haskell_grpc_haskell_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@v2
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:haskell_grpc_haskell_bench-complex_proto
env:
GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }}


java_aot_bench:
runs-on: ubuntu-latest
needs:
Expand Down
2 changes: 2 additions & 0 deletions haskell_grpc_haskell_bench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist-newstyle
src-gen/
29 changes: 29 additions & 0 deletions haskell_grpc_haskell_bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM docker.io/library/haskell:8.10.7

RUN apt-get update && apt-get install -y \
build-essential autoconf libtool libssl-dev pkg-config cmake git

ARG PARALLEL
RUN BUILD_DIR=$(mktemp -d) && \
cd $BUILD_DIR && \
git clone --depth 1 --branch v1.42.0 --recurse-submodules https://github.com/grpc/grpc && \
cd grpc && \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DgRPC_BUILD_TESTS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DgRPC_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release \
-DgRPC_SSL_PROVIDER=package \
. && \
make -j ${PARALLEL:-$(nproc)} && \
make install -j${PARALLEL:-$(nproc)} && \
rm -rf $BUILD_DIR

COPY haskell_grpc_haskell_bench /app/bench
COPY proto /app/proto

RUN cd /app/bench && cabal update && make && cabal install

RUN rm -rf /app

ENTRYPOINT /root/.cabal/bin/haskell-grpc-haskell-bench +RTS -N${GRPC_SERVER_CPUS:-1}
11 changes: 11 additions & 0 deletions haskell_grpc_haskell_bench/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CABAL ?= cabal
PROTO_COMPILE_HS = ~/.cabal/bin/compile-proto-file

grpc-haskell:
($(CABAL) build proto3-suite && mkdir -p ~/.cabal/bin && \
$(CABAL) exec which compile-proto-file | tail -1 | xargs -I{} cp {} $(PROTO_COMPILE_HS))
($(PROTO_COMPILE_HS) \
--includeDir /usr/local/include \
--includeDir ../proto/helloworld \
--proto helloworld.proto \
--out ./src-gen/)
24 changes: 24 additions & 0 deletions haskell_grpc_haskell_bench/app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

module Main where

import Network.GRPC.HighLevel
import Network.GRPC.HighLevel.Generated

import Helloworld

main :: IO ()
main =
greeterServer
(Greeter{ greeterSayHello = sayHello })
defaultServiceOptions{serverHost = "0.0.0.0", serverPort = 50051}

sayHello
:: ServerRequest 'Normal HelloRequest HelloReply
-> IO (ServerResponse 'Normal HelloReply)
sayHello (ServerNormalRequest _metadata HelloRequest{..}) = do
return $ ServerNormalResponse (HelloReply helloRequestRequest) [] StatusOk ""
17 changes: 17 additions & 0 deletions haskell_grpc_haskell_bench/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
packages:
.

source-repository-package
type: git
location: https://github.com/awakesecurity/gRPC-haskell.git
tag: d20c20d63c170b5eaf5725f03f7b7060352af402

source-repository-package
type: git
location: https://github.com/awakesecurity/gRPC-haskell.git
tag: d20c20d63c170b5eaf5725f03f7b7060352af402
subdir: core

package grpc-haskell-core
extra-include-dirs: /usr/local/include
extra-lib-dirs: /usr/local/lib
25 changes: 25 additions & 0 deletions haskell_grpc_haskell_bench/grpc-haskell-bench.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cabal-version: 2.4
name: grpc-haskell-bench
version: 0.1.0.0

executable haskell-grpc-haskell-bench
main-is: Main.hs
hs-source-dirs: app src-gen
other-modules: Helloworld
build-depends:
, base >=4.14 && <5
, bytestring
, containers
, deepseq
, grpc-haskell
, grpc-haskell-core
, proto3-suite ^>=0.6
, proto3-wire ^>=1.4
, text
, vector

default-language: Haskell2010
ghc-options:
-O2 -Wall -Wcompat -Widentities -Wincomplete-record-updates
-Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints
-threaded -rtsopts
1 change: 0 additions & 1 deletion haskell_mu_onhold/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions haskell_mu_onhold/Dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions haskell_mu_onhold/app/Main.hs

This file was deleted.

18 changes: 0 additions & 18 deletions haskell_mu_onhold/haskell-mu-bench.cabal

This file was deleted.

1 change: 0 additions & 1 deletion haskell_mu_onhold/helloworld.proto

This file was deleted.

3 changes: 0 additions & 3 deletions haskell_mu_onhold/run.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scala_akka_bench/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<akka.version>2.6.20</akka.version>
<akka.grpc.version>2.1.6</akka.grpc.version>
<scala.binary.version>2.13</scala.binary.version>
<grpc.version>1.52.1</grpc.version>
<grpc.version>1.56.1</grpc.version>
<project.encoding>UTF-8</project.encoding>
</properties>

Expand Down

0 comments on commit b1753b5

Please sign in to comment.