File: Makefile

package info (click to toggle)
ruby-spamcheck 1.10.1-2
  • links: PTS, VCS
  • area: contrib
  • in suites: sid, trixie
  • size: 668 kB
  • sloc: python: 1,261; ruby: 484; makefile: 54; sh: 13
file content (52 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download
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
# Set python virtual environment
export PIPENV_VENV_IN_PROJECT=1
VENV := ./.venv

SHELL = /usr/bin/env bash -eo pipefail

SPAMCHECK_PROTO_PATH := ${PWD}/api/v1
SPAMCHECK_PROTO      := ${SPAMCHECK_PROTO_PATH}/*.proto
RUBY_PROTO_PATH      := ${PWD}/ruby/spamcheck

deps: ${VENV}

${VENV}:
	pip install pipenv
	pipenv install --dev

# Generate Python protobuf files
proto:
	pipenv run python -m grpc_tools.protoc \
		--proto_path=${PWD} \
		--python_out=${PWD} \
		--grpc_python_out=${PWD} \
		${SPAMCHECK_PROTO}

# Generate Ruby protobuf files
proto_ruby:
	gem install bundler
	bundle install
	bundle exec grpc_tools_ruby_protoc \
		--proto_path=${SPAMCHECK_PROTO_PATH} \
		--ruby_out=${RUBY_PROTO_PATH} \
		--grpc_out=${RUBY_PROTO_PATH} \
		${SPAMCHECK_PROTO}

gem: proto proto_ruby
	gem build spamcheck.gemspec
	./tests/gem/test.sh || (rm -f spamcheck*.gem && exit 1)

lint: ${VENV} proto
	 pipenv run pylint --rcfile=.pylintrc *.py app server

test: ${VENV} proto
	ENV=test PYTHONDONTWRITEBYTECODE=1 pipenv run coverage run -m pytest -W ignore::DeprecationWarning
	pipenv run coverage report -m

run: ${VENV} proto
	pipenv run python main.py

clean:
	rm -rf ${SPAMCHECK_PROTO_PATH}/*.py

.PHONY: proto proto_ruby gem test run clean