-
Notifications
You must be signed in to change notification settings - Fork 5
/
Earthfile
99 lines (70 loc) · 2.21 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
VERSION 0.8
FROM tochemey/docker-go:1.21.0-1.0.0
RUN go install github.com/ory/go-acc@latest
protogen:
# copy the proto files to generate
COPY --dir protos/ ./
COPY buf.work.yaml buf.gen.yaml ./
# generate the pbs
RUN buf generate \
--template buf.gen.yaml \
--path protos/ego
# save artifact to
SAVE ARTIFACT gen/ego/v3 AS LOCAL egopb
testprotogen:
# copy the proto files to generate
COPY --dir protos/ ./
COPY buf.work.yaml buf.gen.yaml ./
# generate the pbs
RUN buf generate \
--template buf.gen.yaml \
--path protos/test/pb
# save artifact to
SAVE ARTIFACT gen/test AS LOCAL test/data
sample-pb:
# copy the proto files to generate
COPY --dir protos/ ./
COPY buf.work.yaml buf.gen.yaml ./
# generate the pbs
RUN buf generate \
--template buf.gen.yaml \
--path protos/sample/pb
# save artifact to
SAVE ARTIFACT gen gen AS LOCAL example/pbs
pbs:
BUILD +protogen
BUILD +testprotogen
BUILD +sample-pb
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 vendor
SAVE ARTIFACT /app /files
lint:
FROM +vendor
COPY .golangci.yml ./
# Runs golangci-lint with settings:
RUN golangci-lint run --timeout 10m
local-test:
FROM +vendor
WITH DOCKER --pull postgres:11
RUN go-acc ./... -o coverage.out --ignore egopb,test,example,mocks -- -mod=vendor -timeout 0 -race -v
END
SAVE ARTIFACT coverage.out AS LOCAL coverage.out
mock:
# copy in the necessary files that need mock generated code
FROM +code
# generate the mocks
RUN mockery --dir persistence --all --keeptree --exported=true --with-expecter=true --inpackage=true --disable-version-string=true --output ./mocks/persistence --case snake
RUN mockery --dir offsetstore --name OffsetStore --keeptree --exported=true --with-expecter=true --inpackage=true --disable-version-string=true --output ./mocks/offsetstore --case snake
SAVE ARTIFACT ./mocks mocks AS LOCAL mocks