-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (78 loc) · 1.88 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: build
VENV := . venv/bin/activate &&
TAG := $(shell git describe --tags --abbrev=0)
VERSION ?= $(shell git describe --tags --always)
-include .env
export
init:
cp .env.dev .env
check-ffmpeg:
ifeq (, $(shell which ffmpeg))
$(error "No ffmpeg in PATH, please install ffmpeg")
else
@echo "ffmpeg is installed"
endif
freeze:
$(VENV) pip freeze > requirements.txt
login-ghcr:
ifdef GITHUB_TOKEN
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
else
$(warning "GITHUB_TOKEN is not set")
endif
install:
ifneq (, $(shell which asdf))
asdf install python
endif
python -m venv venv
$(VENV) pip install -r requirements.txt
install-cli: check-ffmpeg
pip install .
format:
$(VENV) python -m black transcribe_me
lint:
$(VENV) python -m pylint transcribe_me --fail-under 7
# TODO: $(VENV) python -m unittest discover -s .
test:
@echo "Not implemented"
build:
rm -rdf build dist
$(VENV) python -m build
build-image:
docker compose build
publish: publish-package publish-image
publish-package: install
rm -rdf dist
$(MAKE) build
ifdef DRY_RUN
$(VENV) python -m twine upload --repository testpypi dist/*
else
$(VENV) python -m twine upload dist/*
endif
publish-image: install login-ghcr
ifdef CI
docker buildx build \
-t ghcr.io/echohello-dev/transcribe-me:latest \
-t ghcr.io/echohello-dev/transcribe-me:$(VERSION) \
--cache-to "type=gha,mode=max" \
--cache-from type=gha \
--platform $(DOCKER_DEFAULT_PLATFORM) \
--push \
.
else
docker compose build --push
endif
transcribe:
$(VENV) python -m transcribe_me.main
transcribe-archive:
$(VENV) python -m transcribe_me.main archive
transcribe-install:
$(VENV) python -m transcribe_me.main install
release-version:
ifdef CI
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
endif
git tag -a "v$(VERSION)"
git push origin main
git push --tags