-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (106 loc) · 4.34 KB
/
Copy pathMakefile
File metadata and controls
134 lines (106 loc) · 4.34 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
.PHONY: develop setup-git test
apply-migrations:
snuba migrations migrate --force
.PHONY: apply-migrations
reset-python:
pre-commit clean
rm -rf .venv
.PHONY: reset-python
develop:
devenv sync
@# devenv sync is meant to quickly install deps
@# building rust_snuba is left to maturin develop
make install-rs-dev
test:
SNUBA_SETTINGS=test pytest -vv tests -v -m "not ci_only"
test-distributed-migrations:
docker build . -t snuba-test
SNUBA_IMAGE=snuba-test docker-compose --profile multi_node -f docker-compose.gcb.yml down
SNUBA_IMAGE=snuba-test SNUBA_SETTINGS=test_distributed_migrations docker-compose --profile multi_node -f docker-compose.gcb.yml up -d
SNUBA_IMAGE=snuba-test SNUBA_SETTINGS=test_distributed_migrations TEST_LOCATION=test_distributed_migrations docker-compose --profile multi_node -f docker-compose.gcb.yml run --rm snuba-test
test-initialization:
docker build . -t snuba-test
SNUBA_IMAGE=snuba-test docker-compose -f docker-compose.gcb.yml down
SNUBA_IMAGE=snuba-test SNUBA_SETTINGS=test_initialization docker-compose -f docker-compose.gcb.yml up -d
SNUBA_IMAGE=snuba-test SNUBA_SETTINGS=test_initialization TEST_LOCATION=test_initialization docker-compose -f docker-compose.gcb.yml run --rm snuba-test
test-distributed:
docker build . -t snuba-test
SNUBA_IMAGE=snuba-test docker-compose -f docker-compose.gcb.yml down
SNUBA_IMAGE=snuba-test SNUBA_SETTINGS=test_distributed docker-compose -f docker-compose.gcb.yml run --rm snuba-test
tests: test
lint:
uv run ruff check --fix .
uv run ruff format .
.PHONY: lint
lint-check:
uv run ruff check .
uv run ruff format --check .
.PHONY: lint-check
typecheck:
uv run mypy .
.PHONY: typecheck
api-tests:
SNUBA_SETTINGS=test pytest -vv tests/*_api.py
install-rs-dev:
@which cargo || (echo "!!! You need an installation of Rust in order to develop snuba. Go to https://rustup.rs to get one." && exit 1)
. scripts/rust-envvars && cd rust_snuba/ && uvx maturin develop
.PHONY: install-rs-dev
snubadocs:
uv run --locked --no-default-groups --group docs sphinx-build -W -b html docs/source docs/build
build-admin:
cd snuba/admin && yarn install && yarn run build
watch-admin:
cd snuba/admin && yarn install && yarn run watch
test-admin:
cd snuba/admin && yarn install && yarn run test
SNUBA_SETTINGS=test pytest -vv tests/admin/
test-frontend-admin:
cd snuba/admin && yarn install && yarn run test
validate-configs:
uv run python snuba/validate_configs.py
generate-config-docs:
uv run --locked --no-default-groups --group docs python -m snuba.datasets.configuration.generate_config_docs
watch-rust-snuba:
which cargo-watch || cargo install cargo-watch
. scripts/rust-envvars && \
cd rust_snuba/ && cargo watch -s "uvx maturin develop"
.PHONY: watch-rust-snuba
test-rust:
. scripts/rust-envvars && \
cd rust_snuba && \
cargo test --workspace
.PHONY: test-rust
lint-rust:
. scripts/rust-envvars && \
cd rust_snuba && \
cargo clippy --workspace --all-targets --no-deps -- -D warnings
.PHONY: lint-rust
format-rust:
. scripts/rust-envvars && \
cd rust_snuba && \
cargo fmt --all
.PHONY: format-rust
format-rust-ci:
. scripts/rust-envvars && \
cd rust_snuba && \
cargo fmt --all --check
.PHONY: format-rust-ci
gocd:
rm -rf ./gocd/generated-pipelines
mkdir -p ./gocd/generated-pipelines
cd ./gocd/templates && jb install && jb update
find . -type f \( -name '*.libsonnet' -o -name '*.jsonnet' \) -print0 | xargs -n 1 -0 jsonnetfmt -i
find . -type f \( -name '*.libsonnet' -o -name '*.jsonnet' \) -print0 | xargs -n 1 -0 jsonnet-lint -J ./gocd/templates/vendor
cd ./gocd/templates && jsonnet --ext-code output-files=true -J vendor -m ../generated-pipelines ./snuba-py.jsonnet
cd ./gocd/templates && jsonnet --ext-code output-files=true -J vendor -m ../generated-pipelines ./snuba-rs.jsonnet
cd ./gocd/generated-pipelines && find . -type f \( -name '*.yaml' \) -print0 | xargs -n 1 -0 yq -p json -o yaml -i
.PHONY: gocd
install-proto-dev:
devenv sync && \
uv pip install -e ../sentry-protos/py --config-settings editable_mode=compat && \
echo "Installed local sentry-protos, please restart the vscode language server. Run 'uv pip uninstall sentry-protos && uv sync' to go back to the original version."
.PHONY: install-proto-dev
# Dumps the DogStatsD payloads snuba emits; see the script's --help to point snuba at it.
listen-metrics:
uv run python scripts/listen-metrics.py
.PHONY: listen-metrics