-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEarthfile
29 lines (25 loc) · 796 Bytes
/
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
VERSION 0.7
FROM golang:1.21
WORKDIR /app
deps:
COPY go.mod go.sum ./
RUN go mod download
RUN go install github.com/jstemmer/go-junit-report/v2@latest
RUN go install github.com/goreleaser/goreleaser@latest
# Output these back in case go mod download changes them.
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
test:
FROM +deps
COPY . .
RUN go test -v 2>&1 ./... | go-junit-report -set-exit-code > ./junit-results.xml
SAVE ARTIFACT junit-results.xml AS LOCAL junit-results.xml
coverage:
FROM +deps
COPY . .
RUN go test ./... -race -coverprofile=coverage.out -covermode=atomic
SAVE ARTIFACT coverage.out AS LOCAL coverage.out
build:
FROM +deps
COPY . .
RUN goreleaser release --snapshot --clean