1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00

Fix Makefile

This commit is contained in:
Artem Litvinov 2023-09-16 10:49:55 +01:00
parent 397c50ebea
commit 296eaa273a
2 changed files with 488 additions and 624 deletions

View File

@ -1,114 +1,3 @@
IMAGE_REGISTRY=ghcr.io/yp-middle-python-24 include ../../common_makefile.mk
IMAGE_REPOSITORY=python-service-example-backend
PENV = .venv PROJECT_FOLDERS = bin lib tests
NENV = ../node_modules
PYTHON = $(PENV)/bin/python
PYRIGHT = $(NENV)/.bin/pyright
TOML_SORT = $(PENV)/bin/toml-sort
PROJECT_FOLDERS = bin lib tests
.PHONY: init
init:
@echo 'Installing python dependencies...'
@poetry install
.PHONY: lint
lint:
@echo 'Running poetry checks...'
@poetry check
@echo 'Running black checks...'
@$(PYTHON) -m black --check .
@echo 'Running isort checks...'
@$(PYTHON) -m isort --check .
@echo 'Running toml-sort checks...'
@$(TOML_SORT) --check poetry.toml pyproject.toml
@echo ''
@echo 'Running pylint checks...'
@$(PYTHON) -m pylint .
@echo 'Running pyright checks...'
@$(PYRIGHT)
.PHONY: lint-fix
lint-fix:
@echo 'Running poetry autofixes...'
@poetry check
@poetry lock --no-update
@echo 'Running black autofixes...'
@$(PYTHON) -m black --safe .
@echo 'Running isort autofixes...'
@$(PYTHON) -m isort --atomic .
@echo 'Running toml-sort autofixes...'
@$(TOML_SORT) --in-place poetry.toml pyproject.toml
@echo 'Running sort-all autofixes...'
@find $(PROJECT_FOLDERS) -name '*.py' -type f -exec $(PYTHON) -m sort_all '{}' \;
@echo 'Running pyupgrade autofixes...'
@find $(PROJECT_FOLDERS) -name '*.py' -type f -exec $(PYTHON) -m pyupgrade --py310-plus '{}' \;
@echo 'Running pylint checks...'
@$(PYTHON) -m pylint .
@echo 'Running pyright checks...'
@$(PYRIGHT)
.PHONY: test
test:
@echo 'Running tests...'
@#$(PYTHON) -m pytest tests
.PHONY: clean
clean:
@echo 'Cleaning python dependencies...'
@rm -rf $(PENV)
@echo 'Cleaning pytest cache...'
@rm -rf .pytest_cache
@echo 'Cleaning coverage results...'
@rm -rf .coverage
@rm -rf htmlcov
# Local development
.PHONY: dev-server-start
dev-server-start:
@$(PYTHON) -m bin.main
# Test coverage
.PHONY: test-coverage-run
test-coverage-run:
@echo 'Running test coverage...'
@$(PYTHON) -m coverage run -m pytest tests
.PHONY: test-coverage-report
test-coverage-report:
@$(PYTHON) -m coverage report -m
.PHONY: test-coverage-html
test-coverage-html:
@$(PYTHON) -m coverage html
@$(PYTHON) -m webbrowser -t htmlcov/index.html
# CI-specific
.PHONY: ci-image-build
ci-image-build:
@echo 'Building image...'
@docker build --tag $(IMAGE_REGISTRY)/$(IMAGE_REPOSITORY):$(IMAGE_TAG) .
.PHONY: ci-image-push
ci-image-push:
@echo 'Uploading image...'
@docker push $(IMAGE_REGISTRY)/$(IMAGE_REPOSITORY):$(IMAGE_TAG)

File diff suppressed because it is too large Load Diff