-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
64 lines (44 loc) · 1.85 KB
/
Makefile
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
work_dir = $(shell pwd)
golangci_version = $(shell head -n 1 .golangci.yml | tr -d '\# ')
arch = $(shell go env GOARCH)
image ?= ghcr.io/grafana/xk6-disruptor:latest
agent_image ?= ghcr.io/grafana/xk6-disruptor-agent:latest
all: build
agent-image: build-agent
docker build --build-arg TARGETARCH=${arch} -t $(agent_image) images/agent
disruptor-image:
./build-package.sh -o linux -a ${arch} -v latest -b image/dist/build build
docker build --build-arg TARGETARCH=${arch} -t $(image) images/disruptor
build: test
go install go.k6.io/xk6/cmd/xk6@latest
xk6 build --with $(shell go list -m)=. --output build/k6
build-e2e:
go build -tags e2e -o build/e2e-cluster ./cmd/e2e-cluster/main.go
build-agent:
go test ./pkg/agent/...
GOOS=linux CGO_ENABLED=0 go build -o images/agent/build/xk6-disruptor-agent-linux-${arch} ./cmd/agent
clean:
rm -rf image/agent/build build/
e2e-disruptors: agent-image e2e-setup
E2E_REUSE=1 go test -tags e2e ./e2e/disruptors/...
e2e-cluster:
go test -tags e2e ./e2e/cluster/...
e2e-setup: build-e2e
build/e2e-cluster setup
format:
go fmt ./...
integration-agent: agent-image
go test -tags integration ./pkg/agent/...
integration-kubernetes:
go test -tags integration ./pkg/kubernetes/...
integration-kubectl:
go test -tags integration ./pkg/testutils/e2e/kubectl/
integration-cluster:
go test -tags integration ./pkg/testutils/cluster
integration: integration-agent integration-kubernetes integration-kubectl integration-cluster
# Running with -buildvcs=false works around the issue of `go list all` failing when git, which runs as root inside
# the container, refuses to operate on the disruptor source tree as it is not owned by the same user (root).
lint:
docker run --rm -v $(work_dir):/disruptor -w /disruptor -e GOFLAGS=-buildvcs=false golangci/golangci-lint:$(golangci_version) golangci-lint run
test:
go test -race ./...