-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
40 lines (32 loc) · 1.02 KB
/
Makefile
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
ifneq (,$(wildcard ./.env))
include .env
export
DOCKER_ENV_FILE_PARAM = --env-file .env
endif
VENV_NAME?=.venv
PYTHON_VERSION?=3.10
PYTHON=${VENV_NAME}/bin/python
venv: $(VENV_NAME)/bin/activate
ifeq (, $(shell which python$(PYTHON_VERSION)))
$(error No python$(PYTHON_VERSION) in $(PATH))
endif
ifeq (, $(shell which action-validator))
$(error action-validator not found in $(PATH). Please install from mpalmer/action-validator)
endif
.PHONY: lint
lint: venv ## lint source code
@echo "Linting src ... 🧹"
@$(VENV_NAME)/bin/ruff check
.PHONY: clean
clean: ## clean project directory
rm -rf .tox .ruff_cache .venv __pycache__
.PHONY: tests
tests: venv ## run tests
@echo "Running tests ... 🧪"
@$(VENV_NAME)/bin/python -m tox
$(VENV_NAME)/bin/activate: requirements.txt
test -d $(VENV_NAME) || python$(PYTHON_VERSION) -m venv $(VENV_NAME)
${PYTHON} -m pip install -U pip
${PYTHON} -m pip install -r requirements.txt
# ensure venv is rebuild when requirements.txt changes
touch $(VENV_NAME)/bin/activate