-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
Makefile
102 lines (83 loc) · 2.25 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
export SETUPTOOLS_SCM_PRETEND_VERSION ?= 0.0.0
.PHONY: dependencies
dependencies:
uv sync --no-install-project --all-extras --frozen
.PHONY: upgrade
upgrade:
uv sync --no-install-project --all-extras --upgrade
.PHONY: build
build: clean
uv run python3 -m build
.PHONY: clean
clean:
rm -rf build dist
.PHONY: fix
fix:
uv run ruff format .
uv run ruff check --fix .
.PHONY: check-lint
check-lint:
uv run ruff format --check .
uv run ruff check .
.PHONY: check-type
check-type:
uv run mypy dbtmetabase
.PHONY: check
check: check-lint check-type
.PHONY: test
test:
rm -rf tests/tmp
uv run pytest tests
.PHONY: pre
pre: fix check test
.PHONY: dist-check
dist-check: build
uv run twine check dist/*
.PHONY: dist-upload
dist-upload: check
uv run twine upload dist/*
.PHONY: install
install: build
uv pip uninstall dbt-metabase \
&& uv pip install dist/dbt_metabase-*-py3-none-any.whl
.PHONY: sandbox-up
sandbox-up:
( cd sandbox && docker compose up --build --attach app )
.PHONY: sandbox-up
sandbox-down:
( cd sandbox && docker compose down )
.PHONY: sandbox-models
sandbox-models:
( . sandbox/.env && uv run python3 -m dbtmetabase models \
--manifest-path sandbox/target/manifest.json \
--metabase-url http://localhost:$$MB_PORT \
--metabase-username $$MB_USER \
--metabase-password $$MB_PASSWORD \
--metabase-database $$POSTGRES_DB \
--include-schemas "pub*",inventory \
--http-header x-dummy-key dummy-value \
--order-fields \
--verbose )
.PHONY: sandbox-exposures
sandbox-exposures:
rm -rf sandbox/models/exposures
mkdir -p sandbox/models/exposures
( . sandbox/.env && uv run python3 -m dbtmetabase exposures \
--manifest-path sandbox/target/manifest.json \
--metabase-url http://localhost:$$MB_PORT \
--metabase-username $$MB_USER \
--metabase-password $$MB_PASSWORD \
--output-path sandbox/models/exposures \
--output-grouping collection \
--tag metabase \
--verbose )
( . sandbox/.env && cd sandbox && \
POSTGRES_HOST=localhost \
POSTGRES_PORT=$$POSTGRES_PORT \
POSTGRES_USER=$$POSTGRES_USER \
POSTGRES_PASSWORD=$$POSTGRES_PASSWORD \
POSTGRES_DB=$$POSTGRES_DB \
POSTGRES_SCHEMA=$$POSTGRES_SCHEMA \
uv run dbt docs generate )
.PHONY: sandbox-e2e
sandbox-e2e: sandbox-up sandbox-models sandbox-exposures sandbox-down