-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (70 loc) · 2.45 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
PYTHON_OK := $(shell which python)
POETRY_OK := $(shell which poetry)
PYTHON_VERSION := $(shell python -V | cut -d' ' -f2)
PYTHON_REQUIRED := $(shell cat .python-version)
GO_OK := $(shell which go)
GO_VERSION := $(shell go version | cut -d' ' -f3 | tr -d go)
GO_REQUIRED := $(shell cat .go-version)
check_poetry:
@echo '*********** Checking for poetry installation ***********'
ifeq ('$(POETRY_OK)','')
$(error 'poetry' not found!)
else
@echo Found poetry
endif
.PHONY: check_poetry
check_go:
@echo '*********** Checking for go installation ***********'
ifeq ('$(GO_OK)','')
$(error 'go' not found!)
else
@echo Found go
endif
@echo '*********** Checking go version ***********'
ifneq ('$(GO_REQUIRED)','$(GO_VERSION)')
$(error incorrect version of go found: '${GO_VERSION}'. Expected '${GO_REQUIRED}'!)
else
@echo Found go ${GO_REQUIRED}
endif
.PHONY: check_go
check_python:
@echo '*********** Checking for Python installation ***********'
ifeq ('$(PYTHON_OK)','')
$(error python interpreter: 'python' not found!)
else
@echo Found Python
endif
@echo '*********** Checking for Python version ***********'
ifneq ('$(PYTHON_REQUIRED)','$(PYTHON_VERSION)')
$(error incorrect version of python found: '${PYTHON_VERSION}'. Expected '${PYTHON_REQUIRED}'!)
else
@echo Found Python ${PYTHON_REQUIRED}
endif
.PHONY: check_python
setup: check_python check_poetry check_go
@echo '**************** Creating virtualenv for python dev tools e.g pre-commit *******************'
export POETRY_VIRTUALENVS_IN_PROJECT=true && poetry install --no-root
poetry run pip install --upgrade pip
@echo '******************************** Installation Complete *************************************'
.PHONY: setup
setup_precommit: check_poetry
@echo '****** Setting up pre-commit hooks ******'
poetry run pre-commit install
.PHONY: setup_precommit
install: setup setup_precommit
.PHONY: install
test:
go test -timeout 30s -short -v $(shell go list ./... | grep -v /vendor/)
.PHONY: test
test_and_update_golden_fixtures:
go test -timeout 30s -short -v $(shell go list ./... | grep -v /vendor/) -update
.PHONY: test
build-integration:
go build
.PHONY: build-integration
build_linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o spider-man .
.PHONY: build_linux
build_macosx:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o spider-man .
.PHONY: build_macosx