Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
95 lines (73 loc) · 2.84 KB
/
Copy pathjustfile
File metadata and controls
95 lines (73 loc) · 2.84 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
94
95
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2026 Amutable GmbH
outdir := env("OUTDIR", ".")
destdir := env("DESTDIR", "")
prefix := "/usr"
sysconfdir := env("SYSCONFDIR", "/etc")
bindir := prefix / "bin"
unitdir := prefix / "lib/systemd/system"
vendorconfdir := prefix / "lib"
client_http_port := env("CLIENT_HTTP_PORT", "555")
buildtags := env("BUILDTAGS", "http insecure")
container_engine := env("CONTAINER_ENGINE", "docker")
default: build-all
build-all: \
(build "hardhat" buildtags) \
(build "quarry" buildtags)
build-all-in-container:
{{container_engine}} buildx build -f Dockerfile --target export \
--build-arg BUILDTAGS="{{buildtags}}" \
-o type=local,dest="{{outdir}}" \
.
sd_binaries := env("SD_BINARIES", "systemd-hostnamed")
build-systemd:
{{ container_engine }} buildx build -f Dockerfile --target systemd-export \
--build-arg SD_BINARIES="{{ sd_binaries }}" \
-o type=local,dest="{{ outdir }}/systemd" \
.
test:
go test -race -tags "{{buildtags}}" ./...
lint: lint-go lint-gomod lint-shell lint-gha vuln
lint-go:
golangci-lint run
lint-gomod:
go mod tidy -diff
lint-shell:
git ls-files -z \
| xargs -0 file --mime-type -- \
| grep 'text/x-shellscript$' \
| cut -d: -f1 \
| xargs -d'\n' -r shellcheck --
lint-gha:
zizmor .github/
go run github.com/rhysd/actionlint/cmd/actionlint@latest
vuln:
go run golang.org/x/vuln/cmd/govulncheck@latest -tags "{{ replace(buildtags, ' ', ',') }}" ./...
install: install-hardhat install-client install-client-config
install-hardhat:
install -Dm0755 {{outdir}}/hardhat {{destdir}}{{bindir}}/quarry-hardhat
[private]
install-multicall:
install -Dm0755 {{outdir}}/quarry {{destdir}}{{bindir}}/quarry
install-client: install-multicall
ln -sf quarry {{destdir}}{{bindir}}/quarry-client
install -dm0755 {{destdir}}{{unitdir}}
install-sysupdate: install-multicall
ln -sf quarry {{destdir}}{{bindir}}/quarry-sysupdate
install -Dm0644 -t {{destdir}}{{unitdir}} ./contrib/systemd/quarry-sysupdate*
install-client-http-service:
sed 's|@bindir@|{{bindir}}|g;s|@client_http_port@|{{client_http_port}}|g' contrib/systemd/quarry-client-http.service.in >{{destdir}}{{unitdir}}/quarry-client-http.service
sed 's|@bindir@|{{bindir}}|g;s|@client_http_port@|{{client_http_port}}|g' contrib/systemd/quarry-client-http.socket.in >{{destdir}}{{unitdir}}/quarry-client-http.socket
install-client-config:
install -dm0755 \
{{destdir}}{{vendorconfdir}}/quarry-client{,/config.toml.d} \
{{destdir}}{{sysconfdir}}/quarry-client{,/config.toml.d}
cp -rv ./contrib/quarry-client/* \
-t {{destdir}}{{vendorconfdir}}/quarry-client/
find {{destdir}}{{vendorconfdir}}/quarry-client -type d -print0 | \
xargs -0 chmod 0755
find {{destdir}}{{vendorconfdir}}/quarry-client -type f -print0 | \
xargs -0 chmod 0644
[private]
build cmd tags="":
go build -o "{{outdir}}/{{cmd}}" -tags "{{tags}}" "./cmd/{{cmd}}"