Skip to content
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
20 changes: 10 additions & 10 deletions internal/source/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ func TestGatherSourceFilenames(t *testing.T) {
// Walk entire directory with a depth of 1
filenames, err := gatherSourceFilenames("testdata/success")
require.NoError(t, err)
assert.Equal(t, 2, len(filenames))
Copy link
Member

Choose a reason for hiding this comment

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

That's peculiar, why asserting equal on len doesn't work?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@mfridman mfridman Oct 23, 2023

Choose a reason for hiding this comment

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

I don't quite get why cannot use assert.Equal to compare 2 values, but if it made CI pass so be it 🤷

ps. no issues with this PR, mainly trying to understand as I write this assertion often. Imo it reads a bit cleaner with len.

assert.Len(t, filenames, 2)
filenames, err = gatherSourceFilenames("testdata/success/connect-go")
require.NoError(t, err)
assert.Equal(t, 1, len(filenames))
assert.Len(t, filenames, 1)
filenames, err = gatherSourceFilenames("testdata/success")
require.NoError(t, err)
assert.Equal(t, 2, len(filenames))
assert.Len(t, filenames, 2)

filenames, err = gatherSourceFilenames("testdata/fail")
require.NoError(t, err)
assert.Equal(t, 2, len(filenames))
assert.Len(t, filenames, 2)

// Invalid directory
_, err = gatherSourceFilenames("notexists")
Expand All @@ -36,7 +36,7 @@ func TestLoadSourceFile(t *testing.T) {
t.Parallel()
filenames, err := gatherSourceFilenames("testdata/success/connect-go")
require.NoError(t, err)
assert.Equal(t, 1, len(filenames))
assert.Len(t, filenames, 1)
config, err := loadConfigFile(filenames[0])
require.NoError(t, err)
assert.Equal(t, filenames[0], config.Filename)
Expand All @@ -46,22 +46,22 @@ func TestGatherConfigs(t *testing.T) {
t.Parallel()
configs, err := GatherConfigs("testdata/success")
require.NoError(t, err)
assert.Equal(t, 2, len(configs))
assert.Len(t, configs, 2)

for _, config := range configs {
name := filepath.Base(filepath.Dir(config.Filename))
switch name {
case "connect-go":
source := config.Source.GitHub
require.NotNil(t, source)
assert.Equal(t, source.Owner, "bufbuild")
assert.Equal(t, source.Repository, "connect-go")
assert.Equal(t, "bufbuild", source.Owner)
assert.Equal(t, "connect-go", source.Repository)
assert.Nil(t, config.Source.DartFlutter)
case "connect-web":
source := config.Source.NPMRegistry
require.NotNil(t, source)
assert.Equal(t, source.Name, "@bufbuild/protoc-gen-connect-web")
assert.Equal(t, true, config.Source.Disabled)
assert.Equal(t, "@bufbuild/protoc-gen-connect-web", source.Name)
assert.True(t, config.Source.Disabled)
assert.Nil(t, config.Source.DartFlutter)
default:
assert.FailNow(t, "unknown plugin name", name)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
13 changes: 13 additions & 0 deletions plugins/community/roadrunner-server-php-grpc/v4.5.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1.6
FROM golang:1.21.3-bullseye AS build
RUN git clone --depth=1 --branch v4.5.5 https://github.com/roadrunner-server/grpc.git
RUN --mount=type=cache,target=/go/pkg/mod \
cd grpc/protoc_plugins/protoc-gen-php-grpc && \
CGO_ENABLED=0 \
go install -ldflags="-s -w" -trimpath

FROM scratch
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-php-grpc /
USER nobody
ENTRYPOINT [ "/protoc-gen-php-grpc" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
name: buf.build/community/roadrunner-server-php-grpc
plugin_version: v4.5.5
source_url: https://github.com/roadrunner-server/grpc
description: Generates code for the PHP RoadRunner application server.
deps:
- plugin: buf.build/protocolbuffers/php:v24.4
spdx_license_id: MIT
license_url: https://github.com/roadrunner-server/grpc/blob/v4.5.5/LICENSE
output_languages:
- php
2 changes: 2 additions & 0 deletions plugins/connectrpc/kotlin/v0.3.0/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
11 changes: 11 additions & 0 deletions plugins/connectrpc/kotlin/v0.3.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1.4
FROM debian:bullseye-20231009 AS build
RUN apt-get update \
&& apt-get install -y curl
WORKDIR /app
RUN curl -fsSL -o /app/protoc-gen-connect-kotlin.jar https://repo1.maven.org/maven2/com/connectrpc/protoc-gen-connect-kotlin/0.3.0/protoc-gen-connect-kotlin-0.3.0.jar

FROM gcr.io/distroless/java17-debian11
WORKDIR /app
COPY --from=build /app/protoc-gen-connect-kotlin.jar /app
CMD ["/app/protoc-gen-connect-kotlin.jar"]
28 changes: 28 additions & 0 deletions plugins/connectrpc/kotlin/v0.3.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: v1
name: buf.build/connectrpc/kotlin
plugin_version: v0.3.0
source_url: https://github.com/connectrpc/connect-kotlin
description: Idiomatic gRPC & Connect RPCs for Kotlin.
deps:
- plugin: buf.build/protocolbuffers/kotlin:v24.4
output_languages:
- kotlin
spdx_license_id: Apache-2.0
license_url: https://github.com/connectrpc/connect-kotlin/blob/v0.3.0/LICENSE
registry:
opts:
- generateCallbackMethods=true
maven:
compiler:
kotlin:
version: 1.8.22
deps:
- com.connectrpc:connect-kotlin:0.3.0
- com.connectrpc:connect-kotlin-google-java-ext:0.3.0
- com.connectrpc:connect-kotlin-okhttp:0.3.0
additional_runtimes:
- name: lite
deps:
- com.connectrpc:connect-kotlin:0.3.0
- com.connectrpc:connect-kotlin-google-javalite-ext:0.3.0
- com.connectrpc:connect-kotlin-okhttp:0.3.0
2 changes: 2 additions & 0 deletions plugins/connectrpc/swift-mocks/v0.9.0/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
12 changes: 12 additions & 0 deletions plugins/connectrpc/swift-mocks/v0.9.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# syntax=docker/dockerfile:1.6
FROM swift:5.9.1-focal AS build

WORKDIR /app
RUN git clone --depth 1 --branch 0.9.0 https://github.com/connectrpc/connect-swift
WORKDIR /app/connect-swift
RUN swift build -c release --product protoc-gen-connect-swift-mocks --static-swift-stdlib -Xlinker -s

FROM gcr.io/distroless/cc-debian11
COPY --from=build --link /app/connect-swift/.build/release/protoc-gen-connect-swift-mocks .
USER nobody
ENTRYPOINT [ "/protoc-gen-connect-swift-mocks" ]
26 changes: 26 additions & 0 deletions plugins/connectrpc/swift-mocks/v0.9.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: v1
name: buf.build/connectrpc/swift-mocks
plugin_version: v0.9.0
source_url: https://github.com/connectrpc/connect-swift
description: Generates mocks that are compatible with Connect-Swift clients.
deps:
- plugin: buf.build/apple/swift:v1.24.0
output_languages:
- swift
registry:
swift:
deps:
- source: https://github.com/connectrpc/connect-swift.git
package: connect-swift
products: [ ConnectMocks ]
swift_versions: [ ".v5" ]
version: 0.9.0
platforms:
macos: v10_15
ios: v12
tvos: v13
opts:
- Visibility=Public
- FileNaming=PathToUnderscores
spdx_license_id: Apache-2.0
license_url: https://github.com/connectrpc/connect-swift/blob/0.9.0/LICENSE
2 changes: 2 additions & 0 deletions plugins/connectrpc/swift/v0.9.0/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
12 changes: 12 additions & 0 deletions plugins/connectrpc/swift/v0.9.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# syntax=docker/dockerfile:1.6
FROM swift:5.9.1-focal AS build

WORKDIR /app
RUN git clone --depth 1 --branch 0.9.0 https://github.com/connectrpc/connect-swift
WORKDIR /app/connect-swift
RUN swift build -c release --product protoc-gen-connect-swift --static-swift-stdlib -Xlinker -s

FROM gcr.io/distroless/cc-debian11
COPY --from=build --link /app/connect-swift/.build/release/protoc-gen-connect-swift .
USER nobody
ENTRYPOINT [ "/protoc-gen-connect-swift" ]
26 changes: 26 additions & 0 deletions plugins/connectrpc/swift/v0.9.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: v1
name: buf.build/connectrpc/swift
plugin_version: v0.9.0
source_url: https://github.com/connectrpc/connect-swift
description: Idiomatic gRPC & Connect RPCs for Swift.
deps:
- plugin: buf.build/apple/swift:v1.24.0
output_languages:
- swift
registry:
swift:
deps:
- source: https://github.com/connectrpc/connect-swift.git
package: connect-swift
products: [ Connect ]
swift_versions: [ ".v5" ]
version: 0.9.0
platforms:
macos: v10_15
ios: v12
tvos: v13
opts:
- Visibility=Public
- FileNaming=PathToUnderscores
spdx_license_id: Apache-2.0
license_url: https://github.com/connectrpc/connect-swift/blob/0.9.0/LICENSE
2 changes: 2 additions & 0 deletions plugins/grpc/java/v1.59.0/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
21 changes: 21 additions & 0 deletions plugins/grpc/java/v1.59.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1.4
FROM debian:bullseye-20231009 AS build

ARG TARGETARCH

WORKDIR /build
RUN apt-get update \
&& apt-get install -y curl
RUN arch=${TARGETARCH}; \
if [ "${arch}" = "arm64" ]; then\
arch="aarch_64"; \
elif [ "${arch}" = "amd64" ]; then\
arch="x86_64"; \
fi; \
echo "${arch}"; \
curl -fsSL -o protoc-gen-grpc-java https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.59.0/protoc-gen-grpc-java-1.59.0-linux-${arch}.exe

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
24 changes: 24 additions & 0 deletions plugins/grpc/java/v1.59.0/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: v1
name: buf.build/grpc/java
plugin_version: v1.59.0
source_url: https://github.com/grpc/grpc-java
description: Generates Java client and server stubs for the gRPC framework.
deps:
- plugin: buf.build/protocolbuffers/java:v24.4
output_languages:
- java
spdx_license_id: Apache-2.0
license_url: https://github.com/grpc/grpc-java/blob/v1.59.0/LICENSE
registry:
maven:
deps:
- io.grpc:grpc-core:1.59.0
- io.grpc:grpc-protobuf:1.59.0
- io.grpc:grpc-stub:1.59.0
additional_runtimes:
- name: lite
deps:
- io.grpc:grpc-core:1.59.0
- io.grpc:grpc-protobuf-lite:1.59.0
- io.grpc:grpc-stub:1.59.0
opts: [lite]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:jT7gKL/t3iAPRsfXcC8b24F5IdSxtcuyuhD8yvmGRiA=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:7bA/GKq0K0btx4JnO+NSpYBkPfz0oSLjz+Ddv/NYe/A=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:W/LFoLpNVeZGRBkGun6ZBwH29/BAZurvzVVo79GKrOE=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:8SHtQVVxJtH/0voLCE4rQxWI4Fog2R556Isppm+4Csw=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:dFV12zZWalkRO3BRSNMIP9cKQcrS87zoYVL+cNKJoPE=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:iwKLQczZMy7NJbuX4jpwzzp9IARStvmwh+m1o5Ve1Cc=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:mQa8K3URgoKoceeyzBxACvNF/z1QSjl71DJKzCZ8vTc=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:0gy4iQq+mN839dZkKRT6N0G4OAZUH2n9790s9ekgyXc=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:OQ/nxBJx2TIXL+wVheGlMgEXhH3sBaNManWDi1mgc6E=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:Yc/vGC5W6TWGvPGWTgRF0nHC9u1zEWImHbKbM9MlzHo=