Files
2026-12-02 16:58:44 +01:00

59 lines
1.7 KiB
Makefile

IMAGE ?= python-learning:latest
ENGINE ?= podman
MOD ?=
RUN_CONTAINER = $(ENGINE) run --rm \
-v "$(CURDIR):/workspace:Z" \
-w /workspace \
$(IMAGE)
.PHONY: help image check test test-all test-project lint fmt fmt-check typecheck shell
help:
@echo "Dostępne komendy:"
@echo " make image - Zbuduj obraz kontenera Python (jednorazowo)"
@echo " make check - Sprawdź lint (ruff) + typy (mypy)"
@echo " make test MOD=01-core/01-basics - Uruchom testy wybranego rozdziału"
@echo " make test - Uruchom testy 01-core + 02-engineering-2026"
@echo " make test-project - Uruchom testy mini-projektu incident-tracker"
@echo " make test-all - Uruchom testy wszystkich ścieżek + projektu"
@echo " make fmt - Sformatuj kod (ruff format)"
@echo " make fmt-check - Sprawdź formatowanie kodu"
@echo " make shell - Otwórz powłokę bash wewnątrz kontenera"
image:
$(ENGINE) build -t $(IMAGE) -f Containerfile .
lint:
$(RUN_CONTAINER) ruff check exercises projects
typecheck:
$(RUN_CONTAINER) mypy exercises projects
check: lint typecheck
test:
ifdef MOD
$(RUN_CONTAINER) pytest -v exercises/$(MOD)
else
$(RUN_CONTAINER) pytest -v exercises/01-core exercises/02-engineering-2026
endif
test-project:
$(RUN_CONTAINER) pytest -v projects/incident-tracker
test-all:
$(RUN_CONTAINER) pytest -v exercises projects
fmt:
$(RUN_CONTAINER) ruff format exercises projects
fmt-check:
$(RUN_CONTAINER) ruff format --check exercises projects
shell:
$(ENGINE) run --rm -it \
-v "$(CURDIR):/workspace:Z" \
-w /workspace \
$(IMAGE) bash