protoc-gen-go-value-scan/Earthfile
2022-12-13 13:12:51 +00:00

73 lines
1.5 KiB
Plaintext

VERSION 0.6
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
WORKDIR /code
ci:
BUILD +lint
BUILD +lint-test
BUILD +test
deps:
RUN apk add --no-cache \
build-base \
git \
protoc
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)
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 ./
COPY integration_test.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/foo/v1/foo.value_scan.pb.go AS LOCAL foo.go
SAVE ARTIFACT go generated
tidy:
COPY +code/files ./
RUN go mod tidy
RUN go mod vendor
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
SAVE ARTIFACT vendor AS LOCAL vendor
test:
FROM +deps
COPY +code/files ./
COPY +generate/generated go
RUN go test integration_test.go