-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlets.yaml
137 lines (117 loc) · 3.58 KB
/
lets.yaml
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
shell: bash
env:
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
REQ_PYTHON_V: "Python 3.12.4"
eval_env:
CURRENT_UID: echo "`id -u`:`id -g`"
CURRENT_USER_NAME: echo "`id -un`"
CURRENT_PYTHON_V: echo "`python --version 2>&1`"
commands:
build-app:
description: __build for inner purpose
cmd: docker build -t aeproxy . -f docker/backend.dockerfile --target dev
build-checks:
description: __build for inner purpose
cmd: docker build -t aeproxy-checks . -f docker/backend.dockerfile --target checks
check_python_v:
description: __check python versoin for local deps
cmd: |
if [ "$REQ_PYTHON_V" != "$CURRENT_PYTHON_V" ]; then
echo "Python version is not $REQ_PYTHON_V. Exiting the process."
exit 1
fi
echo "Python ok"
init:
description: Install all project deps for indexing
cmd: |
lets init-venv
lets install-py-deps
# Main spinup command
run:
description: Run discord bot monitor
depends:
- build-app
cmd: |
docker-compose up aeproxy
test:
description: Run unit tests
depends:
- build-checks
options: |
Usage: lets test [<tests>]
cmd: [docker-compose run --rm pytest]
flake:
description: Run flake8
options: |
Usage: lets flake [--diff] [<args>...]
Options:
<args>... Trailing positional args
-d, --diff Run only on diff
depends:
- build-checks
cmd: |
FLAKE_ARGS='.'
DIFF=$( [[ -n "$LETSOPT_DIFF" ]] && echo "--diff" )
if [[ -n "$LETSOPT_DIFF" ]] && [[ -n "$LETSOPT_ARGS" ]]; then
FLAKE_ARGS="$DIFF $LETSOPT_ARGS"
fi
docker-compose run -e CMD="flake8" ARGS=${FLAKE_ARGS} --rm checks
ishell:
description: Run ipython shell
depends:
- build-app
cmd: docker-compose run --rm -T ishell
init-venv:
description: |
Init virtual env in project.
depends:
- check_python_v
cmd: |
if [[ ! -d .venv ]]; then
echo Creating .venv
$(which python3) -m venv .venv
fi
lets activate-pyenv
if [ ! -f .venv/bin/pip-compile ]; then
echo Installing pip-tools
pip install --upgrade pip
pip install pip-tools
fi
if [ ! -f requirements/backend.txt ]; then
echo "Compiling requirements/backend.in"
pip-compile --output-file=requirements/backend.txt requirements/backend.in
fi
if [ ! -f requirements/checks.txt ]; then
echo "Compiling requirements/checks.in"
pip-compile --output-file=requirements/checks.txt requirements/checks.in
fi
activate-pyenv:
description: activate python venv
depends:
- check_python_v
cmd: |
source .venv/bin/activate
echo activated $(which python3)
install-py-deps:
description: install python dependencies from requiremtns
depends:
- check_python_v
cmd: |
$(which python3) -m pip install -r requirements/backend.txt
$(which python3) -m pip install -r requirements/checks.txt
update-py-deps:
description: generate new dependencies for backend
cmd: |
docker-compose run --rm aeproxy-base pip-compile \
--output-file=requirements/backend.txt requirements/backend.in
update-checks-deps:
description: generate new dependencies for checks
cmd: |
docker-compose run --rm aeproxy-base pip-compile \
--output-file=requirements/checks.txt requirements/checks.in
enable-hooks:
description: enable git hooks for project
cmd: |
git config --local core.hooksPath .hooks
echo Git hooks enabled!