-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
116 lines (99 loc) · 4.79 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
114
115
116
default:
.PHONY: update-deps
update-deps:
pip install --upgrade pip-tools pip setuptools
pip-compile --upgrade --build-isolation --generate-hashes --output-file requirements/main.txt requirements/main.in
pip-compile --upgrade --build-isolation --generate-hashes --output-file requirements/dev.txt requirements/dev.in
# Useful for testing against a Git version of Safir.
.PHONY: update-deps-no-hashes
update-deps-no-hashes:
pip install --upgrade pip-tools pip setuptools
pip-compile --upgrade --build-isolation --allow-unsafe --output-file requirements/main.txt requirements/main.in
pip-compile --upgrade --build-isolation --allow-unsafe --output-file requirements/dev.txt requirements/dev.in
.PHONY: init
init:
pip install --editable .
pip install --upgrade -r requirements/main.txt -r requirements/dev.txt
playwright install
pip install --upgrade pre-commit
pre-commit install
.PHONY: update
update: update-deps init
.PHONY: lint
lint:
pre-commit run --all-files
.PHONY: typing
typing:
mypy src tests
.PHONY: psql
psql: CM_DATABASE_PORT=$(shell docker compose port postgresql 5432 | cut -d: -f2)
psql: export CM_DATABASE_PASSWORD=INSECURE-PASSWORD
psql:
psql postgresql://cm-service:${CM_DATABASE_PASSWORD}@localhost:${CM_DATABASE_PORT}/cm-service
.PHONY: psql-usdf-dev
psql-usdf-dev: CM_DATABASE_HOST=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get svc/cm-pg-lb -o jsonpath='{..ingress[0].ip}')
psql-usdf-dev: CM_DATABASE_PASSWORD=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get secret/cm-pg-app -o jsonpath='{.data.password}' | base64 --decode)
psql-usdf-dev:
psql postgresql://cm-service:${CM_DATABASE_PASSWORD}@${CM_DATABASE_HOST}:5432/cm-service
.PHONY: test
test: CM_DATABASE_PORT=$(shell docker compose port postgresql 5432 | cut -d: -f2)
test: export CM_DATABASE_URL=postgresql://cm-service@localhost:${CM_DATABASE_PORT}/cm-service
test: export CM_DATABASE_PASSWORD=INSECURE-PASSWORD
test: export CM_DATABASE_SCHEMA=cm_service_test
test: run-compose
cm-service init
pytest -vvv --asyncio-mode=auto --cov=lsst.cmservice --cov-branch --cov-report=term --cov-report=html ${PYTEST_ARGS}
.PHONY: test-usdf-dev
test-usdf-dev: CM_DATABASE_HOST=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get svc/cm-pg-lb -o jsonpath='{..ingress[0].ip}')
test-usdf-dev: export CM_DATABASE_URL=postgresql://cm-service@${CM_DATABASE_HOST}:5432/cm-service
test-usdf-dev: export CM_DATABASE_PASSWORD=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get secret/cm-pg-app -o jsonpath='{.data.password}' | base64 --decode)
test-usdf-dev: export CM_DATABASE_SCHEMA=cm_service_test
test-usdf-dev:
pytest -vvv --cov=lsst.cmservice --cov-branch --cov-report=term --cov-report=html ${PYTEST_ARGS}
.PHONY: run-compose
run-compose:
docker compose up --wait
.PHONY: run
run: CM_DATABASE_PORT=$(shell docker compose port postgresql 5432 | cut -d: -f2)
run: export CM_DATABASE_URL=postgresql://cm-service@localhost:${CM_DATABASE_PORT}/cm-service
run: export CM_DATABASE_PASSWORD=INSECURE-PASSWORD
run: export CM_DATABASE_ECHO=true
run: run-compose
cm-service init
cm-service run
.PHONY: run-worker
run-worker: CM_DATABASE_PORT=$(shell docker compose port postgresql 5432 | cut -d: -f2)
run-worker: export CM_DATABASE_URL=postgresql://cm-service@localhost:${CM_DATABASE_PORT}/cm-service
run-worker: export CM_DATABASE_PASSWORD=INSECURE-PASSWORD
run-worker: export CM_DATABASE_ECHO=true
run-worker: run-compose
cm-service init
cm-worker
.PHONY: run-worker-usdf-dev
run-worker-usdf-dev: CM_DATABASE_HOST=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get svc/cm-pg-lb -o jsonpath='{..ingress[0].ip}')
run-worker-usdf-dev: export CM_DATABASE_URL=postgresql://cm-service@${CM_DATABASE_HOST}:5432/cm-service
run-worker-usdf-dev: export CM_DATABASE_PASSWORD=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get secret/cm-pg-app -o jsonpath='{.data.password}' | base64 --decode)
run-worker-usdf-dev: export CM_DATABASE_ECHO=true
run-worker-usdf-dev: run-compose
cm-service init
cm-worker
.PHONY: run-usdf-dev
run-usdf-dev: CM_DATABASE_HOST=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get svc/cm-pg-lb -o jsonpath='{..ingress[0].ip}')
run-usdf-dev: export CM_DATABASE_URL=postgresql://cm-service@${CM_DATABASE_HOST}:5432/cm-service
run-usdf-dev: export CM_DATABASE_PASSWORD=$(shell kubectl --cluster=usdf-cm-dev -n cm-service get secret/cm-pg-app -o jsonpath='{.data.password}' | base64 --decode)
run-usdf-dev: export CM_DATABASE_ECHO=true
run-usdf-dev:
cm-service init
cm-service run
.PHONY: run-sqlite
run-sqlite: export CM_DATABASE_URL=sqlite+aiosqlite://///test_cm.db
run-sqlite: export CM_DATABASE_ECHO=true
run-sqlite:
cm-service init
cm-service run
.PHONY: run-worker-sqlite
run-worker-sqlite: export CM_DATABASE_URL=sqlite+aiosqlite://///test_cm.db
run-worker-sqlite: export CM_DATABASE_ECHO=true
run-worker-sqlite:
cm-service init
cm-worker