-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
73 lines (51 loc) · 1.73 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
RUN = poetry run
VERSION = $(shell git tag | tail -1)
MODELS = cadsr frictionless
.PHONY: all clean test all-docs sphinx-html
all: clean test
test:
$(RUN) pytest tests/
schema_automator/metamodels/%.py: schema_automator/metamodels/%.yaml
$(RUN) gen-python $< > [email protected] && mv [email protected] $@
# create a convenient wrapper script;
# this can be used outside the poetry environment
bin/schemauto:
echo `poetry run which schemauto` '"$$@"' > $@ && chmod +x $@
########################
#### Metamodel docs ####
########################
all-docs: $(patsubst %,docs-%,$(MODELS))
docs-dosdp: schema_automator/metamodels/dosdp/dosdp_linkml.yaml
$(RUN) gen-doc -d docs/metamodels/dosdp $<
docs-%: schema_automator/metamodels/%.yaml
$(RUN) gen-doc -d docs/metamodels/$* $<
sphinx-%:
cd docs && $(RUN) make $*
.PHONY: sphinx-%
################################################
#### Commands for building the Docker image ####
################################################
IM=linkml/schema-automator
docker-build-no-cache:
@docker build --no-cache -t $(IM):$(VERSION) . \
&& docker tag $(IM):$(VERSION) $(IM):latest
docker-build:
@docker build -t $(IM):$(VERSION) . \
&& docker tag $(IM):$(VERSION) $(IM):latest
docker-build-use-cache-dev:
@docker build -t $(DEV):$(VERSION) . \
&& docker tag $(DEV):$(VERSION) $(DEV):latest
docker-clean:
docker kill $(IM) || echo not running ;
docker rm $(IM) || echo not made
docker-publish-no-build:
@docker push $(IM):$(VERSION) \
&& docker push $(IM):latest
docker-publish-dev-no-build:
@docker push $(DEV):$(VERSION) \
&& docker push $(DEV):latest
docker-publish: docker-build
@docker push $(IM):$(VERSION) \
&& docker push $(IM):latest
docker-run:
@docker run -v $(PWD):/work -w /work -ti $(IM):$(VERSION)