Add Github Actions (workflows) for building grpc-web protoc plugins. (#1203)

This commit is contained in:
Eryu Xia 2022-02-18 11:40:04 -08:00 committed by GitHub
parent ce7d734e8a
commit 3102383234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 1 deletions

32
.github/workflows/make-plugin-linux.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Make Linux Plugin
on:
workflow_dispatch:
inputs:
version_number:
description: 'Version number'
required: true
default: '1.x.x'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build plugin docker image
run: docker-compose build prereqs protoc-plugin
- name: Copy binary from Docker image
run: |
docker cp $(docker create grpcweb/protoc-plugin):/github/grpc-web/javascript/net/grpc/web/generator/protoc-gen-grpc-web \
./protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-linux-x86_64
- name: gen sha256
run: |
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-linux-x86_64.sha256 \
protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-linux-x86_64
- name: verify sha256
run: sha256sum -c protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-linux-x86_64.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: plugin
path: protoc-gen-grpc-web*

View File

@ -0,0 +1,48 @@
name: Make MacOS Plugin
on:
workflow_dispatch:
inputs:
version_number:
description: 'Version number'
required: true
default: '1.x.x'
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install build utils
run: brew install coreutils automake
- name: Checkout protobuf code
run: |
./scripts/init_submodules.sh
# Protobuf build instructions from:
# https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
- name: Build protobuf (configure & make)
run: |
cd ./third_party/protobuf
./autogen.sh
./configure
make -j$(nproc)
make install
- name: Remove dynamite dependencies (similar to `-static` on linux)
run: rm /usr/local/lib/libproto*.dylib
- name: make
run: make clean && make plugin
- name: move
run: |
mv javascript/net/grpc/web/generator/protoc-gen-grpc-web \
./protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64
- name: gen sha256
run: |
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64.sha256 \
protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64
- name: verify sha256
run: sha256sum -c protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: plugin
path: protoc-gen-grpc-web*

View File

@ -0,0 +1,37 @@
name: Make Windows Plugin
on:
workflow_dispatch:
inputs:
version_number:
description: 'Version number'
required: true
default: '1.x.x'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Print Bazel version
run: |
bazel version
- name: build
run: bazel build javascript/net/grpc/web/generator:protoc-gen-grpc-web
- name: move
run: |
mv bazel-bin/javascript/net/grpc/web/generator/protoc-gen-grpc-web.exe \
./protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-windows-x86_64.exe
shell: bash
- name: gen sha256
run: |
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-windows-x86_64.exe.sha256 \
protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-windows-x86_64.exe
shell: bash
# TODO: Check sha256 (sha256sum not available for now. )
#- name: verify sha256
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: plugin
path: protoc-gen-grpc-web*

View File

@ -30,7 +30,11 @@ RUN apt-get -qq update && apt-get -qq install -y \
WORKDIR /github/grpc-web
RUN cd ./third_party/protobuf && \
./autogen.sh && ./configure && make && make install && ldconfig
./autogen.sh && \
./configure && \
make && \
make install && \
ldconfig
RUN cd ./javascript/net/grpc/web/generator && \
make protoc-gen-grpc-web