-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 2.21 KB
/
Makefile
File metadata and controls
75 lines (59 loc) · 2.21 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.PHONY: help install install-dev test lint format run docker-build docker-run deploy pre-commit clean
help:
@echo "Makefile commands:"
@echo " install - Install production dependencies"
@echo " install-dev - Install development dependencies and pre-commit hooks"
@echo " test - Run tests"
@echo " test-cov - Run tests with coverage report"
@echo " lint - Lint the codebase"
@echo " format - Format the codebase"
@echo " ansible - Run Ansible linting"
@echo " act-ci - Run GitHub Actions workflows locally"
@echo " run - Run the FastAPI application"
@echo " docker-build - Build the Docker image"
@echo " docker-run - Run the Docker container"
@echo " deploy - Deploy the application"
@echo " pre-commit - Run pre-commit checks on all files"
@echo " clean - Clean up temporary files and directories"
install:
uv sync --no-dev
install-dev:
uv sync
uv run pre-commit install
test:
uv run pytest tests/ --maxfail=1 --disable-warnings -q
test-cov:
uv run pytest tests/ --cov=src/app --cov-report=term-missing --cov-report=html
lint:
uv run ruff check src/
format:
uv run ruff format src/
ansible:
ansible-lint infrastructure/ansible/playbook.yaml
act-ci:
@echo "Running CI jobs (lint, test, validate)..."
act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest \
-j lint-and-test \
-j terraform-validate \
-j ansible-lint
act-cd:
@echo "Running CD jobs (build, push)..."
@echo "Note: This requires DOCKER_USER and DOCKER_PASS secrets"
@test -f .secrets || (echo "Error: .secrets file not found. Create it with DOCKER_USER and DOCKER_PASS" && exit 1)
act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest \
--secret-file .secrets \
-j build-and-push \
-j smoke-test
run:
uv run uvicorn src.app.main:app --reload --host 0.0.0.0 --port 8000
docker-build:
docker build -t fastapi-devops-pipeline .
docker-run:
docker run -p 8000:80 --name fastapi-app fastapi-devops-pipeline
deploy:
chmod +x scripts/deploy.sh
./scripts/deploy.sh
pre-commit:
uv run pre-commit run --all-files
clean:
rm -rf .venv __pycache__ .pytest_cache .ruff_cache htmlcov/ .coverage