-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 1.91 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
PYTHON ?= python3
PREF_SHELL ?= bash
GITREF=$(shell git rev-parse --short HEAD)
GITREF_FULL=$(shell git rev-parse HEAD)
PYTEST_OPTS ?= -s -vvv
PYTEST_DIR ?= tests
DOT_ENV ?= ./.env
####################################
# Docker image & dist
####################################
VERSION = $(shell poetry version --short)
PKG = $(shell poetry version | awk '{print $$1}')
PKGL = $(shell echo $(PKG) | tr '[:upper:]' '[:lower:]')
IMAGE_ORG ?= tacc
IMAGE_NAME ?= $(PKGL)
IMAGE_TAG ?= $(VERSION)
IMAGE_DOCKER ?= $(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_TAG)
####################################
# Build Docker image
####################################
.PHONY: image
image: Dockerfile
docker build -t $(IMAGE_DOCKER) -f $< .
####################################
# Tests
####################################
.PHONY: pytest-docker test-cli-docker tests shell clean
tests: test-cli-docker pytest-docker pytest-native
pytest-native tox:
tox --
pytest-docker: clean image
docker run --rm -t \
-v ${HOME}/.agave:/root/.agave \
-v ${PWD}/tests/data/abacoschemas:/schemas:ro \
-v ${PWD}/tests/data/message.jsonschema:/message.jsonschema:ro \
-v ${PWD}/$(PYTEST_DIR):/tmp/$(PKG)-$(VERSION)/$(PYTEST_DIR) \
$(IMAGE_DOCKER) \
bash -c "(python3 -m pip install -q pytest && python3 -m pytest $(PYTEST_OPTS) /tmp/$(PKG)-$(VERSION)/$(PYTEST_DIR))"
test-cli-docker: clean image
docker run --rm -t \
-v ${HOME}/.agave:/root/.agave \
$(IMAGE_DOCKER) \
bash -c "(python3 -m reactors.cli usage && python3 -m reactors.cli run)"
shell: image
docker run --rm -it \
-v ${HOME}/.agave:/root/.agave \
-v ${PWD}/tests/data/abacoschemas:/schemas:ro \
-v ${PWD}/tests/data/message.jsonschema:/message.jsonschema:ro \
$(IMAGE_DOCKER) bash
clean:
rm -rf .hypothesis .pytest_cache __pycache__ */__pycache__ tmp.* *junit.xml
####################################
# Sphinx Docs
####################################
.PHONY: docs
docs:
cd docsrc && make html