-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (34 loc) · 1.4 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
.PHONY: all deps start build _build clean remove-exports remove-env remove-build-artifacts remove-dist remove-pycache sudo-act
all: clean deps start
deps :
poetry config virtualenvs.in-project true
poetry install --no-root
start :; poetry run python3 main.py
### Build
# This is only intended to be used for Linux builds with Poetry (venv)
build: remove-build-artifacts remove-dist _build
_build :
PYTHON_VERSION=$$(cat .python-version); \
SITE_PACKAGES=".venv/lib/python$$PYTHON_VERSION/site-packages"; \
pyinstaller main.py --onefile --name DiscordRoleScraper --paths $$SITE_PACKAGES
### Clean
clean: remove-exports remove-venv remove-pycache remove-build-artifacts remove-dist
remove-exports :; rm -rf export/*
remove-venv :; rm -rf .venv
remove-build-artifacts :; rm -rf build
remove-dist :; rm -rf dist
# https://stackoverflow.com/a/41386937
# Will remove pycache files under .venv/ as well
# Slightly modified to work with Make ($ -> $$)
remove-pycache :; find . -regex '^.*\(__pycache__\|\.py[co]\)$$' -delete
### Local Act Workflows
# Example usage:
# - make sudo-act ACTION=push
# - make sudo-act ACTION=push FLAGS="--secret-file workflow.secrets"
# Depending on your Docker installation, sometimes Act
# doesnt have permission to interact with your docker daemon
sudo-act :
mkdir -p tmp/artifacts
sudo env "PATH=$$PATH" act $(ACTION) $(FLAGS) \
--artifact-server-path /tmp/artifacts
rm -rf tmp