-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (88 loc) · 2.5 KB
/
Makefile
File metadata and controls
113 lines (88 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Python interpreter
PYTHON := python3
# Poetry
POETRY := poetry
# pipx
PIPX := pipx
# Virtual environment
VENV := .venv
# Source directory
SRC_DIR := getstream
# Test directory
TEST_DIR := tests
# Project name (assuming it's the same as the directory name)
PROJECT_NAME := getstream
# Default target
.DEFAULT_GOAL := help
# Docker image name
IMAGE_NAME := getstream-cli
# GitHub Container Registry
GHCR_REPO := ghcr.io/$(shell echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')
.PHONY: help
help:
@echo "Available commands:"
@echo " install : Install project dependencies"
@echo " update : Update project dependencies"
@echo " test : Run tests"
@echo " lint : Run linter"
@echo " fix : Auto-fix linter issues"
@echo " format : Format code"
@echo " clean : Remove build artifacts and cache files"
@echo " run : Run the CLI application"
@echo " pipx-install: Install the project globally using pipx"
@echo " pipx-uninstall: Uninstall the project from pipx"
@echo " build : Build the project"
@echo " publish : Publish the project to PyPI"
@echo " docker-build : Build Docker image"
@echo " docker-run : Run Docker container (use CMD='command' to specify CLI command)"
@echo " docker-push : Push Docker image to GitHub Container Registry"
.PHONY: install
install:
$(POETRY) install
.PHONY: update
update:
$(POETRY) update
.PHONY: test
test:
$(POETRY) run pytest $(TEST_DIR)
.PHONY: lint
lint:
$(POETRY) run ruff check $(SRC_DIR) $(TEST_DIR)
.PHONY: fix
fix:
$(POETRY) run ruff check --fix $(SRC_DIR) $(TEST_DIR)
.PHONY: format
format:
$(POETRY) run ruff format $(SRC_DIR) $(TEST_DIR)
.PHONY: clean
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.py[co]" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
rm -rf build dist *.egg-info
.PHONY: run
run:
$(POETRY) run stream-cli $(ARGS)
.PHONY: pipx-install
pipx-install:
$(PIPX) install --editable .
.PHONY: pipx-uninstall
pipx-uninstall:
$(PIPX) uninstall $(PROJECT_NAME)
.PHONY: build
build:
$(POETRY) build
.PHONY: publish
publish:
$(POETRY) publish
.PHONY: docker-build
docker-build:
docker build -t $(IMAGE_NAME) .
.PHONY: docker-run
docker-run:
docker run -e STREAM_API_KEY=$(STREAM_API_KEY) -e STREAM_API_SECRET=$(STREAM_API_SECRET) $(IMAGE_NAME) $(CMD)
.PHONY: docker-push
docker-push:
docker tag $(IMAGE_NAME) $(GHCR_REPO):$(VERSION)
docker push $(GHCR_REPO):$(VERSION)