-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (67 loc) · 2.5 KB
/
Makefile
File metadata and controls
82 lines (67 loc) · 2.5 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
76
77
78
79
80
81
82
.PHONY: help install lint lint-fix format test test-unit test-integration test-cov security ci docker-build docker-up docker-down clean
# Default target
help:
@echo "Available commands:"
@echo " make install - Install dependencies with poetry"
@echo " make lint - Run ruff linter and formatter check"
@echo " make lint-fix - Auto-fix linting and formatting issues"
@echo " make format - Format code with ruff"
@echo " make test - Run all tests"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make test-cov - Run tests with coverage report"
@echo " make security - Run bandit and safety security scanners"
@echo " make ci - Run all CI checks (lint, test-cov, security)"
@echo " make docker-build - Build the Docker image"
@echo " make docker-up - Start services with docker-compose"
@echo " make docker-down - Stop services with docker-compose"
@echo " make clean - Remove Python cache files and test artifacts"
# Install dependencies
install:
poetry install
# Linting and formatting
lint:
poetry run ruff check .
poetry run ruff format --check .
lint-fix:
poetry run ruff check --fix .
poetry run ruff format .
format:
poetry run ruff format .
# Testing
test:
poetry run pytest
test-unit:
poetry run pytest tests/unit/
test-integration:
poetry run pytest tests/integration/
test-cov:
SLACK_TOKEN=xoxb-test-token \
SLACK_ADMIN_TOKEN=xoxb-admin-test-token \
AIRTABLE_API_KEY=test-key \
AIRTABLE_BASE_ID=test-base \
poetry run pytest --cov=pybot --cov-report=xml --cov-report=term-missing -v --tb=short
# Security
security:
poetry run bandit -r pybot -x pybot/_vendor --skip B101 -f txt
# CI - runs all checks that CI will run
ci: lint test-cov security
@echo ""
@echo "✓ All CI checks passed!"
# Docker
docker-build:
docker build -f docker/Dockerfile -t pybot:latest .
docker-up:
docker-compose -f docker/docker-compose.yml up
docker-down:
docker-compose -f docker/docker-compose.yml down
# Cleanup
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name ".coverage" -delete
find . -type f -name "coverage.xml" -delete
rm -rf .ruff_cache htmlcov
@echo "✓ Cleaned up Python cache files and test artifacts"