protoc-gen-go-value-scan/Earthfile

73 lines
1.5 KiB
Plaintext
Raw Permalink 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
2022-12-13 14:12:51 +01:00
BUILD +test
2022-12-12 12:33:48 +01:00
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: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 ./
2022-12-13 14:12:51 +01:00
COPY integration_test.go ./
2022-12-12 12:33:48 +01:00
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
2022-12-13 14:12:51 +01:00
# SAVE ARTIFACT go/foo/v1/foo.value_scan.pb.go AS LOCAL foo.go
2022-12-12 12:33:48 +01:00
SAVE ARTIFACT go generated
2022-12-13 14:12:51 +01:00
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