-
Notifications
You must be signed in to change notification settings - Fork 2
/
run
executable file
·73 lines (58 loc) · 1.47 KB
/
run
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
#!/usr/bin/env bash
set -eo pipefail
export DBT_PROFILES_DIR=./integration_tests/profiles
export DBT_PROJECT_DIR=./integration_tests
export DO_NOT_TRACK=1
if [ -f .env ]; then
# shellcheck disable=SC2002,SC2046
export $(cat .env | xargs)
fi
function dbt {
uv run dbt "${@}"
}
function setup {
uv sync --all-extras
uvx pre-commit install
}
function docker-run-clickhouse {
docker run \
-d \
-p 8123:8123 \
--name dbt-linreg-clickhouse \
--ulimit nofile=262144:262144 \
clickhouse/clickhouse-server
}
function test {
local target="${1-"duckdb"}"
if [ -z "${GITHUB_ACTIONS}" ] && [ "${target}" = "postgres" ];
then
createdb "${POSTGRES_DB-"dbt_linreg"}" || true
fi
if [ "${target}" = "clickhouse" ];
then
docker-run-clickhouse || true
fi
if [ -z "${GITHUB_ACTIONS}" ] && [ "${target}" = "duckdb" ];
then
rm -f dbt.duckdb
fi
uv run scripts.py gen-test-cases
dbt deps --target "${target}"
dbt seed --target "${target}"
dbt run --target "${target}" --selector "${target}-selector"
dbt test --target "${target}" --selector "${target}-selector" --store-failures
}
function lint {
uv run pre-commit run -a
}
function docs:deploy {
# shellcheck disable=SC2046
uv run $(xargs -I{} echo --with {} < docs/requirements.txt) mkdocs gh-deploy -f docs/mkdocs.yml
}
function help {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"