forked from TrueCloudLab/frostfs-testlib
50 lines
No EOL
1.4 KiB
Makefile
50 lines
No EOL
1.4 KiB
Makefile
SHELL := /bin/bash
|
|
PYTHON_VERSION := 3.10
|
|
VENV_NAME := frostfs-testlib
|
|
VENV_DIR := venv.${VENV_NAME}
|
|
|
|
current_dir := $(shell pwd)
|
|
DIRECTORIES := $(sort $(dir $(wildcard ../frostfs-testlib-plugin-*/ ../*-testcases/)))
|
|
FROM_VENV := . ${VENV_DIR}/bin/activate &&
|
|
|
|
venv: create requirements paths precommit
|
|
@echo Ready
|
|
|
|
precommit:
|
|
@echo Isntalling pre-commit hooks
|
|
. ${VENV_DIR}/bin/activate && pre-commit install
|
|
|
|
paths:
|
|
@echo Append paths for project
|
|
@echo Virtual environment: ${current_dir}/${VENV_DIR}
|
|
@rm -rf ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth
|
|
@touch ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth
|
|
@echo ${current_dir}/src/frostfs_testlib | tee ${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/_paths.pth
|
|
|
|
create: ${VENV_DIR}
|
|
|
|
${VENV_DIR}:
|
|
@echo Create virtual environment ${current_dir}/${VENV_DIR}
|
|
virtualenv --python=python${PYTHON_VERSION} --prompt=${VENV_NAME} ${VENV_DIR}
|
|
|
|
requirements:
|
|
@echo Isntalling pip requirements
|
|
. ${VENV_DIR}/bin/activate && pip install -Ur requirements.txt
|
|
|
|
|
|
#### VALIDATION SECTION ####
|
|
lint: create requirements
|
|
${FROM_VENV} pylint --disable R,C,W ./src
|
|
|
|
unit_test:
|
|
@echo Starting unit tests
|
|
${FROM_VENV} python -m pytest tests
|
|
|
|
.PHONY: lint_dependent $(DIRECTORIES)
|
|
lint_dependent: $(DIRECTORIES)
|
|
|
|
$(DIRECTORIES):
|
|
@echo checking dependent repo $@
|
|
$(MAKE) validation -C $@
|
|
|
|
validation: lint unit_test lint_dependent |