forked from sematic-ai/sematic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (76 loc) · 2.69 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
SHELL=/bin/bash
UNAME_S := $(shell uname -s)
RED := \033[0;31m
NO_COLOR := \033[1;0m
migrate_up_rds:
cd sematic; DATABASE_URL=${DATABASE_URL} dbmate -s db/schema.sql.pg up
migrate_up_sqlite:
bazel run //sematic/db:migrate -- up --verbose --env local --schema-file ${PWD}/sematic/db/schema.sql.sqlite
migrate_down_sqlite:
bazel run //sematic/db:migrate -- down --verbose --env local --schema-file ${PWD}/sematic/db/schema.sql.sqlite
clear_sqlite:
sqlite3 ~/.sematic/db.sqlite3 < sematic/db/scripts/clear_all.sql
install-dev-deps:
pip3 install -r requirements/ci-requirements.txt
pre-commit:
python3 -m flake8
python3 -m mypy sematic
python3 -m black sematic --check
python3 -m isort sematic --diff
pushd sematic/ui && npm run lint && popd
fix:
isort sematic
black sematic
# this is not supported on Mac because some of the dependencies that need to be pulled
# do not have a release version for Mac
refresh-dependencies:
ifeq ($(UNAME_S),Linux)
bazel run //requirements:requirements3_8.update
bazel run //requirements:requirements3_9.update
bazel run //requirements:requirements3_10.update
else
echo "${RED}Refreshing dependencies should only be done from Linux${NO_COLOR}"
exit 1
endif
.PHONY: ui
ui: sematic/ui/node_modules/.build_timestamp
cd sematic/ui; npm run build
sematic/ui/node_modules/.build_timestamp: sematic/ui/package.json
cd sematic/ui; npm install; touch -r ./package.json ./node_modules/.build_timestamp
worker-image:
cd docker; docker build -t sematicai/sematic-worker-base:latest -f Dockerfile.worker .
sematic/ui/build:
@$(MAKE) ui
wheel : sematic/ui/build
rm -f bazel-bin/sematic/*.whl
rm -f bazel-bin/sematic/ee/*.whl
cat README.md | \
grep -v "<img" | \
grep -v "<p" | \
grep -v "/p>" | \
grep -v "<h2" | \
grep -v "/h2>" | \
grep -v "<h3" | \
grep -v "/h3>" | \
grep -v "<a" | \
grep -v "/a>" | \
grep -v "/img>" > README.nohtml
python3 -m m2r --overwrite README.nohtml
rm README.nohtml
bazel build //sematic:wheel
test-release:
python3 -m twine check bazel-bin/sematic/*.whl
python3 -m twine upload --repository testpypi bazel-bin/sematic/*.whl
release:
python3 -m twine upload bazel-bin/sematic/*.whl
release-server:
rm -f docker/*.whl
cp bazel-bin/sematic/*.whl docker/
cd docker; docker build --build-arg EXTRA=default -t sematic/sematic-server:${TAG} -f Dockerfile.server .
docker push sematic/sematic-server:${TAG}
cd docker; docker build --build-arg EXTRA=all -t sematic/sematic-server-ee:${TAG} -f Dockerfile.server .
docker push sematic/sematic-server-ee:${TAG}
test:
bazel test //sematic/... --test_tag_filters=nocov --test_output=all
coverage:
bazel coverage //sematic/... --combined_report=lcov --test_tag_filters=cov --test_output=all