protoc-gen-go-value-scan/Earthfile

57 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-12-12 12:33:48 +01:00
VERSION 0.6
2022-12-12 12:56:28 +01:00
ARG BUF_VERSION=1.10.0
ARG GOLANGCILINT_VERSION=1.50.1
ARG GO_VERSION=1.19.4
ARG PROTOGENGO_VERSION=1.28.1
FROM golang:$GO_VERSION-alpine3.16
2022-12-12 12:33:48 +01:00
WORKDIR /code
ci:
BUILD +lint
BUILD +lint-test
deps:
RUN apk add --no-cache \
build-base \
2022-12-12 12:56:28 +01:00
git \
2022-12-12 12:33:48 +01:00
protoc
2022-12-12 12:56:28 +01:00
RUN (cd /tmp; go install github.com/bufbuild/buf/cmd/buf@v$BUF_VERSION)
RUN (cd /tmp; go install google.golang.org/protobuf/cmd/protoc-gen-go@v$PROTOGENGO_VERSION)
RUN (cd /tmp; go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCILINT_VERSION)
2022-12-12 12:59:32 +01:00
SAVE IMAGE --push
2022-12-12 12:33:48 +01:00
build:
FROM +deps
COPY go.mod go.sum ./
COPY --dir vendor ./
COPY main.go ./
RUN go install .
code:
COPY go.mod go.sum ./
COPY --dir vendor ./
COPY main.go ./
SAVE ARTIFACT . files
lint:
FROM +deps
COPY +code/files ./
RUN golangci-lint run main.go
lint-test:
FROM +deps
COPY +generate/generated go
RUN go mod init git.wobcom.de/smartmetering/foo
RUN go mod tidy
RUN golangci-lint run
generate:
FROM +build
COPY --dir test ./
WORKDIR test
RUN buf ls-files
RUN buf lint -v
RUN buf generate -v
# RUN --no-cache cat go/foo/v1/foo.value_scan.pb.go
SAVE ARTIFACT go generated