-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathEarthfile
More file actions
93 lines (83 loc) · 3.14 KB
/
Earthfile
File metadata and controls
93 lines (83 loc) · 3.14 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
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
VERSION 0.8
FROM golang:1.25.3
WORKDIR /go/storj-up
lint-deps:
RUN go install github.com/storj/ci/...@045049f47d789130b7688358238c60ff11b31038
RUN go install honnef.co/go/tools/cmd/staticcheck@2025.1
RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.1
lint:
FROM +lint-deps
COPY . /go/storj-up
RUN staticcheck ./...
RUN golangci-lint --build-tags mage -j=2 run
RUN check-copyright
RUN check-large-files
RUN check-imports -race ./...
RUN check-atomic-align ./...
RUN check-errs ./...
RUN check-monkit ./...
RUN check-mod-tidy
build-app-deps:
# Download deps before copying code.
COPY go.mod go.sum ./pkg/config/gen/go.mod ./pkg/config/gen/go.sum .
RUN go mod download
# 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
SAVE ARTIFACT ./pkg/config/gen/go.mod AS LOCAL ./pkg/config/gen/go.mod
SAVE ARTIFACT ./pkg/config/gen/go.sum AS LOCAL ./pkg/config/gen/go.sum
build-app:
FROM +build-app-deps
# Copy and build code.
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o build/ ./...
SAVE ARTIFACT build/storj-up AS LOCAL build/storj-up
test:
RUN go install github.com/mfridman/tparse@36f80740879e24ba6695649290a240c5908ffcbb
RUN apt-get update && apt-get install -y jq
RUN go install -race storj.io/storj/cmd/storagenode@v1.147.5
RUN go install -race storj.io/storj/cmd/satellite@v1.147.5
RUN go install -race storj.io/storj/cmd/versioncontrol@v1.147.5
RUN go install -race storj.io/edge/cmd/gateway-mt@v1.111.0
RUN go install -race storj.io/edge/cmd/linksharing@v1.111.0
RUN go install -race storj.io/edge/cmd/authservice@v1.111.0
RUN mkdir build
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
./scripts/test.sh
SAVE ARTIFACT build/tests.json AS LOCAL build/tests.json
integration-all:
BUILD ./test/build+test
BUILD ./test/uplink+test
BUILD ./test/spanner/uplink+test
BUILD ./test/edge+test
BUILD ./test/storjscan+test
check-format:
COPY . .
RUN mkdir build
RUN bash -c '[[ $(git status --short) == "" ]] || (echo "Before formatting, please commit all your work!!! (Formatter will format only last commit)" && exit -1)'
RUN git show --name-only --pretty=format: | grep ".go" | xargs -n1 gofmt -s -w
RUN git diff > build/format.patch
SAVE ARTIFACT build/format.patch
check-format-all:
RUN go install mvdan.cc/gofumpt@v0.3.1
COPY . /go/storj-up
WORKDIR /go/storj-up
RUN bash -c 'find -name "*.go" | xargs -n1 gofmt -s -w'
RUN bash -c 'find -name "*.go" | xargs -n1 gofumpt -s -w'
RUN mkdir -p build
RUN git diff > build/format.patch
SAVE ARTIFACT build/format.patch
format:
LOCALLY
COPY +check-format/format.patch build/format.patch
RUN git apply --allow-empty build/format.patch
RUN git status
format-all:
LOCALLY
COPY +check-format-all/format.patch build/format.patch
RUN git apply --allow-empty build/format.patch
RUN git status