-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
94 lines (74 loc) · 2.17 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
VERSION ?= `cat VERSION`
TEST_RESOURCES_VERSION ?= test
TEST_STORAGE = test_storage
STORAGE ?= storage/$(TEST_STORAGE)
.PHONY: tag
tag:
git tag -a $(VERSION) -m "version $(VERSION)"
git push origin $(VERSION)
#########
## DEV ##
#########
.PHONY: dev
dev:
pip install -r requirements.txt
pip install -e .
###########
## TESTS ##
###########
.PHONY: test
test: $(resources-test)
RESOURCES=resources/$(TEST_RESOURCES_VERSION) \
python -W ignore -m unittest discover -p "test*.py"
#flake8 aylien_timeseries --exclude schema_pb2.py
##########################
## DEV BUILD AND DEPLOY ##
##########################
# this is for our private repo, public users can
# modify args as needed for their artifact registries
REGION ?= europe-west1
PROJECT_ID ?= aylien-science
REPOSITORY_NAME ?= aylien-science
IMAGE_NAME ?= news-signals
TAG ?= $(shell git describe --tags --dirty --always)
IMAGE_URI ?= $(REGION)-docker.pkg.dev/$(PROJECT_ID)/$(REPOSITORY_NAME)/$(IMAGE_NAME):$(TAG)
.PHONY: build
build:
docker build --network host -t $(IMAGE_URI) -f Dockerfile .
.PHONY: push
push:
docker push $(IMAGE_URI)
.PHONY: container-test
container-test:
mkdir -p sample_dataset_output/
docker run \
-u $(shell id -u):$(shell id -g) \
-v $(shell pwd)/resources/dataset-config-example.json:/dataset-config-example.json \
-e DATASET_CONFIG=resources/dataset-config-example.json \
-v $(shell pwd)/sample_dataset_output:/srv/sample_dataset_output \
-e DATASET_CONFIG=/dataset-config-example.json \
-e NEWSAPI_APP_ID=$(NEWSAPI_APP_ID) \
-e NEWSAPI_APP_KEY=${NEWSAPI_APP_KEY} \
$(IMAGE_URI)
#################
# DOCUMENTATION #
#################
# build documentation
.PHONY: docs-build
docs-build:
mkdocs build
# runs local mkdocs server on port 8000
.PHONY: docs-serve
docs-serve:
mkdocs serve
# builds docs and pushes to gh-pages branch of repository
.PHONY: docs-gh-deploy
docs-gh-deploy:
mkdocs gh-deploy
######################
# DATASET GENERATION #
######################
DATASET_CONFIG ?= "resources/dataset-config-example.json"
.PHONY: create-dataset
create-dataset:
python bin/generate_dataset.py --config $(DATASET_CONFIG)