This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
/
Makefile
67 lines (49 loc) · 1.87 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
.PHONY: all clean lint test clean-deps deps
.DEFAULT_GOAL := all
all: test lint .uptodate
DH_ORG=weaveworks
VERSION=$(shell git symbolic-ref --short HEAD)-$(shell git rev-parse --short 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 pip3 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)/python -m pip install -e .
$(VIRTUALENV_BIN)/python -m pip install -r requirements.txt
$(VIRTUALENV_BIN)/python -m 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 -t docker.io/$(DH_ORG)/kubediff .
docker tag docker.io/$(DH_ORG)/kubediff:latest docker.io/$(DH_ORG)/kubediff:$(VERSION)
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)
publish-image: image
docker push docker.io/$(DH_ORG)/kubediff:$(VERSION)