forked from weaveworks/kubediff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.93 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
.PHONY: all clean lint test clean-deps deps
.DEFAULT_GOAL := all
all: .uptodate lint test
IMAGE_VERSION := $(shell ./tools/image-tag)
GIT_REVISION := $(shell git rev-parse HEAD)
# Python-specific stuff
VIRTUALENV_DIR ?= .env
VIRTUALENV_BIN = $(VIRTUALENV_DIR)/bin
DEPS_UPTODATE = $(VIRTUALENV_DIR)/.deps-uptodate
VIRTUALENV := $(shell command -v virtualenv 2> /dev/null)
PIP := $(shell command -v pip 2> /dev/null)
JUNIT_XML := "junit.xml"
.ensure-virtualenv: .ensure-pip
ifndef VIRTUALENV
$(error "virtualenv is not installed. Install with `pip install [--user] virtualenv`.")
endif
touch .ensure-virtualenv
.ensure-pip:
ifndef PIP
$(error "pip is not installed. Install with `python -m [--user] ensurepip`.")
endif
touch .ensure-pip
$(VIRTUALENV_BIN)/pip: .ensure-virtualenv
virtualenv $(VIRTUALENV_DIR)
$(DEPS_UPTODATE): setup.py $(VIRTUALENV_BIN)/pip requirements.txt dev-requirements.txt
$(VIRTUALENV_BIN)/pip install -e .
$(VIRTUALENV_BIN)/pip install -r requirements.txt
$(VIRTUALENV_BIN)/pip install -r dev-requirements.txt
touch $(DEPS_UPTODATE)
deps: $(DEPS_UPTODATE)
$(VIRTUALENV_BIN)/flake8 $(VIRTUALENV_BIN)/py.test: $(DEPS_UPTODATE)
.uptodate: prom-run Dockerfile
docker build --build-arg=revision=$(GIT_REVISION) -t weaveworks/kubediff .
docker tag weaveworks/kubediff:latest weaveworks/kubediff:$(IMAGE_VERSION)
docker tag weaveworks/kubediff:$(IMAGE_VERSION) quay.io/weaveworks/kubediff:$(IMAGE_VERSION)
docker tag weaveworks/kubediff:latest quay.io/weaveworks/kubediff:latest
prom-run: vendor/github.com/tomwilkie/prom-run/*.go
CGO_ENABLED=0 GOOS=linux go build ./vendor/github.com/tomwilkie/prom-run
lint: $(VIRTUALENV_BIN)/flake8
$(VIRTUALENV_BIN)/flake8 kubediff
test: $(VIRTUALENV_BIN)/py.test
$(VIRTUALENV_BIN)/py.test --junitxml=$(JUNIT_XML)
clean:
rm -f prom-run .uptodate $(DEPS_UPTODATE)
rm -rf kubedifflib.egg-info
find . -name '*.pyc' | xargs rm -f
clean-deps:
rm -rf $(VIRTUALENV_DIR)
rm -f $(DEPS_UPTODATE)