-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (64 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.DEFAULT_GOAL := explain
.PHONY: explain
explain:
### Welcome
#
# Makefile for automation with Jenkins
#
# ____. __ .__
# | | ____ ____ | | _|__| ____ ______
# | |/ __ \ / \| |/ / |/ \ / ___/
# /\__| \ ___/| | \ <| | | \\___ \
# \________|\___ >___| /__|_ \__|___| /____ >
# \/ \/ \/ \/ \/
#
#
### Targets
#
@cat Makefile* | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#
#
#
### Check
.PHONY: clean
clean: ## clean the setup
find . -type f -name '*.pyc*' -delete
find . -type f -name '*.log' -delete
check-token:
ifeq ($(GITHUB_TOKEN),)
@echo "[Error] Please specify GITHUB_TOKEN"
@exit 1;
endif
ifeq ($(SLACK_HOOK),)
@echo "[Error] Please specify SLACK_HOOK"
@exit 1;
endif
validate-pr-input: check-token
ifeq ($(PR_NUMBER),)
@echo "[Error] Please specify PR_NUMBER"
@exit 1;
endif
ifeq ($(GIT_REPO),)
@echo "[Error] Please specify REPO_URL"
@exit 1;
endif
.PHONY: pending-pull-reviews
pending-pull-reviews: check-token ## check pending pull reviews
@python scripts/pending-pull-reviews.py --git $(GITHUB_TOKEN) --slack $(SLACK_HOOK)
.PHONY: validate-pr
validate-pr: validate-pr-input ## Validate whether the pr is up-to date
@python scripts/validate-pull-request.py --git=$(GITHUB_TOKEN) --pr=$(PR_NUMBER) --slack=$(SLACK_HOOK) --repo=$(GIT_REPO)
.PHONY: system-packages
system-packages: ## install python dependency & activate virtual environment
pip install virtualenv
make venv
.PHONY: venv
venv: venv/bin/activate
venv/bin/activate:
test -d venv || virtualenv -p python3 venv
venv/bin/pip install -U setuptools
venv/bin/pip install -r requirements.txt
touch venv/bin/activate
.PHONY: install
install: system-packages
all: clean install