-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (101 loc) · 3.43 KB
/
Makefile
File metadata and controls
142 lines (101 loc) · 3.43 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
SHELL:=/bin/bash -O globstar
.SHELLFLAGS = -ec
.PHONY: build dist
.DEFAULT_GOAL := list
# this is just to try and supress errors caused by poetry run
export PYTHONWARNINGS=ignore:::setuptools.command.install
list:
@grep '^[^#[:space:]].*:' Makefile
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
########################################################################################################################
##
## Makefile for this project things
##
########################################################################################################################
pwd := ${PWD}
dirname := $(notdir $(patsubst %/,%,$(CURDIR)))
DOCKER_BUILDKIT ?= 1
ifneq (,$(wildcard ./.env))
include .env
export
endif
BUILDKIT_ARGS := COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) BUILDKIT_PROGRESS=plain
delete-hooks:
rm .git/hooks/pre-commit 2>/dev/null || true
rm .git/hooks/commit-msg 2>/dev/null || true
.git/hooks/pre-commit:
cp scripts/hooks/pre-commit.sh .git/hooks/pre-commit
.git/hooks/commit-msg:
cp scripts/hooks/commit-msg.sh .git/hooks/commit-msg
refresh-hooks: delete-hooks .git/hooks/pre-commit .git/hooks/commit-msg
install:
poetry install
poetry sync
install-ci:
poetry install --without local
poetry sync
update:
poetry update
down:
poetry run docker compose down --remove-orphans || true
up:
$(BUILDKIT_ARGS) poetry run docker compose up -d --remove-orphans --build
docker-build:
$(BUILDKIT_ARGS) poetry run docker compose build
mypy:
poetry run mypy . --exclude '(^|/)(build|dist|scripts)/.*\.py'
shellcheck:
@# Only swallow checking errors (rc=1), not fatal problems (rc=2)
docker run --rm -i -v ${PWD}:/mnt:ro koalaman/shellcheck -f gcc -e SC1090,SC1091 `find . \( -path "*/.venv/*" -prune -o -path "*/build/*" -prune -o -path "*/java_client/*" -prune \) -o -type f -name '*.sh' -print` || test $$? -eq 1
hadolint:
@docker run --rm -i -v ${PWD}/:/docker:ro hadolint/hadolint hadolint --config=docker/hadolint.yml docker/Dockerfile | sed 's/:\([0-9]\+\) /:\1:0 /'
ruff: black
poetry run ruff check --fix --show-fixes .
ruff-check:
poetry run ruff check .
ruff-ci:
poetry run ruff check --output-format=github .
lint: ruff mypy shellcheck hadolint
clean:
rm -rf ./dist || true
rm -rf ./reports || true
rm -f docker-compose.override.yml || true
rm -f .docker.env || true
find . -type d -name '.mypy_cache' | xargs rm -rf || true
find . -type d -name '.pytest_cache' | xargs rm -rf || true
find . -type d -name '__pycache__' | xargs rm -rf || true
find . -type f -name '.coverage' | xargs rm -rf || true
purge: clean
rm -rf .venv || true
find . -type f -name '.lock-hash' | xargs rm
make -C devops purge
make -C docker purge
make -C lambda purge
black-check:
poetry run black . --check
black:
poetry run black .
run-local:
poetry run uvicorn src.mesh_sandbox.api:app --reload --port 5201 --proxy-headers
coverage-cleanup:
rm -f .coverage* || true
coverage-ci-test:
poetry run coverage run -m pytest --color=yes -v --junit-xml=./reports/junit/mesh.xml
coverage-report:
@poetry run coverage report; \
poetry run coverage xml;
coverage: coverage-cleanup coverage-test coverage-report
coverage-test:
poetry run coverage run -m pytest
pytest:
poetry run pytest
test: pytest
coverage-ci: coverage-cleanup coverage-ci-test coverage-report
check-secrets:
scripts/check-secrets.sh
check-secrets-all:
scripts/check-secrets.sh unstaged