-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (44 loc) · 1.22 KB
/
Makefile
File metadata and controls
57 lines (44 loc) · 1.22 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
# Makefile for ChordPro project
# Variables
VENV_NAME := venv
PYTHON := python3
PIP := $(VENV_NAME)/bin/pip
PYTEST := $(VENV_NAME)/bin/pytest
DOCKER := docker
# Phony targets
.PHONY: all venv dev-venv test clean lint lint-fix format format-check
# Default target
all: venv
# Create virtual environment
venv: install-hooks
$(PYTHON) -m venv $(VENV_NAME)
$(PIP) install -r requirements.txt
# Create development virtual environment
dev-venv: install-hooks venv
$(PIP) install -r requirements-dev.txt
# Run tests (build Docker image and run pytest)
test:
$(DOCKER) build -t sheets-base .
$(DOCKER) build -t sheets-test -f Dockerfile.test .
$(DOCKER) run -v $(PWD)/tests/data:/app/tests/data --rm sheets-test
# Clean up
clean:
rm -rf $(VENV_NAME)
find . -type f -name '*.pyc' -delete
find . -type d -name '__pycache__' -delete
lint:
$(VENV_NAME)/bin/ruff check .
lint-fix:
$(VENV_NAME)/bin/ruff check --fix .
format:
$(VENV_NAME)/bin/ruff format .
format-check:
$(VENV_NAME)/bin/ruff format --check .
run:
$(DOCKER) run -p 8081:8081 sheets-base
# Install pre-commit hook
install-hooks:
@echo "Installing pre-commit hook..."
@mkdir -p .git/hooks
@cp scripts/pre-commit.sh .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit