Skip to content

Commit

Permalink
Update package versions (#4)
Browse files Browse the repository at this point in the history
* Update package versions
* Add build test
* Add renovate config
  • Loading branch information
at-wat authored Jun 28, 2021
1 parent f206a79 commit 79749f8
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 20 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ci
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
run: docker build -t seqsense/protoc-assets .
- name: Test protoc
run: |
cd test
make
49 changes: 29 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
FROM alpine:3.7
FROM alpine:3.13

# Install interpreter languages and tools
RUN apk add --no-cache \
git \
libstdc++ \
make \
nodejs \
nodejs-npm \
py3-setuptools \
python3 \
ruby \
&& python3 -m ensurepip \
&& rm -r /usr/lib/python*/ensurepip \
&& pip3 install --upgrade pip setuptools \
&& rm -r /root/.cache \
&& ln -s `which python3` /usr/bin/python
ruby-etc

# Install protobuf for each languages
# Install protobuf and grpcio
RUN apk add --no-cache \
protobuf
protobuf \
py3-grpcio \
py3-protobuf \
ruby-google-protobuf

ARG GLIBC_VERSION=2.33-r0
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \
&& apk add --no-cache glibc-${GLIBC_VERSION}.apk \
&& rm /etc/apk/keys/sgerrand.rsa.pub glibc-${GLIBC_VERSION}.apk

ENV GOPATH /go
ENV PATH $GOPATH/bin:/node_modules/.bin/:$PATH
Expand All @@ -25,27 +32,29 @@ RUN apk add --no-cache --virtual .builddeps \
gcc \
go \
g++ \
libstdc++ \
linux-headers \
make \
py3-pip \
python3-dev \
ruby-dev \
ruby-irb \
ruby-rdoc \
wget \
&& go get -u github.com/golang/protobuf/protoc-gen-go \
&& pip3 install \
grpcio \
grpcio-tools \
&& go get -u \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
&& export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=$(echo -e "$(nproc)\n16" | sort | head -n1) \
&& export GRPCIO_VERSION=$(pip3 show grpcio | grep '^Version:' | sed 's|^\S*:\s*||') \
&& python3 -m pip install \
grpcio-tools==${GRPCIO_VERSION} \
&& npm install \
google-protobuf \
grpc-tools \
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk \
&& apk add glibc-2.27-r0.apk \
&& gem install \
grpc \
grpc-tools \
&& apk del .builddeps \
&& rm /etc/apk/keys/sgerrand.rsa.pub glibc-2.27-r0.apk
grpc:${GRPCIO_VERSION} \
grpc-tools:${GRPCIO_VERSION} \
&& apk del .builddeps

ENV LD_LIBRARY_PATH=/usr/lib:/lib

WORKDIR /defs
18 changes: 18 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"config:base"
],
"regexManagers": [
{
"fileMatch": [
"^Dockerfile$"
],
"matchStrings": [
"ARG GLIBC_VERSION=(?<currentValue>.*)"
],
"datasourceTemplate": "github-tags",
"depNameTemplate": "sgerrand/alpine-pkg-glibc",
"versioningTemplate": "loose"
}
]
}
4 changes: 4 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!Makefile
!test.proto
!.gitignore
45 changes: 45 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
DOCKER_RUN_PROTOC_ARGS := --rm -u $(shell id -u):$(shell id -g) -v $(PWD):/defs seqsense/protoc-assets

.PHONY: all
all: pb-generate-go pb-generate-py pb-generate-rb pb-generate-js

.PHONY: pb-generate-go
pb-generate-go:
docker run $(DOCKER_RUN_PROTOC_ARGS) protoc \
-I. \
--go_out=. \
--go_opt=paths=source_relative \
--go-grpc_out=. \
--go-grpc_opt=paths=source_relative \
test.proto

.PHONY: pb-generate-cpp
pb-generate-cpp:
docker run $(DOCKER_RUN_PROTOC_ARGS) protoc \
-I. \
--cpp_out=. \
test.proto

.PHONY: pb-generate-py
pb-generate-py:
docker run $(DOCKER_RUN_PROTOC_ARGS) python3 -m grpc_tools.protoc \
-I. \
--python_out=. \
--grpc_python_out=. \
test.proto

.PHONY: pb-generate-rb
pb-generate-rb:
docker run $(DOCKER_RUN_PROTOC_ARGS) grpc_tools_ruby_protoc \
-I. \
--ruby_out=. \
--grpc_out=. \
test.proto

.PHONY: pb-generate-js
pb-generate-js:
docker run $(DOCKER_RUN_PROTOC_ARGS) grpc_tools_node_protoc \
-I. \
--js_out=import_style=commonjs,binary:. \
--grpc_out=. \
test.proto
16 changes: 16 additions & 0 deletions test/test.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = "proto3";
option go_package = "github.com/seqsense/protoc-assets/test";

package test;

service Test {
rpc Test (TestRequest) returns (TestReply) {}
}

message TestRequest {
string input = 1;
}

message TestReply {
string output = 1;
}

0 comments on commit 79749f8

Please sign in to comment.