-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
83 lines (66 loc) · 2.26 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
.SECONDEXPANSION:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
# Run in parallel by default
ifneq "$(PARALLEL)" "false"
MAKEFLAGS += --jobs --output-sync=target
endif
UNAME := $(shell uname)
ifeq ($(NEOBENCH_VERSION),)
NEOBENCH_VERSION := dev
endif
build: tmp/.integration-tests-pass out/docker_image_id
.PHONY: build
tmp/.binaries-built: out/neobench_$(NEOBENCH_VERSION)_linux_amd64 \
out/neobench_$(NEOBENCH_VERSION)_linux_arm64 \
out/neobench_$(NEOBENCH_VERSION)_windows_amd64 \
out/neobench_$(NEOBENCH_VERSION)_darwin_amd64
> mkdir --parents $(@D)
> touch $@
out/neobench_$(NEOBENCH_VERSION)_linux_amd64: tmp/.unit-tests-pass
> mkdir --parents $(@D)
> env GOOS=linux GOARCH=amd64 go build -o $@
out/neobench_$(NEOBENCH_VERSION)_linux_arm64: tmp/.unit-tests-pass
> mkdir --parents $(@D)
> env GOOS=linux GOARCH=arm64 go build -o $@
out/neobench_$(NEOBENCH_VERSION)_windows_amd64: tmp/.unit-tests-pass
> mkdir --parents $(@D)
> env GOOS=windows GOARCH=amd64 go build -o $@
out/neobench_$(NEOBENCH_VERSION)_darwin_amd64: tmp/.unit-tests-pass
> mkdir --parents $(@D)
> env GOOS=darwin GOARCH=amd64 go build -o $@
tmp/.unit-tests-pass: tmp/.go-vet
> mkdir --parents $(@D)
> go test ./...
> touch $@
tmp/.go-vet: tmp/.gofmt
> mkdir --parents $(@D)
> go vet ./...
> touch $@
tmp/.gofmt: $(shell find . -name '*.go')
> mkdir --parents $(@D)
> if [[ "$$(gofmt -l .)" != "" ]]; then
> echo "You need to run gofmt on these files:"
> gofmt -l .
> exit 1
> fi
> touch $@
out/docker_image_id: tmp/.binaries-built
> mkdir --parents $(@D)
> dockerlog="tmp/dockerlog"
> docker build --build-arg NEOBENCH_VERSION=$(NEOBENCH_VERSION) --tag "neobench:$(NEOBENCH_VERSION)" . | tee "$${dockerlog}"
> image_id="$$(grep "Successfully built" "$${dockerlog}" | cut -d' ' -f3)"
> echo "$${image_id}" > $@
tmp/.integration-tests-pass: tmp/.binaries-built test/integration-test
> mkdir --parents $(@D)
> export NEOBENCH_PATH="$$(realpath out/neobench_$(NEOBENCH_VERSION)_linux_amd64)"
> NEO4J_IMAGE="neo4j:4.4-enterprise" test/integration-test
> touch $@