-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
87 lines (77 loc) · 2.48 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
83
84
85
86
87
SHELL := /usr/bin/env bash
EXEC = python=3.10
PACKAGE = ewok
SRC = scripts
INSTALL = python -m pip install
ACTIVATE = source activate $(PACKAGE)
.DEFAULT_GOAL := help
## help : print available build commands.
.PHONY : help
help : Makefile
@sed -n 's/^##//p' $<
## update : update repo with latest version from GitHub.
.PHONY : update
update :
@git pull origin main
## env : setup environment and install dependencies.
.PHONY : env
env : $(PACKAGE).egg-info/
$(PACKAGE).egg-info/ : setup.py requirements.txt
ifeq (0, $(shell conda env list | grep -wc $(PACKAGE)))
@conda create -yn $(PACKAGE) $(EXEC)
endif
@$(ACTIVATE); python -m pip install -e "."
@touch $(PACKAGE).egg-info/
## setup : decompress templates and finalize setup.
.PHONY : setup
setup : env config.zip
@$(ACTIVATE); conda install -y conda-forge::zip
@$(ACTIVATE); conda install -y conda-forge::p7zip
@$(ACTIVATE); unzip -o config.zip -d ./
@echo "Setup complete."
## format : format code with black.
.PHONY : format
format : env
@$(ACTIVATE); black .
## test : run testing pipeline.
.PHONY : test
test: style static integration
style : black
static : pylint
docs: pdoc
integration : test_pipeline
pdoc: env docs/index.html
pylint : env html/pylint/index.html
black : env
@$(ACTIVATE); black --check .
test_pipeline : env $(SRC)/run_test_dataset.sh $(PACKAGE)/*.py $(PACKAGE)/*/*.py
@$(ACTIVATE); cd $(SRC)/ && bash run_test_dataset.sh
docs/index.html : $(PACKAGE)/*.py $(PACKAGE)/*/*.py
@$(ACTIVATE); pdoc \
$(PACKAGE) \
-o $(@D)
html/pylint/index.html : html/pylint/index.json
@$(ACTIVATE); pylint-json2html -o $@ -e utf-8 $<
html/pylint/index.json : $(PACKAGE)/*.py $(PACKAGE)/*/*.py
@mkdir -p $(@D)
@$(ACTIVATE); pylint $(PACKAGE) \
--disable C0112,C0113,C0114,C0115,C0116,C0103,C0301 \
--generated-members=torch.* \
--output-format=colorized,json:$@ \
|| pylint-exit $$?
## dataset : build dataset test suites from templates and wildcards.
.PHONY : dataset
dataset : $(SRC)/run_make_dataset.sh $(PACKAGE)/compile/*.py config/*/*.*
@$(ACTIVATE); cd $(SRC) && bash run_make_dataset.sh
## evaluate : evaluate dataset test suites.
.PHONY : evaluate
evaluate : $(SRC)/run_eval_dataset.sh $(PACKAGE)/evaluate/*.py
@$(ACTIVATE); cd $(SRC) && bash run_eval_dataset.sh
## analysis : run analyses on evaluation results.
.PHONY : analysis
analysis : $(SRC)/run_make_analyses.sh
@$(ACTIVATE); cd $(SRC) && bash run_make_analyses.sh
## clean : remove all generated files.
.PHONY : clean
clean :
@rm -rf output/