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

fix: separated node and java code generation #503

Merged
merged 1 commit into from
Apr 5, 2023
Merged
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
23 changes: 5 additions & 18 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,7 @@ jobs:
distribution: 'adopt'
java-version: '11'

- uses: actions/setup-node@v3
with:
cache: 'npm'
cache-dependency-path: 'node/package-lock.json'
node-version-file: 'node/.nvmrc'
registry-url: "https://npm.pkg.github.com"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: bufbuild/buf-setup-action@v1

- name: npm ci
run: npm ci
working-directory: node

- name: make
- name: generate
run: make generate

- name: publish
Expand All @@ -50,6 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# we need Node for the local execution of protoc Typescript plugin
- uses: actions/setup-node@v3
with:
cache: 'npm'
Expand All @@ -61,12 +47,13 @@ jobs:

- uses: bufbuild/buf-setup-action@v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-picking:
würde noch die steps buf-setup-action und npm ci tauschen, damit alles zusammen steht, was zusammen gehört


# we need Node for the local execution of protoc Typescript plugin
- name: npm ci
run: npm ci
working-directory: node

- name: make
run: make generate
- name: generate
run: make generate TEMPLATE=buf.gen.node.yaml

- name: Run node checks
run: npm run checks
Expand Down
40 changes: 37 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ on:
- main

jobs:
generate:
java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'

- uses: bufbuild/buf-setup-action@v1

- name: generate
run: make generate

- name: test
run: ./gradlew build
working-directory: java

node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -25,8 +44,23 @@ jobs:
run: npm ci
working-directory: node

- name: generate and test code for java and node
run: make generate test
- name: generate
run: make generate TEMPLATE=buf.gen.node.yaml

- name: test
run: npm run checks
working-directory: node

go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: '1.20'

- uses: bufbuild/buf-setup-action@v1

- name: generate go code
run: make generate TEMPLATE=buf.gen.go.yaml
Expand Down
19 changes: 19 additions & 0 deletions buf.gen.node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: v1

plugins:
# Typescript/Node
- plugin: buf.build/protocolbuffers/js:v3.21.2
out: ./node
opt: import_style=commonjs,binary

- plugin: buf.build/grpc/node:v1.12.4
out: ./node
opt: grpc_js

# TODO: migrate to a remote plugin for Typescript generation
- plugin: protoc-gen-ts
out: ./node
path: ./node/node_modules/.bin/protoc-gen-ts
opt:
- mode=grpc-js
- service=grpc-node
17 changes: 0 additions & 17 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@ plugins:
- plugin: buf.build/grpc/java:v1.53.0
out: ./java/src/main/java

# Typescript/Node
- plugin: buf.build/protocolbuffers/js:v3.21.2
out: ./node
opt: import_style=commonjs,binary

- plugin: buf.build/grpc/node:v1.12.4
out: ./node
opt: grpc_js

# TODO: migrate to a remote plugin for Typescript generation
- plugin: protoc-gen-ts
out: ./node
path: ./node/node_modules/.bin/protoc-gen-ts
opt:
- mode=grpc-js
- service=grpc-node

# Python
- plugin: buf.build/protocolbuffers/python:v22.0
out: gen/python
Expand Down