-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEarthfile
More file actions
52 lines (47 loc) · 1.54 KB
/
Earthfile
File metadata and controls
52 lines (47 loc) · 1.54 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
VERSION 0.8
# renovate: datasource=docker depName=golang
ARG go_version=1.26.2-alpine3.23@sha256:f85330846cde1e57ca9ec309382da3b8e6ae3ab943d2739500e08c86393a21b1
FROM golang:$go_version
WORKDIR /src
src:
ENV CGO_ENABLED=0
WORKDIR /src
COPY --dir internal lru .
COPY go.mod go.sum .
RUN \
--mount=type=cache,id=go-mod,target=/go/pkg/mod \
go mod download
SAVE ARTIFACT /src
# lint runs all linters for golang
lint:
# renovate: datasource=docker depName=golangci/golangci-lint
ARG golangci_lint_version=v2.11.4-alpine@sha256:72bcd68512b4e27540dd3a778a1b7afd45759d8145cfb3c089f1d7af53e718e9
FROM golangci/golangci-lint:$golangci_lint_version
WORKDIR /src
COPY .golangci.yml .
COPY --dir +src/src /
RUN \
--mount=type=cache,id=go-mod,target=/go/pkg/mod \
--mount=type=cache,id=go-build,target=/root/.cache/go-build \
--mount type=cache,id=golangci,target=/root/.cache/golangci_lint \
golangci-lint run --timeout 3m
# test runs unit tests
test:
FROM +src
RUN \
--mount=type=cache,id=go-mod,target=/go/pkg/mod \
--mount=type=cache,id=go-build,target=/root/.cache/go-build \
go test ./... -count 10
# govulncheck checks golang vulnerabilities
govulncheck:
RUN apk add git
# renovate: datasource=go depName=golang.org/x/vuln/cmd/govulncheck
ARG govulncheck_version=v1.1.4
RUN go install golang.org/x/vuln/cmd/govulncheck@$govulncheck_version
COPY --dir +src/src /
RUN govulncheck ./...
# check verifies code quality by running linters and tests
check:
BUILD +lint
BUILD +test
BUILD +govulncheck