Skip to content

Commit

Permalink
Merge pull request #38 from public/grpc-web-text
Browse files Browse the repository at this point in the history
Support grpc-web-text format
  • Loading branch information
public authored Apr 27, 2021
2 parents 5bddb64 + 3ee3af2 commit ddd8ab2
Show file tree
Hide file tree
Showing 22 changed files with 831 additions and 1,522 deletions.
111 changes: 66 additions & 45 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,51 @@ workflows:
version: 2
test:
jobs:
- build-sonora-images
- build-grpcweb-images
- test-py37
- test-py38
- black-py37
- interop-chrome-wsgi
- interop-chrome-asgi
- lint
- interop-grpcweb-wsgi:
requires:
- build-sonora-images
# - build-grpcweb-images
- interop-grpcweb-asgi:
requires:
- build-sonora-images
# - build-grpcweb-images
jobs:
build-sonora-images:
docker:
- image: cimg/base:stable
steps:
- setup_remote_docker
- checkout
- run:
name: Build
command: |
docker-compose build
docker login --username=public --password=$DOCKER_HUB_PAT
docker tag public/sonora-test-wsgi-server public/sonora-test-wsgi-server:$CIRCLE_SHA1
docker push public/sonora-test-wsgi-server:$CIRCLE_SHA1
docker tag public/sonora-test-asgi-server public/sonora-test-asgi-server:$CIRCLE_SHA1
docker push public/sonora-test-asgi-server:$CIRCLE_SHA1
build-grpcweb-images:
docker:
- image: cimg/base:stable
steps:
- setup_remote_docker
- run:
name: Build
command: |
git clone https://github.com/grpc/grpc-web.git
cd grpc-web
git reset --hard 35c16a9e4e113b65966e159dc879bc452c00526c
docker pull public/sonora-grpcweb-interop
docker-compose build common prereqs node-interop-server interop-client
docker login --username=public --password=$DOCKER_HUB_PAT
docker tag grpcweb/prereqs public/sonora-grpcweb-interop:$CIRCLE_SHA1
docker push public/sonora-grpcweb-interop:$CIRCLE_SHA1
test-py37:
docker:
- image: circleci/python:3.7
Expand Down Expand Up @@ -37,56 +76,38 @@ jobs:
key: benchmarks-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}
paths:
- .benchmarks
black-py37:
test-py39:
docker:
- image: circleci/python:3.7
- image: circleci/python:3.9
steps:
- checkout
- run: sudo pip install tox
- run: tox -e black
interop-chrome-wsgi:
- run: sudo apt-get install python3-dev libev-dev
- restore_cache:
key: benchmarks-{{ .Environment.CIRCLE_JOB }}-master
- run: tox -e py39 -- --benchmark-save=${CIRCLE_BRANCH} --benchmark-compare
- save_cache:
key: benchmarks-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}
paths:
- .benchmarks
interop-grpcweb-wsgi:
docker:
- image: public/grpc-web-frontend-tests:latest
entrypoint: /bin/bash
- image: public/sonora-grpcweb-interop
- image: public/sonora-test-wsgi-server:$CIRCLE_SHA1
steps:
- checkout
- run: sudo pip3 install grpcio-tools
- run: sudo pip3 install .
- run: |
python3 -m grpc.tools.protoc \
--proto_path=$(pwd) \
--python_out=. \
--grpc_python_out=. \
$(pwd)/echo/echo.proto
- run:
background: true
command: PYTHONPATH=.:$PYTHONPATH python3 echo/wsgi.py
- run:
working_directory: /home/node/src
command: "./node_modules/.bin/grunt karma:improbable --grpc-host=http://localhost:8080"
command: /github/grpc-web/scripts/docker-run-interop-tests.sh
interop-grpcweb-asgi:
docker:
- image: public/sonora-grpcweb-interop
- image: public/sonora-test-asgi-server:$CIRCLE_SHA1
steps:
- run:
working_directory: /home/node/src
command: "./node_modules/.bin/grunt karma:grpcWeb --grpc-host=http://localhost:8080"
interop-chrome-asgi:
command: /github/grpc-web/scripts/docker-run-interop-tests.sh
lint:
docker:
- image: public/grpc-web-frontend-tests:latest
entrypoint: /bin/bash
- image: circleci/python:3.9
steps:
- checkout
- run: sudo pip3 install grpcio-tools daphne
- run: sudo pip3 install .
- run: |
python3 -m grpc.tools.protoc \
--proto_path="$(pwd)" \
--python_out=. \
--grpc_python_out=. \
"$(pwd)/echo/echo.proto"
- run:
background: true
command: PYTHONPATH=.:$PYTHONPATH python3 echo/asgi.py
- run:
working_directory: /home/node/src
command: "./node_modules/.bin/grunt karma:improbable --grpc-host=http://localhost:8080"
- run:
working_directory: /home/node/src
command: "./node_modules/.bin/grunt karma:grpcWeb --grpc-host=http://localhost:8080"
- run: sudo pip install tox
- run: tox -e black
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.8.1-buster AS base

WORKDIR /usr/src/app

RUN apt update && \
apt install -y build-essential libev-dev

COPY . .

RUN pip install -e .[tests]

RUN python -m grpc.tools.protoc \
--proto_path="$(pwd)/" \
--python_out=. \
--grpc_python_out=. \
"$(pwd)"/test_server/*.proto

RUN pip install daphne

FROM base AS wsgi

CMD python test_server/wsgi.py

FROM base AS asgi

CMD daphne -b 0.0.0.0 -p 8080 test_server.asgi:application
35 changes: 35 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.9"
services:
wsgi-server:
build:
context: .
target: wsgi
image: public/sonora-test-wsgi-server
volumes:
- ".:/usr/src/app"
networks:
interop:
aliases:
- wsgi-server
- server

asgi-server:
build:
context: .
target: asgi
image: public/sonora-test-asgi-server
volumes:
- ".:/usr/src/app"
networks:
interop:
aliases:
- server

interop-grpcweb:
image: grpcweb/prereqs
entrypoint: /github/grpc-web/scripts/docker-run-interop-tests.sh
networks:
- interop

networks:
interop:
6 changes: 0 additions & 6 deletions echo/README.md

This file was deleted.

47 changes: 0 additions & 47 deletions echo/asgi.py

This file was deleted.

105 changes: 0 additions & 105 deletions echo/echo.proto

This file was deleted.

Loading

0 comments on commit ddd8ab2

Please sign in to comment.