-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (85 loc) · 2.86 KB
/
Copy pathMakefile
File metadata and controls
120 lines (85 loc) · 2.86 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
SHELL:=$(shell which bash) -o pipefail -O globstar
.SHELLFLAGS = -ec
.PHONY: build dist
.DEFAULT_GOAL := list
# this is just to try and supress errors caused by uv run
export PYTHONWARNINGS=ignore:::setuptools.command.install
make := make --no-print-directory
list:
@grep '^[^#[:space:]].*:' Makefile
guard-%:
@if [[ "${${*}}" == "" ]]; then \
echo "env var: $* 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
.venv/:
uv venv --python="$$(python --version | cut -d ' ' -f2)"
install: .venv/
uv sync --frozen
install-ci:
uv sync --frozen --no-group local
local-terraform:
$(make) -C terraform/stacks/local
clean:
rm -rf ./build
rm -rf ./dist
rm -rf ./reports
find . -type d -name '.mypy_cache' | xargs -r rm -r || true
.env:
touch .env
pytest: .env
uv run pytest
test: pytest
reports/:
mkdir -p reports
coverage: .env
uv run pytest --cov --color=yes -v --cov-report=term-missing:skip-covered
coverage-ci: clean .env reports/
uv run pytest --cov --color=yes -v --junit-xml=./reports/junit/results.xml --cov-report=term-missing:skip-covered --cov-report xml | tee reports/pytest-coverage.txt
tf-lint:
tflint --config "$(pwd)/.tflint.hcl"
tf-format-check:
terraform fmt -check -recursive
tf-format:
terraform fmt --recursive
tf-trivy:
#trivy conf --exit-code 1 ./ --skip-dirs "**/.terraform" --skip-dirs ".venv"
mypy:
uv run mypy .
shellcheck:
@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 "*/dist/*" -prune -o -path "*/.tox/*" -prune \) -o -type f -name '*.sh' -print`
ruff: black
uv run ruff check . --fix --show-fixes
ruff-check:
uv run ruff check .
ruff-ci:
uv run ruff check . --output-format=github
black:
uv run black .
black-check:
uv run black . --check
lint: ruff mypy shellcheck
lint-ci: black-check ruff-ci mypy tf-lint tf-trivy shellcheck
check-secrets:
scripts/check-secrets.sh
check-secrets-all:
scripts/check-secrets.sh unstaged
check-secrets-history:
scripts/check-secrets.sh history
clean:
rm -rf ./dist
dist: clean
rsync -av ./ --exclude .git --exclude .venv --exclude .idea --exclude .github --exclude .pytest_cache --exclude .ruff_cache --exclude __pycache__ --exclude .mypy_cache --exclude dist --exclude reports --exclude tests --exclude scripts --exclude Makefile --exclude sonar-project.properties --exclude '.*' --exclude '*.md' --exclude '*.yaml' --exclude '*.toml' ./ ./dist
pushd ./dist && zip -r ../dist.zip . && popd