-
Notifications
You must be signed in to change notification settings - Fork 1
/
Earthfile
47 lines (42 loc) · 1.42 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
VERSION 0.6
ARG GO_VERSION=1.18
ARG GOLINT_VERSION=1.47.3
go-deps:
ARG GO_VERSION
FROM golang:$GO_VERSION
WORKDIR /build
COPY go.mod go.sum ./
COPY internal internal
RUN go mod download
RUN apt-get update
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
test:
FROM +go-deps
WORKDIR /build
RUN go get github.com/onsi/gomega/...
RUN go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
RUN go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
RUN go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
RUN go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
COPY . .
RUN ginkgo run --fail-fast --slow-spec-threshold 30s --covermode=atomic --coverprofile=coverage.out -p -r ./...
SAVE ARTIFACT coverage.out AS LOCAL coverage.out
dist:
ARG GO_VERSION
FROM golang:$GO_VERSION
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
RUN apt update
RUN apt install -y goreleaser
WORKDIR /build
COPY . .
RUN goreleaser build --rm-dist --skip-validate --snapshot
SAVE ARTIFACT /build/dist/* AS LOCAL dist/
lint:
ARG GO_VERSION
FROM golang:$GO_VERSION
ARG GOLINT_VERSION
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$GOLINT_VERSION
WORKDIR /build
COPY . .
RUN golangci-lint run