mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-12-16 19:56:18 +00:00
init commit
This commit is contained in:
108
common_makefile.mk
Normal file
108
common_makefile.mk
Normal file
@@ -0,0 +1,108 @@
|
||||
PENV = .venv
|
||||
NENV = ../../node_modules
|
||||
|
||||
PYTHON = $(PENV)/bin/python
|
||||
PYRIGHT = $(NENV)/.bin/pyright
|
||||
TOML_SORT = $(PENV)/bin/toml-sort
|
||||
|
||||
VERSION = $(shell poetry version --short)
|
||||
|
||||
.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 ''
|
||||
|
||||
@echo 'Running isort autofixes...'
|
||||
@$(PYTHON) -m isort --atomic .
|
||||
@echo ''
|
||||
|
||||
@echo 'Running toml-sort autofixes...'
|
||||
@$(TOML_SORT) --in-place poetry.toml pyproject.toml
|
||||
@echo ''
|
||||
|
||||
@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 --py311-plus --keep-runtime-typing '{}' \;
|
||||
|
||||
@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 dist packages...'
|
||||
@rm -rf dist
|
||||
|
||||
@echo 'Cleaning pytest cache...'
|
||||
@rm -rf .pytest_cache
|
||||
|
||||
.PHONY: dependencies-update
|
||||
dependencies-update:
|
||||
@echo 'Updating python dependencies...'
|
||||
@poetry update
|
||||
|
||||
# CI-specific
|
||||
|
||||
.PHONY: ci-login-pypi-publish
|
||||
ci-login-pypi-publish:
|
||||
@echo 'Logging poetry pypi-writer...'
|
||||
@poetry config repositories.ovsds-pypi-publish https://pypi.ovsds.ru/simple
|
||||
@poetry config http-basic.ovsds-pypi-publish 'writer' '$(PYPI_WRITER_PASSWORD)'
|
||||
|
||||
.PHONY: ci-test
|
||||
ci-test:
|
||||
@echo 'Running tests...'
|
||||
@$(PYTHON) -m pytest tests
|
||||
|
||||
.PHONY: ci-package-build
|
||||
ci-package-build:
|
||||
@echo 'Building package...'
|
||||
@poetry build --no-interaction
|
||||
|
||||
.PHONY: ci-package-publish
|
||||
ci-package-publish:
|
||||
@echo 'Uploading package...'
|
||||
@poetry publish --repository ovsds-pypi-publish --no-interaction
|
||||
Reference in New Issue
Block a user