-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (58 loc) · 2.77 KB
/
Copy pathMakefile
File metadata and controls
74 lines (58 loc) · 2.77 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
# Orcinus Makefile.
# The dev toolchain is a user-local Go SDK; point GO at it if it is not on PATH.
GO ?= go
BIN ?= bin/orcinus
PKG := github.com/orcinustools/orcinus
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
LDFLAGS := -X $(PKG)/pkg/version.Version=$(VERSION) -X $(PKG)/pkg/version.GitCommit=$(COMMIT)
GORELEASER ?= goreleaser
.PHONY: all build test e2e e2e-live e2e-tls e2e-standalone orcinus-standalone runtime-asset tidy lint clean dist snapshot release-check
all: build
build:
CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BIN) ./cmd/orcinus
# Unit tests + the offline (conversion) e2e test.
test:
$(GO) test ./...
# Offline end-to-end: builds the binary and asserts converted manifests.
e2e:
$(GO) test ./test/e2e/ -run TestConvert -v
# Live e2e: boots a real cluster in Docker and drives orcinus against it.
# Requires Docker (see test/e2e/live_test.go for the guard env vars).
e2e-live:
ORCINUS_E2E_LIVE=1 $(GO) test ./test/e2e/ -run TestLive -v -timeout 30m
# Live Ingress + Let's Encrypt e2e against a real public domain (LE staging).
# Requires ORCINUS_E2E_DOMAIN resolving to this host with inbound 80/443 open:
# make e2e-tls ORCINUS_E2E_DOMAIN=example.com ORCINUS_E2E_DOCKER="sudo docker"
e2e-tls:
ORCINUS_E2E_LIVE=1 $(GO) test ./test/e2e/ -run TestLiveIngressTLS -v -timeout 15m
# The standalone runtime asset (downloaded once into pkg/runtime/assets, gitignored).
# The standalone orcinus binary embeds it via go:embed + the `standalone` build tag.
RUNTIME_VERSION ?= v1.31.5+k3s1
runtime-asset:
@test -f pkg/runtime/assets/k3s || ( mkdir -p pkg/runtime/assets && \
curl -fsSL -o pkg/runtime/assets/k3s \
https://github.com/k3s-io/k3s/releases/download/$(RUNTIME_VERSION)/k3s && \
chmod +x pkg/runtime/assets/k3s )
# The full orcinus binary WITH the standalone runtime built in. It can both drive
# a cluster (`orcinus cluster init --runtime standalone`) and BE the runtime
# (`orcinus runtime server ...`) — a single self-contained binary. Opt-in via
# -tags so the default `orcinus` binary stays lean.
orcinus-standalone: runtime-asset
CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -tags standalone -o bin/orcinus-standalone ./cmd/orcinus
# Live e2e for the standalone runtime (runs `orcinus runtime server` in a clean
# container as a bare host, verifying the embed+exec path).
e2e-standalone: orcinus-standalone
ORCINUS_E2E_LIVE=1 $(GO) test ./test/e2e/ -run TestLiveStandaloneRuntime -v -timeout 15m
tidy:
$(GO) mod tidy
# Validate the release config.
release-check:
$(GORELEASER) check
# Build multi-arch release artifacts locally (no publish) into ./dist.
snapshot:
$(GORELEASER) release --snapshot --clean
# Alias.
dist: snapshot
clean:
rm -rf bin dist