-
Notifications
You must be signed in to change notification settings - Fork 1
/
lets.yaml
197 lines (167 loc) · 4.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
shell: bash
env:
DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1"
CURRENT_UID:
sh: echo "`id -u`:`id -g`"
commands:
build-target:
options: |
Usage: lets build-target <target>
cmd: |
docker build \
-t featureflags-server-${LETSOPT_TARGET} \
-f Dockerfile \
--target ${LETSOPT_TARGET} \
.
build-prod:
description: Build server image with embeded frontend
options: |
Usage: lets build-prod --repo=<repo> --tag=<tag>
Options:
--repo=<repo> Set container repo
--tag=<tag> Set container tag
cmd: |
docker build \
-f Dockerfile \
-t ${LETSOPT_REPO}:${LETSOPT_TAG} \
--target prd \
.
build-dev:
description: Build dev server image
ref: build-target
args: dev
build-test:
description: Build test server image
ref: build-target
args: test
build-docs:
description: Build docs image
ref: build-target
args: docs
build-ui:
description: Build client image
ref: build-target
args: assets-dev
run:
description: Run whole application
depends:
- build-dev
cmd: docker-compose up web rpc client
web:
description: Run web server
depends:
- build-dev
cmd: docker-compose up web
rpc:
description: Run grpc server
depends:
- build-dev
cmd: docker-compose up rpc
http:
description: Run http server
depends:
- build-dev
cmd: docker-compose up http
test:
description: Run tests
depends:
- build-test
- postgres-test
cmd: |
docker compose run --rm test
postgres:
description: Run postgres
cmd: docker-compose up postgres
postgres-test:
description: Run postgres test db
cmd: docker compose up -d postgres-test
apply-migrations-dev:
description: Apply migrations to local postgres
depends: [build-dev]
cmd: |
docker-compose run --rm backend \
pdm run python3 -m featureflags alembic -- upgrade head
rollback-migration-dev:
description: Rollback migrations to local postgres
depends: [build-dev]
cmd: |
docker-compose run --rm backend \
pdm run python3 -m featureflags alembic -- downgrade -1
create-migration:
description: |
Create new migration file
Example: lets create-migration add_date_created_column_to_user_table
depends: [build-dev]
cmd: |
docker-compose run --rm backend \
pdm run python3 -m featureflags alembic -- revision --autogenerate -m ${LETS_COMMAND_ARGS}
apply-seeds-dev:
description: Apply seeds to local postgres
cmd: |
docker-compose exec postgres \
psql -U postgres -d featureflags -f /var/lib/postgresql/seeds/seeds.sql
ishell:
description: Run app with ipython
depends: [build-dev]
cmd: docker-compose run --rm ishell
psql:
cmd: docker-compose exec postgres psql -U postgres -d featureflags
gen-docs:
description: Generate docs
depends: [build-docs]
cmd: |
docker-compose run --rm docs \
sphinx-build -a -b html docs public
ui:
description: Build and run UI with dev server
work_dir: ./ui
cmd: npm run dev
ui-build-dev:
description: Build UI in development mode, copy static, watch changes
work_dir: ./ui
cmd: npm run build-dev-watch
ruff:
description: Run ruff and fix errors
depends: [build-dev]
cmd: |
docker-compose run -T --rm backend \
pdm run ruff ${LETS_COMMAND_ARGS}
ruff-diff:
description: Run ruff to check diff
depends: [build-dev]
cmd: |
docker-compose run -T --rm backend \
pdm run ruff-diff ${LETS_COMMAND_ARGS}
mypy:
description: Run mypy
depends: [build-dev]
cmd: |
docker-compose run -T --rm backend \
pdm run mypy ${LETS_COMMAND_ARGS}
black:
description: Run black
depends: [build-dev]
cmd: |
docker-compose run -T --rm backend \
pdm run black ${LETS_COMMAND_ARGS}
fmt:
description: Run black and ruff
depends: [build-dev]
cmd: |
docker-compose run -T --rm backend \
pdm run fmt
release:
description: |
Update version in featureflags/__init__.py
Create new annotated tag
Push changes to remote
options: |
Usage: lets release <version> --message=<message>
Options:
<version> Set version
--message=<message>, -m Release message
Example:
lets release 1.0.0 --message="Added feature"
cmd: |
VERSION=${LETSOPT_VERSION} MESSAGE=${LETSOPT_MESSAGE} pdm run release