-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
356 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ '**' ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
# Allow the job to fetch a GitHub ID token | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: [ '1.16', '1.17', '1.18' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run Earthly | ||
uses: kentik/github-workflows/earthly@v1 | ||
with: | ||
earthly_target: +all --GO_VERSION=${{ matrix.go }} | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run linters | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.45.0 | ||
only-new-issues: true | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Calc coverage | ||
run: go test -covermode=count -coverprofile=coverage.out | ||
- name: Convert coverage.out to coverage.lcov | ||
uses: jandelgado/gcov2lcov-action@v1.0.6 | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@v1.1.2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: coverage.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
VERSION 0.6 | ||
|
||
ARG GO_VERSION=1.17 | ||
|
||
FROM golang:${GO_VERSION} | ||
|
||
WORKDIR /build | ||
|
||
all: | ||
BUILD +build | ||
BUILD +test | ||
BUILD +gen-proto | ||
# Enable on next PR | ||
#BUILD +breaking-proto | ||
|
||
GO_RUN: | ||
COMMAND | ||
ARG --required cmd | ||
ARG GOCACHE=/go-cache | ||
RUN --mount=type=cache,target=$GOCACHE $cmd | ||
|
||
deps: | ||
COPY go.mod go.sum . | ||
DO +GO_RUN --cmd="go mod download all" | ||
|
||
build: | ||
FROM +deps | ||
COPY *.go . | ||
DO +GO_RUN --cmd="go build ./..." | ||
|
||
test: | ||
FROM +deps | ||
COPY *.go . | ||
DO +GO_RUN --cmd="go test -v ./..." | ||
|
||
proto-deps: | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
IF [ "${TARGETARCH}" = "arm64" ] | ||
ARG PROTOARCH=aarch_64 | ||
ELSE | ||
ARG PROTOARCH=x86_64 | ||
END | ||
RUN apt-get update && apt-get install -y wget unzip | ||
|
||
ARG PROTO_VERSION=3.13.0 | ||
RUN wget -O protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTO_VERSION}/protoc-${PROTO_VERSION}-${TARGETOS}-${PROTOARCH}.zip | ||
RUN unzip protoc.zip -d /usr/local/ | ||
|
||
ARG BUF_VERSION=1.1.0 | ||
RUN curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-$(uname -s)-$(uname -m)" -o "/usr/local/bin/buf" | ||
RUN chmod +x "/usr/local/bin/buf" | ||
|
||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | ||
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | ||
RUN go install github.com/gogo/protobuf/protoc-gen-gogoslick@latest | ||
COPY tagging.proto buf.* . | ||
|
||
gen-proto: | ||
FROM +proto-deps | ||
RUN buf generate | ||
SAVE ARTIFACT tagging.pb.go AS LOCAL tagging.pb.go | ||
|
||
lint-proto: | ||
FROM +proto-deps | ||
RUN buf lint | ||
|
||
breaking-proto: | ||
FROM +proto-deps | ||
RUN buf breaking --against "https://github.com/kentik/gohippo.git#branch=main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: v1 | ||
plugins: | ||
- name: gogoslick | ||
out: . | ||
opt: | ||
- paths=source_relative | ||
- Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types | ||
- Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types:. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by buf. DO NOT EDIT. | ||
version: v1 | ||
deps: | ||
- remote: buf.build | ||
owner: gogo | ||
repository: protobuf | ||
commit: 4df00b267f944190a229ce3695781e99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v1 | ||
deps: | ||
- buf.build/gogo/protobuf | ||
breaking: | ||
use: | ||
- FILE | ||
lint: | ||
use: | ||
- DEFAULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.