-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
34 lines (28 loc) · 846 Bytes
/
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
PYTHON ?= $(shell which python3 || which python)
PIP ?= $(shell which pip3 || which pip)
PG_VERSION ?= pg17
.PHONY: build
build:
@cargo build
.PHONY: run
run:
@cargo pgrx run
.PHONY: clean
clean:
@cargo clean
.PHONY: init
init:
@cargo install --locked [email protected]
@if ! cargo pgrx info version $(PG_VERSION) >/dev/null 2>&1; then cargo pgrx init --$(PG_VERSION) download; else echo "$(PG_VERSION) already installed"; fi
.PHONY: lint
lint:
@cargo fmt --check
@cargo clippy --no-default-features --features $(PG_VERSION)
.PHONY: test
test:
@if [ -z "$(PYTHON)" ]; then echo "python3 or python not found"; exit 1; fi
@if [ -z "$(PIP)" ]; then echo "pip3 or pip not found"; exit 1; fi
@$(PIP) install aiosmtpd
@trap 'kill `cat /tmp/smtpd.pid`' EXIT; \
$(PYTHON) -m aiosmtpd -n & echo $$! > /tmp/smtpd.pid; \
cargo pgrx test