-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEarthfile
More file actions
58 lines (40 loc) · 1.51 KB
/
Earthfile
File metadata and controls
58 lines (40 loc) · 1.51 KB
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
48
49
50
51
52
53
54
55
56
57
58
VERSION 0.8
FROM golang:1.25.0-alpine
# install gcc dependencies into alpine for CGO
RUN apk --no-cache add git ca-certificates gcc musl-dev libc-dev binutils-gold curl openssh
# install docker tools
# https://docs.docker.com/engine/install/debian/
RUN apk add --update --no-cache docker
# install linter
# binary will be $(go env GOPATH)/bin/golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0
RUN golangci-lint --version
# install vektra/mockery
RUN go install github.com/vektra/mockery/v2@v2.53.2
test:
BUILD +lint
BUILD +local-test
code:
WORKDIR /app
# download deps
COPY go.mod go.sum ./
RUN go mod download -x
# copy in code
COPY --dir . ./
vendor:
FROM +code
COPY +mock/mocks ./mocks
RUN go mod tidy && go mod vendor
SAVE ARTIFACT /app /files
mock:
# copy in the necessary files that need mock generated code
FROM +code
# generate the mocks
RUN mockery --dir hash --name Hasher --keeptree --exported=true --with-expecter=true --inpackage=true --disable-version-string=true --output ./mocks/hash --case snake
RUN mockery --dir discovery --name Provider --keeptree --exported=true --with-expecter=true --inpackage=true --disable-version-string=true --output ./mocks/discovery --case snake
SAVE ARTIFACT ./mocks mocks AS LOCAL mocks
lint:
FROM +vendor
COPY .golangci.yml ./
# Runs golangci-lint with settings:
RUN golangci-lint run --timeout 10m