-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
113 lines (86 loc) · 1.94 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
###
# Config
###
JOBS ?= $(shell nproc)
MAKEFLAGS += -j $(JOBS) -r
PATH := $(abspath node_modules)/.bin:$(PATH)
.DELETE_ON_ERROR:
.SECONDARY:
.SUFFIXES:
LPAREN := (
RPAREN := )
###
# Clean
###
TARGET := mllp_http.egg-info build target
.PHONY: clean
clean:
rm -fr $(TARGET)
###
# Schema
###
SCHEMA_SRC := $(shell find schema -name '*.yml')
SCHEMA_TGT := $(SCHEMA_SRC:schema/%.yml=slice_db/formats/%.json)
slice_db/formats/%.json: schema/%.yml
< $< yq > $@
.PHONY: schema
schema: $(SCHEMA_TGT)
###
# Format
###
FORMAT_SRC := $(shell find . $(TARGET:%=-not \$(LPAREN) -name % -prune \$(RPAREN)) -name '*.py')
PRETTIER_SRC := $(shell find . $(TARGET:%=-not \$(LPAREN) -name % -prune \$(RPAREN)) -name '*.md')
.PHONY: format
format: target/format.target
.PHONY: test-format
test-format: target/format-test.target
target/format.target: $(FORMAT_SRC) $(PRETTIER_SRC) target/node_modules.target
mkdir -p $(@D)
isort --profile black $(FORMAT_SRC)
black -t py37 $(FORMAT_SRC)
node_modules/.bin/prettier --write .
touch $@ target/format-test.target
target/format-test.target: $(FORMAT_SRC)
mkdir -p $(@D)
black -t py37 --check $(FORMAT_SRC)
touch $@ target/format.target
###
# Npm
###
target/node_modules.target:
mkdir -p $(@D)
yarn install
> $@
###
# Pip
###
PY_SRC := $(shell find . $(TARGET:%=-not \$(LPAREN) -name % -prune \$(RPAREN)) -name '*.py')
.PHONY: install
install:
pip3 install -e .[dev]
.PHONY: package
package: target/package.target
upload: target/package-test.target
python3 -m twine upload target/package/*
target/package.target: setup.py README.md $(PY_SRC)
rm -fr $(@:.target=)
mkdir -p $(@:.target=)
./$< bdist_wheel -d $(@:.target=) sdist -d $(@:.target=)
> $@
target/package-test.target: target/package.target
mkdir -p $(@D)
python3 -m twine check target/package/*
mkdir -p $(@D)
> $@
###
# Docker
###
.PHONY: docker
docker:
docker build -t rivethealth/slice-db .
###
# Test
###
.PHONY: test
test: $(SCHEMA_TGT)
pytest