|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PROJECT_NAME = resume-maker-ai-agent |
|
GITHUB_USERNAME = DeepakPant93 |
|
GITHUB_REPO = $(PROJECT_NAME) |
|
PROJECT_SLUG = resume_maker_ai_agent |
|
CLOUD_REGION = eastus |
|
TAG = latest |
|
IMAGE_NAME = deepak93p/$(PROJECT_SLUG) |
|
RESOURCE_GROUP = $(PROJECT_NAME)-rg |
|
APP_NAME = $(PROJECT_NAME)-app |
|
APP_ENV_NAME = $(APP_NAME)-env |
|
BUMP_TYPE = patch |
|
|
|
|
|
|
|
|
|
.PHONY: help |
|
help: |
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}' |
|
|
|
.DEFAULT_GOAL := help |
|
|
|
|
|
|
|
|
|
.PHONY: bake-env |
|
bake-env: |
|
@echo "π Creating virtual environment using pyenv and poetry" |
|
@poetry install --all-extras |
|
@poetry run pre-commit install || true |
|
@max_retries=3; count=0; \ |
|
while ! make lint; do \ |
|
count=$$((count + 1)); \ |
|
if [ $$count -ge $$max_retries ]; then \ |
|
echo "Max retries reached. Exiting."; \ |
|
exit 1; \ |
|
fi; \ |
|
echo "Retrying make lint ($$count/$$max_retries)..."; \ |
|
done |
|
@poetry shell |
|
|
|
.PHONY: clean-env |
|
clean-env: |
|
@echo "π Removing virtual environment" |
|
@rm -rf .venv |
|
|
|
.PHONY: reset-env |
|
reset-env: clean-env bake-env |
|
|
|
.PHONY: init-repo |
|
init-repo: |
|
@echo "π Initializing git repository" |
|
@git init |
|
@echo "π Creating initial commit" |
|
@git add . |
|
@git commit -m "Initial commit" |
|
@echo "π Adding remote repository" |
|
@git branch -M main |
|
@git remote add origin git@github.com:$(GITHUB_USERNAME)/$(GITHUB_REPO).git |
|
@echo "π Pushing initial commit" |
|
@git push -u origin main |
|
|
|
|
|
|
|
|
|
|
|
.PHONY: lint |
|
lint: |
|
@echo "π Checking Poetry lock file consistency with 'pyproject.toml'" |
|
@poetry check --lock |
|
@echo "π Linting code with pre-commit" |
|
@poetry run pre-commit run -a |
|
@echo "π Static type checking with mypy" |
|
@poetry run mypy |
|
@echo "π Checking for obsolete dependencies with deptry" |
|
|
|
@echo "π Checking for security vulnerabilities with bandit" |
|
@poetry run bandit -c pyproject.toml -r resume_maker_ai_agent/ -ll |
|
|
|
|
|
.PHONY: test |
|
test: |
|
@echo "π Running tests with pytest" |
|
@poetry run pytest --cov --cov-config=pyproject.toml --cov-report=term-missing |
|
|
|
|
|
|
|
|
|
|
|
.PHONY: bake |
|
bake: clean-bake |
|
@echo "π Creating wheel file" |
|
@poetry build |
|
|
|
.PHONY: clean-bake |
|
clean-bake: |
|
@rm -rf dist |
|
|
|
.PHONY: bump |
|
bump: |
|
@echo "π Bumping version" |
|
@poetry run bump-my-version bump $(BUMP_TYPE) |
|
|
|
.PHONY: publish |
|
publish: |
|
@echo "π Publishing: Dry run" |
|
@poetry config pypi-token.pypi $(PYPI_TOKEN) |
|
@poetry publish --dry-run |
|
@echo "π Publishing" |
|
@poetry publish |
|
|
|
.PHONY: bake-and-publish |
|
bake-and-publish: bake publish |
|
|
|
.PHONY: update |
|
update: |
|
@echo "π Updating project dependencies" |
|
@poetry update |
|
@poetry run pre-commit install --overwrite |
|
@echo "Dependencies updated successfully" |
|
|
|
|
|
|
|
|
|
.PHONY: run |
|
run: |
|
@echo "π Running the project" |
|
@poetry run streamlit run $(PROJECT_SLUG)/app.py --server.port 7860 |
|
|
|
.PHONY: docs-test |
|
docs-test: |
|
@poetry run mkdocs build -s |
|
|
|
.PHONY: docs |
|
docs: |
|
@poetry run mkdocs serve |
|
|
|
|
|
|
|
|
|
.PHONY: bake-container |
|
bake-container: |
|
@echo "π Building Docker image" |
|
docker build -t $(IMAGE_NAME):$(TAG) -f Dockerfile . |
|
|
|
.PHONY: container-push |
|
container-push: |
|
@echo "π Pushing Docker image to Docker Hub" |
|
docker push $(IMAGE_NAME):$(TAG) |
|
|
|
.PHONY: bake-container-and-push |
|
bake-container-and-push: bake-container container-push |
|
|
|
.PHONY: clean-container |
|
clean-container: |
|
@echo "π Deleting Docker image for app: $(IMAGE_NAME)" |
|
@docker images $(IMAGE_NAME) --format "{{.Repository}}:{{.Tag}}" | xargs -r docker rmi -f || echo "No image to delete" |
|
|
|
@echo "π Deleting unused Docker volumes" |
|
@docker volume ls -qf dangling=true | xargs -r docker volume rm || echo "No unused volumes to delete" |
|
|
|
@echo "π Deleting unused Docker networks" |
|
@docker network ls -q --filter "dangling=true" | xargs -r docker network rm || echo "No unused networks to delete" |
|
|
|
@echo "π Cleaning up stopped containers" |
|
@docker ps -aq --filter "status=exited" | xargs -r docker rm || echo "No stopped containers to clean up" |
|
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: print-dependency-tree |
|
print-dependency-tree: |
|
@echo "Printing dependency tree..." |
|
@poetry run pipdeptree -p $(PACKAGE_NAME) |
|
|
|
|
|
|
|
|
|
|
|
.PHONY: teardown |
|
teardown: clean-bake clean-container |
|
@echo "π Cleaning up temporary files and directories" |
|
@rm -rf .pytest_cache || true |
|
@rm -rf dist || true |
|
@rm -rf build || true |
|
@rm -rf htmlcov || true |
|
@rm -rf .venv || true |
|
@rm -rf .mypy_cache || true |
|
@rm -rf site || true |
|
@find . -type d -name "__pycache__" -exec rm -rf {} + || true |
|
@rm -rf .ruff_cache || true |
|
@echo "π Clean up completed." |
|
|
|
.PHONY: teardown-all |
|
teardown-all: teardown |
|
|