forked from rivenmedia/riven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
81 lines (64 loc) · 2.25 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
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
.PHONY: help install run start stop logs clean format lint test pr-ready
# Detect operating system
ifeq ($(OS),Windows_NT)
# For Windows
DATA_PATH := $(shell echo %cd%)\data
else
# For Linux
DATA_PATH := $(PWD)/data
endif
help:
@echo Iceberg Local Development Environment
@echo -------------------------------------------------------------------------
@echo install : Install the required packages
@echo run : Run the Iceberg backend
@echo start : Build and run the Iceberg container \(requires Docker\)
@echo stop : Stop and remove the Iceberg container \(requires Docker\)
@echo logs : Show the logs of the Iceberg container \(requires Docker\)
@echo clean : Remove all the temporary files
@echo format : Format the code using isort
@echo check : Check the code using pyright
@echo lint : Lint the code using ruff and isort
@echo test : Run the tests using pytest
@echo coverage : Run the tests and generate coverage report
@echo pr-ready : Run the linter and tests
@echo -------------------------------------------------------------------------
# Docker related commands
start: stop
@docker build -t iceberg:latest -f Dockerfile .
@docker run -d --name iceberg --hostname iceberg --net host -e PUID=1000 -e PGID=1000 -v $(DATA_PATH):/iceberg/data -v /mnt:/mnt iceberg:latest
@docker logs iceberg -f
stop:
@-docker stop iceberg --time 0
@-docker rm iceberg --force
@-docker rmi iceberg:latest --force
logs:
@docker logs iceberg -f
# Poetry related commands
clean:
@find . -type f -name '*.pyc' -exec rm -f {} +
@find . -type d -name '__pycache__' -exec rm -rf {} +
@find . -type d -name '.pytest_cache' -exec rm -rf {} +
@find . -type d -name '.ruff_cache' -exec rm -rf {} +
@rm -rf data/media.pkl data/media.pkl.bak
install:
@poetry install --with dev
# Run the application
run:
@poetry run python backend/main.py
# Code quality commands
format:
@poetry run isort backend
check:
@poetry run pyright
lint:
@poetry run ruff check backend
@poetry run isort --check-only backend
sort:
@poetry run isort backend
test:
@poetry run pytest backend
coverage: clean
@poetry run pytest backend --cov=backend --cov-report=xml --cov-report=term
# Run the linter and tests
pr-ready: clean lint test