-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (99 loc) · 3.67 KB
/
Makefile
File metadata and controls
130 lines (99 loc) · 3.67 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
#!make
include .env.local
SPARK_EXTERNAL_IP := $(shell docker network inspect onetl_onetl --format '{{ (index .IPAM.Config 0).Gateway }}')
VERSION := $(shell cat onetl/VERSION)
DATE := $(shell date --rfc-3339=date)
SPARK_VERSION ?= 3.5
VIRTUAL_ENV ?= .venv
PYTHON = ${VIRTUAL_ENV}/bin/python
PIP = ${VIRTUAL_ENV}/bin/pip
UV ?= ${VIRTUAL_ENV}/bin/uv
PYTEST ?= pytest
# Fix docker build and docker compose build using different backends
COMPOSE_DOCKER_CLI_BUILD = 1
DOCKER_BUILDKIT = 1
# Fix docker build on M1/M2
DOCKER_DEFAULT_PLATFORM = linux/amd64
HELP_FUN = \
%help; while(<>){push@{$$help{$$2//'options'}},[$$1,$$3] \
if/^([\w-_]+)\s*:.*\#\#(?:@(\w+))?\s(.*)$$/}; \
print"$$_:\n", map" $$_->[0]".(" "x(20-length($$_->[0])))."$$_->[1]\n",\
@{$$help{$$_}},"\n" for keys %help; \
all: help
help: ##@Help Show this help
@echo -e "Usage: make [target] ...\n"
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
venv: venv-cleanup venv-install##@Env Init venv and install uv dependencies
venv-cleanup: ##@Env Cleanup venv
@rm -rf ${VIRTUAL_ENV} || true
python3 -m venv ${VIRTUAL_ENV}
${PIP} install uv
venv-install: ##@Env Install requirements to venv
${UV} sync \
--inexact \
--all-extras \
--group dev \
--group docs \
--group test \
--group test-clickhouse \
--group test-mongodb \
--group test-mssql \
--group test-mysql \
--group test-oracle \
--group test-postgres \
--group test-spark-${SPARK_VERSION} \
$(UV_ARGS)
${UV} pip install --no-deps sphinx-plantuml
test-spark: ##@Run tests with Spark
uv run \
$(UV_ARGS) \
--group test \
--group test-spark-${SPARK_VERSION} \
${PYTEST} \
$(PYTEST_ARGS)
test-no-spark: ##@Run tests without Spark installed
uv run \
$(UV_ARGS) \
--group test \
${PYTEST} \
$(PYTEST_ARGS)
test-core: ##@Run core tests
uv run \
$(UV_ARGS) \
--group test \
--group test-spark-${SPARK_VERSION} \
--with-editable tests/libs/dummy \
--with-editable tests/libs/failing \
${PYTEST} \
-m "not connection" \
$(PYTEST_ARGS)
test-doctest: ##@Run documentation tests
uv run \
$(UV_ARGS) \
--group test \
--group test-spark-${SPARK_VERSION} \
${PYTEST} \
--doctest-modules onetl/_util onetl/hooks onetl/file/filter onetl/file/limit onetl/hwm/store/hwm_class_registry.py \
$(PYTEST_ARGS)
.PHONY: docs
docs: docs-build docs-open ##@Docs Generate & open docs
docs-build: ##@Docs Generate docs
DISABLE_MKDOCS_2_WARNING=true mkdocs build -f mddocs/mkdocs.yml
docs-open: ##@Docs Open docs
xdg-open mddocs/generated/index.html
docs-cleanup: ##@Docs Cleanup docs
rm -rf mddocs/generated/
docs-fresh: docs-cleanup docs-build ##@Docs Cleanup & build docs
docs-serve: ##@Docs Run docs server
DISABLE_MKDOCS_2_WARNING=true mkdocs serve -f mddocs/mkdocs.yml
docs-generate-changelog: ##@Docs Generate changelog
echo "Building changelog for ${VERSION}"
cp "mddocs/docs/changelog/RELEASE_TEMPLATE.md" "mddocs/docs/changelog/temp_RELEASE_TEMPLATE.md"
towncrier build "--version=${VERSION}" --yes
mv "mddocs/docs/changelog/RELEASE_TEMPLATE.md" "mddocs/docs/changelog/${VERSION}.md"
mv "mddocs/docs/changelog/temp_RELEASE_TEMPLATE.md" "mddocs/docs/changelog/RELEASE_TEMPLATE.md"
# Remove content above the version number heading in the `${VERSION}.md` file
awk '/##/,0' "mddocs/docs/changelog/${VERSION}.md" > temp && mv temp "mddocs/docs/changelog/${VERSION}.md"
# Update Changelog Index and Navigation
sed "s#\(.*NEXT_RELEASE.*\)#\1\n- [${VERSION} (${DATE})][DBR-onetl-changelog-${VERSION_ANCHOR}]#" "mddocs/docs/changelog/index.md" > temp && mv temp "mddocs/docs/changelog/index.md"
sed "s#\(.*NEXT_RELEASE.*\)#\1\n * [${VERSION}](changelog/${VERSION}.md)#" "mddocs/docs/nav.md" > temp && mv temp "mddocs/docs/nav.md"