forked from UF-CSU/club-portal-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
241 lines (204 loc) · 6.44 KB
/
Taskfile.yml
File metadata and controls
241 lines (204 loc) · 6.44 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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# Taskfile docs: https://taskfile.dev/
version: '3'
dotenv: ['.env', '{{.HOME}}/.env']
tasks:
setup:
desc: 'Run initial setup for the repo using venv'
cmds:
- cp ./sample.env ./.env
- python3 -m venv ./.venv
- source ./.venv/bin/activate && pip install --upgrade pip && pip install -r requirements.txt && pip install -r requirements.dev.txt
build:
desc: 'Build docker image if necessary'
sources:
- ./Dockerfile
- ./requirements*.txt
- ./docs/pages/*
run: when_changed
cmds:
- docker-compose --profile dev build
- task: build:docs:internal
build:network:
sources:
- ./Dockerfile
- ./requirements*.txt
run: when_changed
cmds:
- docker-compose -f docker-compose.network.yml build
dev:
desc: 'Run the servers config in dev mode'
deps:
- build
cmds:
# - docker-compose up
- docker-compose --profile dev up
dev:slim:
desc: 'Run only essential services with dev mode'
deps:
- build
cmds:
- docker-compose --profile slim up
network:
desc: 'Run server in network mode'
deps:
- build:network
cmds:
- docker-compose -f docker-compose.network.yml up
network:build:
desc: 'Run server in network mode'
deps:
- build:network
cmds:
- docker-compose -f docker-compose.network.yml up --build --force-recreate
lint:
desc: 'Lint python rules using Ruff'
cmds:
- docker-compose run --rm app sh -c "ruff check"
lint:fix:
desc: 'Lint python rules using Ruff'
cmds:
- docker-compose run --rm app sh -c "ruff check --fix"
format:
desc: 'Check code formatting conventions using Ruff/Black'
cmds:
- docker-compose run --rm app sh -c "ruff format --check"
format:fix:
desc: 'Format code using Ruff/Black'
cmds:
- docker-compose run --rm app sh -c "ruff format"
test:
desc: 'Run unit tests'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py test {{.CLI_ARGS}}"
makemigrations:dry-run:
desc: 'Runs makemigrations command with --dry-run in django'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py makemigrations --dry-run"
makemigrations:
desc: 'Create migration files if any models have changed'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py makemigrations {{.CLI_ARGS}}"
makemigrations:network:
desc: 'Create migration files in network mode'
deps:
- build:network
cmds:
- docker-compose -f docker-compose.network.yml run --rm app sh -c "python manage.py makemigrations {{.CLI_ARGS}}"
makemigrations:check:
desc: 'Check if a migration file needs to be made, exits with non-zero code if one does need to be made'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py makemigrations --check"
migrate:
desc: 'Apply migrations to the database.'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py migrate {{.CLI_ARGS}}"
migrate:network:
desc: 'Apply migrations to the database in network mode.'
deps:
- build:network
cmds:
- docker-compose -f docker-compose.network.yml run --rm app sh -c "python manage.py migrate {{.CLI_ARGS}}"
build-docker:clubs:
desc: 'Build docker image for clubs server'
cmds:
- docker buildx build --platform=linux/amd64,linux/arm64 -t ikehunter5/club-manager:latest -f ./Dockerfile .
push-docker:clubs:
desc: 'Push docker image for clubs server'
cmds:
- docker buildx build --platform=linux/amd64,linux/arm64 -t ikehunter5/club-manager:latest -f ./Dockerfile . --push
push-docker:proxy:
desc: 'Push docker image for clubs proxy server'
cmds:
- docker buildx build --platform=linux/amd64,linux/arm64 -t ikehunter5/club-manager-proxy:latest ./deploy/proxy --push
show_urls:
desc: 'List available urls in django'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py show_urls"
shell:
desc: 'Open interactive django shell'
interactive: true
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py shell"
loaddata:
desc: 'Load all available fixtures/mock data into database'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py loaddata fixtures/*"
generate_types:
desc: 'Generate TypeScript types from serializers.'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py generate_types"
generate_types:check:
desc: 'Generate TypeScript types from serializers.'
deps:
- build
cmds:
- docker-compose run --rm app sh -c "python manage.py generate_types --check"
down:
desc: 'Stop containers'
cmds:
- docker-compose --profile dev down --remove-orphans
clean:
desc: 'Stop containers and remove volumes'
cmds:
- docker-compose --profile dev down --remove-orphans -v
clean:network:
desc: 'Stop containers and remove volumes'
cmds:
- docker-compose -f docker-compose.network.yml down --remove-orphans -v
down:slim:
desc: 'Stop containers'
cmds:
- docker-compose --profile slim down --remove-orphans
clean:slim:
desc: 'Stop containers and remove volumes'
cmds:
- docker-compose --profile slim down --remove-orphans -v
coverage:
desc: 'Just start the coverage nginx server'
cmds:
- docker-compose up coverage -d
###################################
# Sphinx Docs
###################################
build:docs:internal:
desc: 'Build docs files, needs the docker image to already be build'
internal: true
cmds:
- docker-compose --profile slim run --rm app sh -c "rm -rf /docs/_build/ && sphinx-build /docs /docs/_build"
build:docs:
desc: 'Generate html for Sphinx documentation'
sources:
- ./Dockerfile
- ./requirements*.txt
- ./docs/pages/*
cmds:
- docker-compose --profile slim build
- task: build:docs:internal
dev:docs:
desc: 'Auto generate docs html on changes, requires sphinx-autobuild pip package'
cmds:
- sphinx-autobuild -a ./docs ./docs/_build --host localhost --port 8010
push:docs:
desc: 'Push docs to AWS S3 bucket'
deps:
- build:docs
cmds:
- aws s3 cp ./docs/_build/ "s3://$S3_STORAGE_BUCKET_NAME/docs/" --recursive