-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathEarthfile
90 lines (73 loc) · 2.03 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
VERSION 0.7
FROM golang:1.21-alpine3.18
WORKDIR /mapd
deps:
COPY go.mod go.sum ./
RUN go mod download
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
build:
FROM +deps
COPY *.go .
COPY *.json .
RUN CGO_ENABLED=0 go build -ldflags="-extldflags=-static -s -w" -o build/mapd
SAVE ARTIFACT build/mapd /mapd AS LOCAL build/mapd
test-deps:
FROM +deps
RUN mkdir .snapshots
COPY .snapshots/* .snapshots/
COPY *.go .
COPY *.json .
test-runner:
FROM +test-deps
RUN go test .
test:
BUILD --platform=linux/arm64 +test-runner
update-snapshots-runner:
FROM +test-deps
RUN UPDATE_SNAPSHOTS=true go test . || echo "Snapshot changes generated"
SAVE ARTIFACT .snapshots/* AS LOCAL .snapshots/
update-snapshots:
BUILD --platform=linux/arm64 +update-snapshots-runner
format-deps:
FROM +deps
RUN go install mvdan.cc/gofumpt@latest
format:
FROM +format-deps
COPY *.go .
COPY *.json .
RUN gofumpt -l -w .
SAVE ARTIFACT ./*.go AS LOCAL ./
lint-deps:
FROM +format-deps
RUN go install honnef.co/go/tools/cmd/staticcheck@latest
lint:
FROM +lint-deps
COPY *.go .
COPY *.json .
RUN staticcheck -f stylish .
RUN test -z $(gofumpt -l -d .)
capnp-deps:
RUN apk add capnproto-dev
RUN apk add git
RUN go install capnproto.org/go/capnp/v3/capnpc-go@latest
RUN git clone https://github.com/capnproto/go-capnp ../go-capnp
compile-capnp:
FROM +capnp-deps
COPY *.capnp .
RUN capnp compile -I ../go-capnp/std -ogo offline.capnp
SAVE ARTIFACT offline.capnp.go /offline.capnp.go AS LOCAL offline.capnp.go
build-release:
BUILD --platform=linux/arm64 +build
docker:
FROM ubuntu:latest
WORKDIR /app
COPY +build/mapd .
COPY scripts/*.sh .
RUN apt update
RUN apt install rclone wget osmium-tool -y
CMD ["./docker_entry.sh"]
SAVE IMAGE --push pfeiferj/openpilot-mapd:latest
docker-all-archs:
BUILD --platform=linux/arm64 +docker
BUILD --platform=linux/amd64 +docker